Overview
Azure role-based access control, or Azure RBAC, determines who or what can perform specific actions on Azure resources at a defined scope. A role assignment combines:
- A security principal.
- A role definition.
- A scope.
The security principal can be a user, group, service principal, or managed identity. The role definition lists allowed management-plane actions and, for supported services, data-plane actions. Scope limits where those permissions apply.
Least privilege means granting only the permissions required, at the narrowest practical scope, for the shortest necessary duration. It also means separating duties that should not be controlled by one identity.
Human and workload identities have different behavior:
- Humans sign in interactively, change jobs, use devices, complete MFA, request approval, and can activate eligible roles through Privileged Identity Management.
- Workloads run unattended and need stable, noninteractive access. They use managed identities, service principals, or federated workload identities and cannot complete human activation prompts.
Treating them as interchangeable causes security and operational problems. Applications should not run as employee accounts, people should not share pipeline credentials, and privileged human roles should not be permanently active merely because automation needs access.
For interviews, candidates should explain:
- How principal, role, and scope form a role assignment.
- How scope inheritance and additive permissions affect effective access.
- The difference between management-plane actions and data-plane actions.
- Why
Owner,Contributor, andUser Access Administratorare high-risk roles. - How PIM, groups, access reviews, conditions, and separation of duties reduce standing privilege.
- Why workloads need dedicated identities and credential-free authentication.
- How CI/CD, emergency access, production operations, and application runtime identities should differ.
- How to diagnose role-assignment and authorization failures without broadening access.
Core Concepts
The Three Parts of a Role Assignment
Every Azure role assignment answers:
- Who: A user, group, service principal, or managed identity.
- What: A built-in or custom role definition.
- Where: Management group, subscription, resource group, or resource scope.
Example:
Principal: orders-api-prod managed identity
Role: Azure Service Bus Data Sender
Scope: production orders topic
This is better than:
Principal: orders-api-prod managed identity
Role: Contributor
Scope: production subscription
The first assignment expresses the actual runtime need. The second grants broad management authority unrelated to sending messages.
Security Principal Types
Azure RBAC roles can be assigned to:
- User: A human identity.
- Group: A collection of users or, in supported designs, other principals.
- Service principal: A tenant-local application identity.
- Managed identity: A special service principal whose credential is managed by Azure.
Human access is usually easier to govern through groups rather than direct user assignments. Workload access should be assigned to the specific workload identity whose code needs the permission.
Do not grant an application role to a developer's user identity and assume production is configured. Do not use an employee account as a scheduled-task credential.
Role Definitions
A role definition contains:
Actions: Allowed management-plane operations.NotActions: Management actions excluded from a broad action set.DataActions: Allowed data-plane operations.NotDataActions: Data actions excluded from a broad set.- Assignable scopes.
Azure RBAC computes effective role permissions as:
Actions - NotActions
DataActions - NotDataActions
NotActions and NotDataActions are not explicit denies. Another role assignment can still grant the excluded permission.
Prefer built-in job-function roles when they fit. Use a custom role when the required operation set is stable, understood, and materially narrower than available built-in roles. Avoid wildcard actions because future provider operations can expand the role unintentionally.
Management Plane and Data Plane
The management plane creates and configures Azure resources through Azure Resource Manager. The data plane accesses the content or service hosted by a resource.
Examples:
Contributor generally manages resources but does not automatically grant all data access. Service-specific roles such as Storage Blob Data Reader, Key Vault Secrets User, or Azure Service Bus Data Sender grant data actions.
Some powerful management permissions can indirectly lead to data access, such as changing credentials, deploying code, or modifying an authorization configuration. Threat modeling must consider indirect paths, not only listed data actions.
Scope and Inheritance
Azure scopes form a hierarchy:
Management group
Subscription
Resource group
Resource
A role assignment applies to its scope and descendant scopes. A subscription-level assignment affects every resource group and resource in the subscription.
Least privilege therefore has two dimensions:
- Choose the narrowest role.
- Choose the narrowest scope.
A narrow role at the entire subscription may still be excessive. A broad role at one resource may also be excessive.
Design scopes around ownership and operational boundaries. Resource groups are useful lifecycle and authorization boundaries only when their resources genuinely share administration.
Additive Effective Permissions
Azure RBAC is primarily additive. Effective access is the union of applicable assignments:
- Direct assignments.
- Group assignments.
- Parent-scope assignments.
- Eligible roles after activation.
- Other role assignments at the resource.
Adding Reader at a resource does not reduce Contributor inherited from the subscription. To understand access, inspect all applicable assignments rather than only the current resource's direct assignments.
Deny assignments can block access but are managed by specific Azure features and are not a general-purpose substitute for careful role design. Role assignment conditions filter a grant; they do not create an arbitrary explicit deny.
Least Privilege
Least privilege requires answering:
- Which operations are required?
- On which resources?
- For how long?
- From which identity?
- Under which conditions?
Practical techniques include:
- Use service-specific roles instead of
OwnerorContributor. - Assign at a resource or focused resource-group scope.
- Use separate identities for separate workloads.
- Use PIM eligible assignments for human administration.
- Remove obsolete assignments.
- Use access reviews.
- Add role-assignment conditions where supported.
- Use time-bound grants for migrations and incidents.
- Keep production separate from nonproduction.
Least privilege is not a one-time role selection. It is an ongoing lifecycle of provisioning, review, expiry, removal, and incident response.
Privileged Administrator Roles
Roles with permission to grant access are especially sensitive:
Ownercan manage resources and role assignments.User Access Administratorcan manage access.Role Based Access Control Administratorcan manage role assignments.
Contributor cannot normally grant Azure roles, but it can make broad resource changes and may obtain indirect access by deploying code, changing configuration, or controlling resource behavior.
Limit subscription owners. Prefer job-function roles. If role-assignment administration must be delegated, use supported conditions to restrict which roles can be assigned, to which principals, and at which scope.
Role-assignment permissions should be separated from workload code deployment where practical. A person who can both deploy arbitrary code and attach a privileged managed identity can exercise that identity's authority.
Human Identities
Human identities represent employees, contractors, partners, and administrators.
Controls appropriate to humans include:
- Multifactor authentication.
- Conditional Access.
- Managed devices and compliant locations.
- Privileged Identity Management.
- Approval and justification.
- Time-bound role activation.
- Group-based assignments.
- Joiner, mover, and leaver processes.
- Periodic access reviews.
- Separate privileged administration accounts.
Humans need traceability. Shared accounts weaken auditability and make revocation difficult.
Privileged administrators should use separate accounts or controlled privileged access workflows rather than ordinary productivity sessions. Emergency access accounts are exceptional identities with tightly monitored use, protected credentials, tested procedures, and minimal permanent roles.
Workload Identities
Workload identities represent applications, services, scripts, pipelines, containers, and automation.
In Microsoft Entra ID, common workload identity forms are:
- Managed identities.
- Application registrations and service principals.
- Federated workload identities.
Controls appropriate to workloads include:
- Dedicated identity per workload boundary.
- Managed identity on supported Azure compute.
- Workload identity federation for external CI/CD or Kubernetes scenarios.
- Certificate credentials when federation or managed identity is unavailable.
- Short-lived tokens.
- No interactive MFA dependency.
- Direct, narrow role assignments.
- Ownership, inventory, monitoring, and expiration.
- Rotation for any remaining credentials.
Do not use a human account for automation. Password expiry, MFA, employment changes, and interactive challenges make human accounts operationally unsuitable and difficult to govern as workloads.
Separating Human and Workload Access
Consider a production API:
Human operator:
Eligible Website Contributor on one resource group
Activates through PIM
MFA and approval required
Application runtime:
Managed identity
Key Vault Secrets User on one application vault
Service Bus Data Sender on one topic
Deployment pipeline:
Federated service principal
Website Contributor on one application
No runtime secret-read role
These identities have different purposes:
- The operator manages the application temporarily.
- The runtime accesses dependencies continuously.
- The pipeline deploys artifacts without reading production business data.
Combining them creates unnecessary attack paths. A compromised pipeline should not automatically gain all runtime data permissions. A runtime identity should not deploy new code or assign roles.
Groups for Humans, Direct Boundaries for Workloads
Assign human roles to groups where practical:
- Reduces individual role assignments.
- Aligns access with team membership.
- Simplifies joiner and leaver processes.
- Enables group access reviews and PIM for Groups.
For workloads, a direct role assignment to a managed identity or service principal often provides clearer ownership and faster authorization change behavior. Group membership for managed identities can be useful but token and membership caching can delay changes.
A user-assigned managed identity can act as a shared workload boundary for true replicas. Do not use one shared identity for unrelated applications merely to reduce assignment count.
Privileged Identity Management
Microsoft Entra Privileged Identity Management reduces standing human privilege by making assignments eligible rather than permanently active.
Activation can require:
- MFA.
- Approval.
- Business justification.
- A limited activation duration.
- Conditional Access authentication context.
PIM also provides notifications, audit history, access reviews, and assignment expiration.
Workloads cannot complete an interactive PIM activation flow. Their required runtime roles must be active, so the defense is:
- Narrow role.
- Narrow scope.
- Dedicated identity.
- Credential-free or federated authentication.
- Monitoring and lifecycle governance.
Do not design an unattended application around a role that requires a human to activate it every few hours.
CI/CD Identities
A deployment pipeline is a workload and needs its own identity.
Prefer workload identity federation for platforms such as GitHub Actions or supported CI systems. Federation exchanges a trusted external token for a Microsoft Entra token without storing a long-lived Azure client secret.
Pipeline permissions should be limited to deployment operations:
- Deploy to the intended application or resource group.
- Read required deployment metadata.
- Avoid production data-plane access.
- Avoid broad subscription
Owner. - Avoid role-assignment permission unless the pipeline is explicitly an infrastructure authorization pipeline.
Separate:
- Application deployment.
- Infrastructure deployment.
- Role-assignment management.
- Runtime dependency access.
Not every organization needs four pipelines, but the security boundaries should be explicit.
Service Principals and Credentials
When a service principal must use a credential:
Preference generally follows:
- Managed identity when hosted on supported Azure compute.
- Workload identity federation.
- Certificate credential.
- Client secret as a constrained legacy option.
For client secrets:
- Store them in an appropriate secret store.
- Rotate before expiration.
- Restrict who can add credentials.
- Monitor credential additions.
- Use a short validity period.
- Record owner and purpose.
A credential proves which workload is calling. It does not define what the workload can do; Azure RBAC and resource authorization do that.
Custom Roles
Create a custom role when:
- No built-in role matches the required operation set.
- The role will be reused enough to justify governance.
- Required actions and data actions are understood.
- The organization can review provider changes.
Avoid:
- Wildcards without careful
NotActions. - Combining unrelated job functions.
- Assignable scope at the tenant root without need.
- Custom roles created for one temporary incident.
- Assuming
NotActionsis a deny.
Custom roles require versioning, ownership, testing, and periodic review.
Azure ABAC and Role Assignment Conditions
Azure attribute-based access control adds conditions to supported Azure role assignments. A condition narrows a grant based on attributes such as:
- Resource tags.
- Blob path or container.
- Principal custom security attributes.
- Network path or private-link context.
- Request environment.
Conditions are useful when ordinary role and scope combinations would require many assignments or cannot express a data boundary.
Conditions:
- Apply only to supported actions and services.
- Filter permissions granted by a role assignment.
- Do not create a general explicit deny.
- Add policy complexity that must be tested and monitored.
Use RBAC role and scope first. Add conditions when they materially improve control or manageability.
Separation of Duties
Separation of duties prevents one identity from controlling every step of a sensitive operation.
Examples:
- One team deploys application code; another controls production role assignments.
- A Key Vault Secrets Officer can rotate values but cannot grant itself access-management roles.
- An approver authorizes PIM elevation; the requester performs the operation.
- A pipeline builds artifacts; a separate protected stage deploys to production.
- Purge permission is separate from ordinary secret deletion.
Avoid creating a process so fragmented that emergency recovery is impossible. Document and test both normal and break-glass procedures.
Infrastructure as Code
Role definitions and assignments should be managed through infrastructure as code when possible.
Benefits:
- Reviewable intent.
- Repeatable environment setup.
- Drift detection.
- Stable use of principal and role IDs.
- Easier cleanup.
Use immutable identifiers:
- Principal object ID for the intended identity.
- Built-in role definition ID rather than display name.
- Exact resource scope ID.
Deployment ordering matters. A managed identity or service principal must exist before its role assignment can reference the principal ID. Directory and RBAC propagation may require bounded retry.
Avoid mixing manual and automated ownership of the same assignment unless reconciliation behavior is understood.
Access Reviews and Lifecycle
Human access changes when people join, change teams, or leave. Workload access changes when applications are replaced, retired, or split.
Review:
- Subscription and management-group owners.
- Role-assignment administrators.
- Permanent privileged assignments.
- Guest-user access.
- Service principals with broad roles.
- Managed identities no longer attached to resources.
- Expired or unused credentials.
- Direct user assignments that should be group-based.
- Production roles inherited from broad parent scopes.
Automated inventory should include identity owner, business purpose, environments, scopes, credentials, last activity, and retirement date.
Emergency and Break-Glass Access
Emergency access exists for identity-provider failures, lockouts, or severe incidents.
It should be:
- Extremely limited in number.
- Excluded from ordinary daily use.
- Protected with strong independent credentials.
- Monitored with high-severity alerts.
- Tested periodically.
- Documented with a post-use review.
Emergency access is not a reason to give every operator permanent Owner. It is a distinct control for rare failure scenarios.
Troubleshooting Effective Access
When access fails:
- Confirm the caller's principal object ID.
- Confirm the requested operation and whether it is management or data plane.
- Identify the exact resource scope.
- List direct, group, and inherited role assignments.
- Check deny assignments and role-assignment conditions.
- Inspect
ActionsorDataActionsin the role definition. - Check token, group, and role-assignment propagation.
- Confirm network and resource-specific authorization controls.
A 403 does not imply that Contributor should be added. Determine the missing action and grant the smallest appropriate role.
For security investigations, record role changes, PIM activations, credential changes, pipeline identity use, and sensitive data-plane access.
Common Mistakes
- Assigning
Ownerwhen a service-specific role is sufficient. - Assigning a narrow role at subscription scope without considering inheritance.
- Using a human account for automation.
- Sharing one service principal among unrelated applications.
- Giving a deployment pipeline runtime data access.
- Assuming
Contributorgrants all data-plane access. - Assuming
NotActionsis an explicit deny. - Adding direct user assignments instead of governed group membership.
- Making privileged human roles permanently active.
- Expecting a workload to activate PIM.
- Using client secrets where managed identity or federation is available.
- Ignoring inherited assignments while troubleshooting.
- Creating wildcard custom roles that silently expand over time.
- Leaving retired identities, credentials, and assignments in place.
Interview Design Checklist
For an authorization design, identify:
- The human and workload principals.
- Each principal's job or runtime function.
- Required management and data actions.
- The narrowest useful scope.
- Whether access is permanent, eligible, or time-bound.
- Which identities can grant access.
- Which duties must be separated.
- How credentials are eliminated or protected.
- How assignments are deployed, reviewed, and removed.
- How effective access and suspicious use are monitored.