2.2 Dataverse Security Roles for Code Components, Least Privilege & Troubleshooting Operational Security

Key Takeaways

  • Security roles combine per-table privileges (Create/Read/Write/Delete/Append/AppendTo/Assign/Share) with an access level from None up to Organization.
  • Application users running plug-ins, custom APIs, and integrations should be assigned a dedicated, least-privilege security role - never System Administrator.
  • Column security profiles restrict Create/Read/Update access to individual secured columns beyond what table-level roles control.
  • Error code 0x80040220 ("Principal user is missing prvReadX privilege") names the exact missing privilege and table, making it the starting point for troubleshooting.
  • Microsoft Entra ID security-group teams let a role be assigned once to an entire directory group instead of per user.
Last updated: July 2026

Dataverse Security Roles for Code Components, Least Privilege & Troubleshooting

Quick Answer: Security roles combine per-table privileges with an access level to control what a user or application user can do. PL-400 expects you to assign code components - plug-ins, custom APIs, integrations - a dedicated, least-privilege security role rather than System Administrator, and to diagnose operational security errors such as 0x80040220 by identifying the exact missing privilege and table.

Security Roles: The Core Building Block

A Dataverse security role is a named collection of privileges (Create, Read, Write, Delete, Append, Append To, Assign, Share) applied per table, each capped at an access level that determines the scope of records the privilege reaches.

Access levelScope
NoneNo access
User (Basic)Only records the user owns
Business Unit (Local)Records owned by users in the caller's business unit
Parent: Child Business Units (Deep)The caller's business unit and all child business units
Organization (Global)Every record regardless of owner or business unit

Business Units, Teams, and Ownership

Business units form a hierarchy that scopes Business-Unit-level access; every user and every owned record belongs to exactly one business unit. Teams aggregate users - and, since Dataverse supports Microsoft Entra ID security-group teams, entire directory groups - so a security role can be assigned once to a team rather than to each user individually. Owner teams can also directly own records, a common pattern for shared queues of case or lead records. Row-level sharing supplements roles by granting one user or team access to a specific record beyond what their role or business unit would normally allow, which is useful for one-off exceptions without loosening the role itself.

For finer control than table-level roles allow, column security profiles restrict Create, Read, and Update access to individual secured columns - columns flagged "Enable column security" in their column definition. A common example is hiding a Social Security Number or a custom compensation field from every role except one profile assigned to HR.

Configuring Roles for Code Components (Least Privilege)

Plug-ins, custom APIs, PCF Web API calls, cloud flows, and external integrations typically run under an application user - a service-principal identity backed by a Microsoft Entra app registration - rather than a human's interactive sign-in. Because that identity has no human oversight in the moment, PL-400 expects you to apply least privilege:

  • Create a dedicated security role per integration or service, scoped only to the tables and privileges the code actually touches - never assign System Administrator to an application user "to make it work."
  • Prefer the lowest access level that satisfies the scenario. If a plug-in only ever reads or writes records it creates itself, User-level access is enough; Organization-level should be reserved for genuinely cross-business-unit integration accounts.
  • Grant Append and AppendTo deliberately - these privileges control whether a record can be linked to another (for example, attaching a note or associating two records), and are a frequent source of "it can read and write the record but the relationship save still fails" bugs.
  • Use the Share privilege sparingly; a service account that can re-share access to other users has a broader blast radius than one that cannot.
  • For plug-ins that must act as the calling user rather than an elevated identity, avoid impersonation through CallerId unless the design explicitly requires it - an incorrectly configured "Run in User's Context" setting on a plug-in step is a common exam distractor.

Troubleshooting Operational Security Issues

The signature Dataverse authorization error is 0x80040220 - "Principal user is missing prvReadX privilege" (or prvCreateX, prvWriteX, and so on), where X is the logical table name. Diagnosing it is mechanical once you know the pattern:

  1. Identify the exact privilege and table named in the error - that tells you precisely which permission is missing, not a general "access denied."
  2. Check which security roles are assigned to the failing user or application user, and what access level each role grants for that table.
  3. If the role's access level looks sufficient but the call still fails, check the record's owning business unit relative to the caller's business unit - a Business-Unit-level role will not reach a record owned by a sibling business unit - and check for a secured column blocking a specific field even though table-level access is fine.
  4. Use plug-in trace logs, or the Plug-in Registration Tool's profiler, to see exactly which operation and record triggered the failure, since a single plug-in often performs several chained Organization service calls under one execution.

Exam Angle

Expect scenario questions naming a specific error code or symptom - "an integration using an application user can read Accounts but fails when creating a related Contact" - and asking which privilege, access level, or role change fixes it. The correct answer almost always favors the smallest privilege grant that resolves the stated symptom, consistent with least privilege.

Test Your Knowledge

An application user running an integration can read and update Account records, but the operation fails only when the integration tries to associate a new Contact with that Account. Which privilege is most likely missing from its security role?

A
B
C
D