Prev Next

Cloud / Azure Role Based Access Control (RBAC) Interview questions

Last updated

1. What is Azure RBAC? 2. What are the core components of Azure RBAC? 3. What is a security principal in Azure RBAC? 4. What is a role definition in Azure RBAC? 5. What is a role assignment in Azure RBAC? 6. What are the scope levels in Azure RBAC? 7. What is role assignment inheritance in Azure RBAC? 8. What are the four fundamental built-in Azure roles? 9. What is the difference between Owner and Contributor roles? 10. What is the User Access Administrator role? 11. What is the difference between Azure RBAC and Microsoft Entra roles? 12. What are Actions and NotActions in a role definition? 13. What are DataActions and NotDataActions? 14. What is the purpose of AssignableScopes? 15. What is the principle of least privilege in Azure RBAC? 16. How do you assign an Azure role in the Azure portal? 17. How do you assign an Azure role using Azure CLI? 18. How do you list role assignments using Azure CLI or PowerShell? 19. How do you remove a role assignment in Azure? 20. What is a custom role in Azure RBAC? 21. How do you create a custom role using Azure CLI? 22. Which built-in roles are used to manage virtual machines? 23. What is the Storage Blob Data Contributor role? 24. How do resource locks interact with Azure RBAC roles? 25. What is the difference between control plane and data plane access? 26. How does Azure RBAC evaluate permissions for a request? 27. What are deny assignments in Azure RBAC? 28. What is the difference between Azure RBAC and Azure Policy? 29. Why should you assign roles to groups instead of users? 30. How do managed identities use Azure RBAC? 31. How do you grant a CI/CD pipeline access to Azure resources? 32. How do you grant an app read access to Key Vault secrets? 33. Why is Azure RBAC preferred over Key Vault access policies? 34. What is the role assignment limit per subscription? 35. How long do Azure role assignment changes take to apply? 36. What happens to role assignments when a user is deleted? 37. Why does role assignment creation fail with RoleAssignmentExists? 38. How do you troubleshoot an AuthorizationFailed error? 39. When should you choose a custom role over a built-in role? 40. How do you use Azure RBAC with management groups? 41. What is elevate access for Global Administrators? 42. What is the Role Based Access Control Administrator role? 43. What are Azure role assignment conditions (ABAC)? 44. How does Privileged Identity Management work with Azure RBAC? 45. How do you audit Azure RBAC changes? 46. How can you optimize role assignments to avoid subscription limits? 47. How do you manage Azure RBAC as code with Bicep? 48. Explain the internal working of Azure RBAC authorization in Azure Resource Manager? 49. Why can Contributor access still expose storage data through account keys? 50. How do you design Azure RBAC for a multi-subscription landing zone?

1. What is Azure RBAC?

Azure role-based access control (Azure RBAC) is the authorization system built on Azure Resource Manager that decides who can do what, and on which resources. You grant access by assigning a role to a security principal at a particular scope.

Instead of giving someone blanket admin rights, you pick a role such as Reader, Contributor, or a narrower job-function role, and attach it to a user, group, service principal, or managed identity at a management group, subscription, resource group, or single resource.

Azure RBAC is additive and inherited: permissions from all your assignments are combined, and an assignment at a parent scope flows down to every child. It is enabled by default on every Azure subscription and has no extra cost.

Take quiz
Azure RBAC controls access to which kind of objects?
Only virtual machine guest operating systems
Only billing invoices and cost reports
Azure resources managed through Azure Resource Manager
Microsoft Entra users and their passwords
How are permissions from several role assignments combined in Azure RBAC?
They are added together (union of allowed actions)
Only the role assigned most recently is applied
They are averaged by role priority
Only the most restrictive role is applied

2. What are the core components of Azure RBAC?

An Azure RBAC grant always answers three questions: who gets access, what they can do, and where. Those map to four building blocks.

Component Question it answers Example
Security principal Who gets access? User, group, service principal, managed identity
Role definition What can they do? Reader, Contributor, a custom role
Scope Where does it apply? Management group, subscription, resource group, resource
Role assignment The binding of the three above Group Dev-Team + Contributor + rg-app

Deleting the assignment removes the access but leaves the role definition and principal untouched. The same role definition can be reused in thousands of assignments.

Take quiz
Which component lists the actions that are allowed or denied?
Scope
Resource lock
Role definition
Security principal
Which component ties a principal, a role, and a scope together?
Role assignment
Azure Policy initiative
Role definition
Management group

3. What is a security principal in Azure RBAC?

A security principal is the identity that receives a role assignment. Azure identifies it by its Microsoft Entra object ID, not by its display name or email.

Azure RBAC supports four kinds:

  • User - a person with a Microsoft Entra account (including invited guests).
  • Group - a Microsoft Entra security group; every member inherits the assignment.
  • Service principal - the identity of an application or automation tool.
  • Managed identity - an automatically managed service principal for an Azure resource, either system-assigned or user-assigned.

Because assignments point at object IDs, deleting and recreating a user with the same name does not bring the old access back.

Take quiz
What does an Azure role assignment actually reference for the principal?
The user's display name
The user's mailbox address only
The subscription administrator email
The Microsoft Entra object ID
A managed identity is best described as:
An automatically managed service principal tied to an Azure resource
A security group of administrators
A shared user account with a rotating password
A role definition for automation scripts

4. What is a role definition in Azure RBAC?

A role definition is a named collection of permissions. It lists which operations a holder can perform and the scopes where the role may be assigned. Azure ships with more than 400 built-in definitions, and you can add your own.

The key properties are Actions, NotActions, DataActions, NotDataActions, and AssignableScopes. This is how the built-in Reader role is shaped:

{
  "roleName": "Reader",
  "description": "View all resources, but does not allow you to make any changes.",
  "type": "BuiltInRole",
  "permissions": [
    {
      "actions": [ "*/read" ],
      "notActions": [],
      "dataActions": [],
      "notDataActions": []
    }
  ],
  "assignableScopes": [ "/" ]
}

A definition grants nothing by itself. It only takes effect once a role assignment links it to a principal and a scope.

Take quiz
What does the Actions value */read in the Reader role mean?
Read access to Microsoft Entra users only
Read operations on all resource types
Read access to billing data only
Read and write on one resource type
When does a role definition give someone access?
When the principal signs in for the first time
When a resource lock is removed
Only after it is attached through a role assignment
As soon as it is created in the tenant

5. What is a role assignment in Azure RBAC?

A role assignment is the object that actually grants access. It attaches one role definition to one security principal at one scope. Optionally it carries a description and a condition (ABAC) that narrows when the role applies.

Each assignment is stored as a resource of type Microsoft.Authorization/roleAssignments, and its name is a GUID. You need the Microsoft.Authorization/roleAssignments/write permission at that scope to create one, which Owner, User Access Administrator, and Role Based Access Control Administrator have.

Assignments are additive. If a user has Reader on a subscription and Contributor on one resource group, they are effectively a Contributor inside that group and a Reader everywhere else in the subscription.

Take quiz
Which permission is required to create a role assignment?
Microsoft.Compute/virtualMachines/write
Microsoft.Authorization/locks/read
Microsoft.Resources/subscriptions/read
Microsoft.Authorization/roleAssignments/write
A user has Reader on a subscription and Contributor on one resource group. What can they do in that resource group?
Everything Contributor allows, because permissions are combined
Only create resources, not delete them
Only read, because Reader is the broader scope
Nothing, because the two roles conflict

6. What are the scope levels in Azure RBAC?

Azure RBAC has four scope levels, arranged in a hierarchy. You can assign a role at any of them:

flowchart TD
  A["Tenant Root Management Group"] --> B["Management group"]
  B --> C[Subscription]
  C --> D["Resource group"]
  D --> E[Resource]
  • Management group - groups subscriptions so one assignment covers many of them.
  • Subscription - a billing and isolation boundary.
  • Resource group - a lifecycle container for related resources.
  • Resource - a single VM, storage account, key vault, and so on.

A scope is written as an ID path, for example /subscriptions/<id>/resourceGroups/rg-app. The narrower the scope, the smaller the blast radius.

Take quiz
Which of these is NOT a standard Azure RBAC scope level?
Resource group
Management group
Microsoft Entra administrative unit
Individual resource
What does the scope string /subscriptions/<id>/resourceGroups/rg-app identify?
A single resource group inside a subscription
A whole management group
The tenant root
A single virtual machine

7. What is role assignment inheritance in Azure RBAC?

Role assignments are inherited downward. A role assigned at a parent scope applies automatically to every child scope below it. Contributor on a subscription means Contributor on every resource group and resource inside that subscription, including ones created later.

Inheritance only flows down. A role on a single resource never leaks up to its resource group.

You cannot remove an inherited assignment at the child level, and there is no way to carve out an exception from a parent assignment. If a team should only reach some resource groups, assign the role on those groups instead of at the subscription.

In the portal, the Role assignments tab shows an inherited entry with a Scope column pointing at the parent, so you can tell where it came from.

Take quiz
A user has Reader on a subscription. Which scope inherits that access?
Only the subscription object itself
All resource groups and resources inside the subscription
The parent management group
Only resource groups created before the assignment
How do you stop a team from inheriting a role on one resource group?
Delete the inherited assignment from the child resource group
Lock the resource group with a ReadOnly lock
Assign the role at narrower scopes instead of the parent scope
Add the resource group to a NotScopes list

8. What are the four fundamental built-in Azure roles?

Almost every Azure role traces back to four fundamentals. Three are general-purpose and one is about access management.

Role Resource management Can assign roles?
Owner Full access to all resources Yes
Contributor Create and manage all resources No
Reader View resources only No
User Access Administrator None, only access management Yes

Beyond these, Azure offers many job-function roles (for example Virtual Machine Contributor or Storage Blob Data Reader) that grant access to one service only. Prefer those over the fundamentals whenever one fits.

Take quiz
Which fundamental role can manage resources but cannot grant access to others?
User Access Administrator
Contributor
Role Based Access Control Administrator
Owner
Which fundamental role manages access but cannot create or modify resources?
User Access Administrator
Reader
Contributor
Owner

9. What is the difference between Owner and Contributor roles?

Both can create, update, and delete any resource. The difference is access management: Owner can grant and remove access, Contributor cannot.

Contributor has Actions: *, but its NotActions remove Microsoft.Authorization/*/Write, Microsoft.Authorization/*/Delete, and the elevate-access action. That blocks role assignments, role definition changes, and locks.

Capability Owner Contributor
Create and manage resources Yes Yes
Assign roles to others Yes No
Create or delete custom roles Yes No
Manage resource locks Yes No

Giving app teams Contributor on their own resource group is the usual pattern. Reserve Owner for a very small number of people, ideally through just-in-time activation.

Take quiz
Which action is blocked for Contributor but allowed for Owner?
Deleting a storage account
Reading resource properties
Creating a role assignment
Creating a virtual machine
Why can Contributor not assign roles even though its Actions is * ?
Contributor is only valid at resource scope
Role assignments are only possible through the CLI
NotActions subtracts the Microsoft.Authorization write and delete operations
Assigning roles requires a separate Azure Policy

10. What is the User Access Administrator role?

User Access Administrator lets a principal manage access to Azure resources, and nothing else. It grants Microsoft.Authorization/* so the holder can create and delete role assignments at the scope, but it does not allow creating or changing resources like VMs or databases.

It is useful for access-governance teams or delegated onboarding processes that must grant access without touching workloads.

The role is powerful despite its narrow purpose. A holder can assign themselves Owner, so treat it like Owner and keep it time-bound with Privileged Identity Management. When you only need to delegate specific role assignments, the Role Based Access Control Administrator role with conditions is a safer choice.

Take quiz
What is the main risk of the User Access Administrator role?
The holder can grant themselves Owner at that scope
It disables Azure Policy
It lets the holder delete the Microsoft Entra tenant
It exposes storage account keys
Which task can a User Access Administrator perform without any other role?
Deploy a Bicep template with new resources
Read blob contents
Resize a virtual machine
Assign a role to a group on a resource group

11. What is the difference between Azure RBAC and Microsoft Entra roles?

Azure RBAC governs Azure resources. Microsoft Entra roles govern the directory itself: users, groups, applications, and tenant settings. The two systems are separate, and a role in one does not give access in the other.

Aspect Azure RBAC Microsoft Entra roles
Controls VMs, storage, networks, databases Users, groups, app registrations, tenant settings
Scope Management group, subscription, resource group, resource Tenant, administrative unit, or single object
Examples Owner, Contributor, Reader Global Administrator, User Administrator
Managed in Access control (IAM) blade Microsoft Entra admin center, Roles and administrators

The one bridge is elevate access: a Global Administrator can temporarily grant themselves User Access Administrator over all Azure subscriptions in the tenant.

Take quiz
Does the Global Administrator role automatically give access to Azure subscription resources?
No, only after elevating access or receiving an Azure role
Yes, but only for read operations
Yes, but only for resource groups
Yes, it implies Owner on every subscription
Which role would you assign to let someone reset user passwords in Microsoft Entra ID?
Virtual Machine Contributor
Contributor at subscription scope
A Microsoft Entra role such as Password Administrator
Reader at management group scope

12. What are Actions and NotActions in a role definition?

Actions lists the management operations a role allows, written as {Provider}/{resourceType}/{action}, with wildcards permitted. NotActions removes specific operations from that allowed set.

For example, Microsoft.Compute/virtualMachines/* allows every VM operation, while Microsoft.Compute/virtualMachines/delete in NotActions carves out deletion.

NotActions is not a deny. It only subtracts from the same role's list. If the user holds another role, at this scope or inherited, that allows the operation, they can still perform it. For a true block, you need a deny assignment.

"actions": [ "Microsoft.Compute/virtualMachines/*" ],
"notActions": [ "Microsoft.Compute/virtualMachines/delete" ]

Take quiz
A role lists an operation in NotActions, but the user holds a second role that allows it. What happens?
The operation is blocked, because NotActions always wins
Only the older role assignment is used
Azure reports a role conflict error
The operation is allowed, because NotActions is not an explicit deny
Which part of a role definition lists management-plane operations that are allowed?
DataActions
AssignableScopes
Description
Actions

13. What are DataActions and NotDataActions?

DataActions list operations on the data inside a resource, such as reading a blob, getting a secret, or sending a Service Bus message. NotDataActions subtract from that list the same way NotActions does for management operations.

A data action looks like Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. This is what separates Storage Blob Data Reader from the plain Reader role, which cannot read blob contents.

Wildcards in Actions do not include data actions. Owner has Actions: *, yet that does not by itself grant blob or secret access over Microsoft Entra authentication. Data permissions must be granted explicitly through a role carrying DataActions.

Take quiz
Which permission section would allow reading blob contents?
Actions with */read
DataActions
AssignableScopes
NotActions
Does Actions: * in Owner grant data-plane operations such as reading blobs?
No, data actions must be granted through DataActions
Yes, the wildcard covers every operation
Only when a resource lock is present
Yes, but only on storage accounts

14. What is the purpose of AssignableScopes?

AssignableScopes defines where a role can be assigned. A role can only be used at the scopes listed there, or below them.

Built-in roles are assignable at root (/), so they work everywhere. For custom roles, you list management groups, subscriptions, or resource groups, for example /subscriptions/<id>. Listing several subscriptions shares one custom role across them, as long as they trust the same Microsoft Entra tenant.

Two practical rules: you need Microsoft.Authorization/roleDefinitions/write on every assignable scope to create the role, and a custom role that contains DataActions cannot be assignable at management group scope.

Take quiz
What does AssignableScopes control?
The scopes at which the role can be assigned
Which users are allowed to sign in
Which resource providers the role covers
How long a role assignment stays active
How do you share a custom role between two subscriptions in the same tenant?
Assign it as a Microsoft Entra role
Export it as a deny assignment
Create the role twice with the same name
List both subscriptions in AssignableScopes

15. What is the principle of least privilege in Azure RBAC?

Least privilege means giving a principal only the access needed for the task, at the narrowest scope, for the shortest time. In Azure RBAC that comes down to three choices: the role, the scope, and the duration.

  1. Role - choose a job-function role (Virtual Machine Contributor) over a fundamental one (Contributor), and Contributor over Owner.
  2. Scope - assign on the resource group or resource that the work touches, not on the subscription.
  3. Duration - use Privileged Identity Management so elevated roles are eligible and expire after hours, not permanent.

A quick test: if a person with Contributor at subscription level only ever manages one app, you can move the assignment to that app's resource group with no loss of function and much less exposure.

Take quiz
A developer only deploys to one app's resource group. What is the least-privilege assignment?
Contributor on the tenant root management group
Owner on the subscription
Contributor on that resource group
User Access Administrator on the subscription
Which feature makes elevated Azure roles expire automatically?
Tag inheritance
Azure Policy audit effect
Resource locks
Privileged Identity Management time-bound assignments

16. How do you assign an Azure role in the Azure portal?

You need a role with Microsoft.Authorization/roleAssignments/write at the target scope, such as Owner or User Access Administrator. Then:

  1. Open the resource, resource group, subscription, or management group and select Access control (IAM).
  2. Choose Add and then Add role assignment.
  3. On the Role tab, pick a job-function role or a privileged administrator role.
  4. On the Members tab, select the user, group, service principal, or managed identity.
  5. Optionally add a condition if the role supports it.
  6. Select Review + assign to save.

The Check access tab on the same blade lets you confirm afterwards what a specific principal can do at that scope.

Take quiz
Which portal blade is used to add a role assignment?
Policy assignments
Deployments
Diagnostic settings
Access control (IAM)
Which IAM tab lets you verify the effective access of a given user?
Check access
Activity log alerts
Classic administrators
Deny assignments only

17. How do you assign an Azure role using Azure CLI?

Use az role assignment create with the principal, the role name or ID, and the scope.

az role assignment create \
  --assignee-object-id <object-id> \
  --assignee-principal-type Group \
  --role "Reader" \
  --scope /subscriptions/<sub-id>/resourceGroups/rg-app

Passing --assignee-object-id together with --assignee-principal-type (User, Group, or ServicePrincipal) skips a Microsoft Graph lookup. That makes scripts faster and avoids PrincipalNotFound errors right after a new identity is created.

If you omit --scope, the CLI uses the current subscription. Check with az account show before running it so you do not assign at the wrong level.

Take quiz
Why pass --assignee-principal-type with an object ID?
It avoids a Graph lookup and replication-delay errors for new identities
It makes the assignment permanent
It allows assigning across tenants
It switches the role to a deny assignment
What scope does az role assignment create use when --scope is omitted?
The tenant root management group
The current subscription
The resource that was created most recently
The last resource group used

18. How do you list role assignments using Azure CLI or PowerShell?

Both tools can filter by principal, scope, or role. The CLI command is az role assignment list; PowerShell uses Get-AzRoleAssignment.

# Azure CLI
az role assignment list --assignee user@contoso.com --all --output table
az role assignment list --resource-group rg-app --include-inherited -o table
az role assignment list --scope /subscriptions/<sub-id> --role Owner -o table

# Azure PowerShell
Get-AzRoleAssignment -SignInName user@contoso.com
Get-AzRoleAssignment -ResourceGroupName rg-app

By default the CLI only shows assignments at the current scope. Add --all to include the whole subscription, --include-inherited to see assignments from parent scopes, and --include-groups to also show roles the user receives through group membership.

Take quiz
Which CLI flag shows role assignments coming from parent scopes?
--include-inherited
--expand-parents
--all-tenants
--show-deny
Which flag adds roles a user receives through group membership?
--include-nested-users
--with-pim
--include-groups
--resolve-members

19. How do you remove a role assignment in Azure?

Delete the assignment at the same scope where it was created. You need Microsoft.Authorization/roleAssignments/delete there, which Owner and User Access Administrator have.

az role assignment delete \
  --assignee <object-id-or-upn> \
  --role "Reader" \
  --scope /subscriptions/<sub-id>/resourceGroups/rg-app

# PowerShell
Remove-AzRoleAssignment -ObjectId <object-id> -RoleDefinitionName "Reader" -Scope "/subscriptions/<sub-id>/resourceGroups/rg-app"

Two things to remember. Removing an assignment at a parent scope removes the inherited access from every child, and removing at a child scope will not touch an assignment inherited from above. The change can also take several minutes to be effective everywhere.

Take quiz
A user's Reader role is inherited from the subscription. Deleting an assignment on a resource group does what?
Converts it into a deny assignment
Moves it to the resource group scope
Nothing to the inherited role, which stays at the subscription
Removes the inherited role from the whole subscription
Which permission is needed to delete a role assignment?
Microsoft.Authorization/locks/read
Microsoft.Authorization/roleAssignments/delete
Microsoft.Authorization/policyAssignments/delete
Microsoft.Resources/subscriptions/delete

20. What is a custom role in Azure RBAC?

A custom role is a role definition you write yourself when no built-in role matches the permissions you need. It has the same structure as a built-in one: Actions, NotActions, DataActions, NotDataActions, and AssignableScopes.

Typical reasons are least privilege (a role that can start and stop VMs but not delete them) or a job function Microsoft does not ship. Each tenant can hold up to 5,000 custom roles, and a custom role can be shared across subscriptions in the same tenant.

You can create one in the Azure portal, Azure CLI, PowerShell, or the REST API. Creating it needs Microsoft.Authorization/roleDefinitions/write on every assignable scope, which Owner and User Access Administrator have.

Take quiz
What is the maximum number of custom roles per tenant?
50,000
50
5,000
500
When is a custom role the right choice?
When no built-in role grants exactly the permissions needed
Whenever the scope is a resource group
Whenever you want a role to be a deny rule
Whenever you need to assign to a Microsoft Entra directory object

21. How do you create a custom role using Azure CLI?

Write the role as JSON, then pass it to az role definition create. This example lets operators start, restart, and deallocate VMs, but not delete them.

{
  "Name": "VM Operator",
  "IsCustom": true,
  "Description": "Start, restart and deallocate VMs. Read-only otherwise.",
  "Actions": [
    "Microsoft.Compute/virtualMachines/read",
    "Microsoft.Compute/virtualMachines/start/action",
    "Microsoft.Compute/virtualMachines/restart/action",
    "Microsoft.Compute/virtualMachines/deallocate/action",
    "Microsoft.Resources/subscriptions/resourceGroups/read"
  ],
  "NotActions": [],
  "AssignableScopes": [ "/subscriptions/00000000-0000-0000-0000-000000000000" ]
}

az role definition create --role-definition ./vm-operator.json
az role definition update --role-definition ./vm-operator.json

Find the exact action strings with az provider operation show --namespace Microsoft.Compute. To delete a custom role, first remove all of its role assignments.

Take quiz
Which command updates an existing custom role from a JSON file?
az role assignment update
az role definition replace
az role definition update
az policy definition update
What must you do before deleting a custom role?
Rename it with a Deleted prefix
Remove every role assignment that uses it
Move it to the tenant root scope
Disable the Microsoft.Compute provider

22. Which built-in roles are used to manage virtual machines?

Managing a VM and signing in to it are separate permissions, so Azure offers distinct roles.

Role What it grants
Virtual Machine Contributor Create and manage VMs, including disks and extensions. No access to the virtual network or storage account the VM uses, and no login to the VM.
Virtual Machine Administrator Login View VMs in the portal and sign in with administrator rights (Microsoft Entra login).
Virtual Machine User Login View VMs in the portal and sign in as a regular user.
Reader View VM properties only.

The two login roles only work when the VM has the Microsoft Entra login extension enabled. A common pairing is Virtual Machine Contributor for the platform team and Virtual Machine User Login for developers.

Take quiz
Which role lets a user sign in to a VM with administrator rights using Microsoft Entra ID?
Virtual Machine Administrator Login
Network Contributor
Virtual Machine Contributor
Reader
Does Virtual Machine Contributor include permission to sign in to the VM operating system?
Yes, always as administrator
Yes, but only as a standard user
No, login requires a separate login role
Only when the VM is deallocated

23. What is the Storage Blob Data Contributor role?

Storage Blob Data Contributor is a built-in role that grants read, write, and delete access to blob containers and blobs through Microsoft Entra authentication. It is a data-plane role, so it uses DataActions rather than Actions.

It does not let the holder manage the storage account itself. Changing replication or firewall settings needs a management role such as Storage Account Contributor. The matching read-only role is Storage Blob Data Reader.

Being Owner of a subscription does not give blob access over Entra ID. The data role must be assigned, ideally on the specific storage account or container. With the CLI, add --auth-mode login so the command uses your Entra identity.

az storage blob list --account-name stappdata --container-name logs --auth-mode login

Take quiz
Which operation does Storage Blob Data Contributor allow?
Changing the storage account replication type
Editing the storage firewall rules
Deleting blobs in a container
Creating a new storage account
Which CLI option makes a blob command use your Microsoft Entra identity?
--public-access on
--sas-token inherit
--auth-mode login
--auth-mode key

24. How do resource locks interact with Azure RBAC roles?

Locks and RBAC are independent controls, and a lock wins. A CanNotDelete lock blocks deletion and a ReadOnly lock blocks modification, even for an Owner.

A user needs a role with Microsoft.Authorization/locks/* to create or remove a lock. Only Owner and User Access Administrator include it. Contributor does not, so a Contributor cannot remove a lock placed by someone else.

Locks apply to management operations only. A ReadOnly lock on a storage account does not stop data reads, but it does block listKeys because that is a POST action, which can surprise teams.

When a deployment fails with ScopeLocked, the roles are fine. Check for a lock at the resource, its resource group, or the subscription.

Take quiz
An Owner tries to delete a resource with a CanNotDelete lock. What happens?
The role is automatically downgraded to Reader
The delete succeeds because Owner overrides locks
The delete succeeds but is logged
The delete fails until the lock is removed
Which fundamental role can NOT create or remove locks?
Owner
Contributor
Both Owner and User Access Administrator
User Access Administrator

25. What is the difference between control plane and data plane access?

The control plane manages the resource itself, through Azure Resource Manager. The data plane works with what the resource holds, through the service's own endpoint. Azure RBAC secures both, but with different permission fields.

Aspect Control plane Data plane
Endpoint management.azure.com Service endpoint, e.g. blob.core.windows.net, vault.azure.net
Typical task Create a storage account, change a firewall Read a blob, get a secret
Role field Actions / NotActions DataActions / NotDataActions
Example role Storage Account Contributor Storage Blob Data Reader

Owner and Contributor have full control-plane rights but no data-plane rights on services that support Entra data roles. Many incidents come from forgetting one side: the pipeline can create the storage account yet fails to upload to it.

Take quiz
Which role field covers reading a blob's content?
AssignableScopes
Actions
DataActions
NotActions
Which endpoint does control plane traffic go through?
login.microsoftonline.com
graph.microsoft.com
The service's own endpoint, such as blob.core.windows.net
management.azure.com (Azure Resource Manager)

26. How does Azure RBAC evaluate permissions for a request?

Azure RBAC is additive. For each request it gathers every role assignment that applies to the caller at the target scope and above, merges their allowed operations, and checks whether the requested operation is in the result. If it is, access is granted. If not, it is denied by default.

flowchart TD
  A["Request arrives"] --> B{Deny assignment matches?}
  B -- Yes --> X["Access denied"]
  B -- No --> C["Collect role assignments at scope and parents"]
  C --> D{Any role allows the action?}
  D -- No --> X
  D -- Yes --> E{Assignment condition true?}
  E -- No --> X
  E -- Yes --> F["Access allowed"]

There is no priority between roles, so a more restrictive role cannot cancel a broader one. The only explicit blocker is a deny assignment, which is checked first. Locks and Azure Policy are evaluated separately from RBAC.

Take quiz
If no role assignment allows the requested action, what is the outcome?
The request is queued for approval
The request is denied by default
Azure applies the Reader role automatically
The request is allowed with a warning
What takes precedence over role assignments during evaluation?
The most recently created role assignment
The role with the longest name
A tag on the resource
A matching deny assignment

27. What are deny assignments in Azure RBAC?

A deny assignment blocks specific actions for specific principals at a scope, even if a role assignment would allow them. It is the only real deny mechanism in Azure RBAC, and it is evaluated before role assignments.

Users cannot create deny assignments directly. Azure creates them on your behalf for features such as managed applications and deployment stacks (deny settings), to protect managed resources from accidental edits.

A deny assignment has Actions, NotActions, DataActions, NotDataActions, a list of Principals, ExcludePrincipals, and a DoNotApplyToChildScopes flag. You can see them on the IAM blade under the Deny assignments tab, or with Get-AzDenyAssignment in PowerShell.

If a request is rejected even though the role looks correct, check whether a deny assignment from a managed application is in the way.

Take quiz
Who typically creates a deny assignment?
The role definition itself
Any user with Contributor
A Microsoft Entra Global Administrator through the portal
Azure features such as managed applications and deployment stacks
A user is an Owner but a deny assignment covers an action. What happens?
The action is allowed because Owner has priority
The action is denied
The action is allowed after a retry
Only the portal is blocked, not the CLI

28. What is the difference between Azure RBAC and Azure Policy?

Azure RBAC controls who can act. Azure Policy controls what resources are allowed to look like, no matter who acts. They complement each other.

Aspect Azure RBAC Azure Policy
Question answered Can this user perform this action? Does this resource meet our rules?
Focus Identities and permissions Resource properties and compliance
Example Contributor on rg-app Allow only West Europe, require tags
Applies to Owner? Owner has full rights Yes, a deny policy blocks even Owner
Typical result Allowed or AuthorizationFailed Compliant, non-compliant, or RequestDisallowedByPolicy

An error tells you which one stopped the request: AuthorizationFailed points to RBAC, while RequestDisallowedByPolicy points to Azure Policy.

Take quiz
A deployment fails with RequestDisallowedByPolicy. Which control blocked it?
Azure RBAC role assignment
A subscription budget
Azure Policy
A Microsoft Entra Conditional Access rule
Which statement about Owner is correct?
Owner can disable policy from any resource
A deny-effect Azure Policy can still block an Owner
Owner is exempt from every policy
Owner only needs a role in Microsoft Entra ID

29. Why should you assign roles to groups instead of users?

Assigning to a Microsoft Entra security group makes access follow membership, not individual assignments. That brings several concrete benefits:

  • Fewer assignments. One group assignment replaces dozens of user ones, which matters because a subscription is capped at 4,000 role assignments.
  • Simple joiners and leavers. Adding or removing a member changes access without touching Azure RBAC at all.
  • Easier reviews. Microsoft Entra access reviews can recertify group membership on a schedule.
  • Dynamic access. Dynamic groups can add members automatically based on attributes such as department.
  • Cleaner audit. You read a handful of group assignments instead of hundreds of user ones.

A readable naming convention such as az-rbac-<scope>-<role> keeps it obvious what each group does.

Take quiz
Why do groups help with the subscription role assignment limit?
Groups bypass inheritance
Group assignments are not counted at all
Groups raise the limit to 40,000
One group assignment can replace many individual user assignments
What changes when a new engineer is added to an RBAC group?
A deny assignment is removed
Access is granted without creating a new role assignment
A new custom role must be created
The subscription must be re-registered

30. How do managed identities use Azure RBAC?

A managed identity is a service principal that Azure creates and rotates credentials for. It has no access by default. You grant it access exactly like a user, with a role assignment, and the app then requests tokens without storing any secret.

There are two types. System-assigned identities live and die with one resource. User-assigned identities are standalone and can be attached to many resources.

az vm identity assign -g rg-app -n vm1
PID=$(az vm show -g rg-app -n vm1 --query identity.principalId -o tsv)
SA=$(az storage account show -g rg-app -n stappdata --query id -o tsv)

az role assignment create \
  --assignee-object-id $PID \
  --assignee-principal-type ServicePrincipal \
  --role "Storage Blob Data Reader" \
  --scope $SA

Always set the principal type when scripting. A freshly created identity may not have replicated yet, and without it the call can fail with PrincipalNotFound.

Take quiz
What access does a newly created managed identity have?
Owner on its own resource
Reader on its subscription
Contributor on its resource group
None until a role is assigned
What is the lifecycle of a system-assigned managed identity?
It must be deleted manually after 90 days
It is deleted together with the resource it belongs to
It lasts until the subscription is cancelled
It is shared by all VMs in the resource group

31. How do you grant a CI/CD pipeline access to Azure resources?

Give the pipeline its own service principal and assign it a narrow role at the narrowest scope it deploys to. Never reuse a human account.

The preferred authentication method is workload identity federation (OIDC), which lets GitHub Actions or Azure Pipelines exchange a short-lived token for Azure access, so no client secret is stored.

# app registration + service principal
az ad sp create-for-rbac --name sp-deploy-app \
  --role Contributor \
  --scopes /subscriptions/<sub-id>/resourceGroups/rg-app

After creating the principal, add a federated credential to the app registration for your repository or pipeline. If the pipeline also assigns roles inside its templates, it needs more than Contributor, for example Role Based Access Control Administrator limited by conditions.

Scope it to the resource group the pipeline deploys to, not the subscription.

Take quiz
What is the main advantage of workload identity federation for pipelines?
It removes the need for role assignments
It gives the pipeline Owner automatically
No long-lived client secret needs to be stored
It works only for human users
Why might Contributor not be enough for a pipeline?
Its templates create role assignments, which Contributor cannot do
Contributor cannot create resource groups
Contributor only works on Linux resources
Contributor cannot use service principals

32. How do you grant an app read access to Key Vault secrets?

Assign the Key Vault Secrets User role to the app's identity on the vault, or on one individual secret. It allows reading secret values and nothing else.

This works only when the vault uses the Azure RBAC permission model. A vault still on access policies ignores role assignments for data access.

az keyvault update --name kv-app --enable-rbac-authorization true

az role assignment create \
  --assignee-object-id <managed-identity-principal-id> \
  --assignee-principal-type ServicePrincipal \
  --role "Key Vault Secrets User" \
  --scope /subscriptions/<sub-id>/resourceGroups/rg-app/providers/Microsoft.KeyVault/vaults/kv-app

Related roles: Key Vault Secrets Officer can manage secrets, Key Vault Reader sees only metadata, and Key Vault Administrator has full data access. For one secret, extend the scope with /secrets/<name>.

Take quiz
Which role lets an app read secret values but not change them?
Key Vault Secrets User
Key Vault Contributor
Key Vault Secrets Officer
Key Vault Reader
What must be true of the vault for RBAC data roles to take effect?
It must be in the same resource group as the app
It must have purge protection disabled
It must use the Azure RBAC permission model
It must have a ReadOnly lock

33. Why is Azure RBAC preferred over Key Vault access policies?

Access policies are the older model: permissions are stored inside each vault, one policy per principal, applying to every secret, key, and certificate in it. Azure RBAC uses the same role system as the rest of Azure.

Aspect Access policies Azure RBAC
Granularity Whole vault, per object type Vault, or a single secret, key, or certificate
Managed at Each vault separately Any scope, with inheritance
PIM and conditions Not supported Supported
Who can grant access Anyone with Contributor on the vault Only holders of role-assignment permissions

The last row is the security problem. Contributor includes Microsoft.KeyVault/vaults/write, so a Contributor can add an access policy for themselves and read every secret. With RBAC, Contributor cannot grant itself data access.

Take quiz
What privilege escalation risk exists with Key Vault access policies?
Any anonymous user can read keys
Reader can delete the vault
A Contributor on the vault can add a policy granting itself secret access
Access policies bypass the firewall
Which feature is available with Azure RBAC but not with access policies?
Using certificates
Scoping a role to a single secret
Enabling soft delete
Storing secrets in Azure

34. What is the role assignment limit per subscription?

Azure supports up to 4,000 role assignments per subscription. The count includes assignments at the subscription, resource group, and resource scopes, but not those at management group scope. This limit is fixed and cannot be raised through support.

Management groups have their own cap of 500 role assignments each.

When you reach the limit, new assignments fail with RoleAssignmentLimitExceeded. This often hits subscriptions where people grant access to individual users or on many single resources. Orphaned assignments from deleted users still count, so cleaning them is the first quick win.

To count your usage, query role assignments with Azure Resource Graph or list them with az role assignment list --all and see how many rows come back.

Take quiz
Which assignments are NOT counted toward the 4,000 per-subscription limit?
Assignments at resource group scope
Assignments at management group scope
Assignments on single resources
Assignments to service principals
What error appears when the limit is reached?
ScopeLocked
RoleAssignmentExists
RequestDisallowedByPolicy
RoleAssignmentLimitExceeded

35. How long do Azure role assignment changes take to apply?

Most changes take effect within a few minutes. Microsoft documents up to 10 minutes for a new or removed assignment to propagate fully, because Azure Resource Manager caches authorization data.

Some situations take longer:

  • Cached tokens. A token already issued keeps working with the old permissions until it is refreshed. Signing out and in, or running az login again, forces a new one.
  • Managed identities. Their tokens are cached by the Azure back end, and changes can take hours, in some cases up to 24, to show up.
  • Group membership. Adding a user to a group is an Entra change, so the user may need a new token before the group's roles apply.

If a pipeline runs immediately after granting access, add a retry with a short delay instead of assuming the role is live.

Take quiz
Roughly how long can a role assignment take to propagate fully?
Up to 30 days
Under one second
Up to about 10 minutes
Exactly 24 hours always
Why might a user still see AuthorizationFailed right after being added to a group?
Their existing token has not been refreshed yet
The group must be recreated
Role assignments only work after midnight UTC
Group assignments are rejected by default

36. What happens to role assignments when a user is deleted?

The role assignments are not removed. Because they reference the object ID, they stay behind as orphans, shown as Identity not found or Unknown in the portal.

The deleted user loses access immediately, but the orphans cause two problems: they still count toward the 4,000 assignment limit, and they clutter audits. If the user is restored from Entra's soft-delete period with the same object ID, the assignments come back to life.

Recreating a user with the same name gets a new object ID and none of the old access. Find orphans in PowerShell and delete them:

Get-AzRoleAssignment |
  Where-Object { $_.ObjectType -eq "Unknown" } |
  Remove-AzRoleAssignment

Take quiz
Why do orphaned role assignments matter?
They still count toward the subscription assignment limit
They give the deleted user hidden access
They block new users from signing in
They automatically convert to deny assignments
A user is deleted and recreated with the same username. What access do they have?
Access is restored after 24 hours
None of the old access, because the object ID is different
Only Reader access
All the old access, matched by username

37. Why does role assignment creation fail with RoleAssignmentExists?

Azure allows only one assignment per unique combination of principal, role definition, and scope. If that exact trio already exists, a second create call is rejected with RoleAssignmentExists.

Common causes:

  • A script or pipeline re-runs and creates the same assignment again.
  • Someone granted the same access manually earlier.
  • An infrastructure template uses a random name for the assignment on each run, so Azure sees duplicates instead of an update.

A related error is RoleAssignmentUpdateNotPermitted. It appears when a template reuses an existing assignment name but with a different principal, role, or scope, since those properties cannot be edited.

The fix for templates is a deterministic name, such as guid(scope.id, principalId, roleDefinitionId). For scripts, check with az role assignment list first, or treat the error as success.

Take quiz
What combination must be unique for a role assignment?
Principal and resource tags
Principal, role definition, and scope
Role name and description
Subscription and tenant
Which approach prevents duplicate assignment errors in a template?
Leaving the name empty
Using the user's display name as the name
A deterministic GUID name built from scope, principal, and role
A random GUID generated on every deployment

38. How do you troubleshoot an AuthorizationFailed error?

AuthorizationFailed means Azure RBAC found no role granting the action. The error message already tells you the caller's object ID, the action, and the scope. Work through it in order:

  1. Read the message. Note the exact action (for example Microsoft.Compute/virtualMachines/write) and the scope.
  2. Confirm the identity and subscription. Run az account show to rule out the wrong tenant or subscription.
  3. List the caller's assignments at that scope including inherited ones.
  4. Check the role covers the action. Inspect its permissions for the action string.
  5. Look for blockers. Deny assignments, resource locks, and ABAC conditions can also stop it.
  6. Rule out delay. Wait up to 10 minutes and refresh the token.
az role assignment list --assignee <object-id> --scope <scope> --include-inherited --all -o table
az role definition list --name "Virtual Machine Contributor" --query "[].permissions[].actions"

Remember that a data-plane operation needs a DataActions role, so Contributor will not fix a failing blob read.

Take quiz
What does the AuthorizationFailed error message tell you?
The caller's object ID, the action, and the scope
The cost of the denied operation
Which Azure Policy was violated
Only that the password was wrong
Which step is first when you troubleshoot AuthorizationFailed?
Assign Owner at the tenant root
Delete and recreate the user
Raise the subscription limit
Read the exact action and scope from the error

39. When should you choose a custom role over a built-in role?

Prefer built-in roles by default. Microsoft maintains them, so when a service adds new operations the role is updated for you. Choose a custom role only when no built-in role fits without granting too much.

Good reasons for a custom role:

  • The closest built-in role is too broad, for example Contributor when someone only needs to restart VMs.
  • You need to combine permissions from several services into one job function.
  • You want to exclude a dangerous operation by adding it to NotActions.

The costs are real. You maintain the JSON yourself, new provider actions are not added automatically, wildcards may silently grant new rights, and the tenant cap is 5,000 custom roles. Keep a small, well-named catalog, store the definitions in source control, and review them regularly.

Take quiz
Who keeps a built-in role up to date when a service adds new operations?
The tenant Global Administrator
Microsoft
The subscription owner
Azure Policy
Which is a valid reason to build a custom role?
You need more than 4,000 assignments
You want a role that works only in Microsoft Entra ID
The closest built-in role grants far more than the job needs
You want a role that denies actions to Owner

40. How do you use Azure RBAC with management groups?

Assign a role at a management group and every subscription underneath inherits it. This is how you give a platform or security team consistent access across dozens of subscriptions with one assignment.

az role assignment create \
  --assignee-object-id <group-object-id> \
  --assignee-principal-type Group \
  --role "Reader" \
  --scope /providers/Microsoft.Management/managementGroups/mg-platform

Points to watch:

  • Role assignments at management group scope do not count toward a subscription's 4,000 limit, but each group has its own cap of 500.
  • A custom role can list a management group in AssignableScopes, but only if it contains no DataActions.
  • You need permissions on the management group itself to read or write assignments there. Subscription Owner is not enough.
  • Changes can take longer to show up than subscription-level ones.
Take quiz
What happens when a role is assigned at a management group?
Nothing, management groups cannot hold assignments
All subscriptions in that group inherit it
Only resource groups tagged for it inherit it
Only the first subscription inherits it
Which custom role cannot use a management group in AssignableScopes?
A role with a description
A role that contains only Actions
A role that contains DataActions
A role with more than one assignable scope

41. What is elevate access for Global Administrators?

Elevate access lets a Microsoft Entra Global Administrator grant themselves the User Access Administrator role at root scope (/), which covers every subscription and management group in the tenant. It is a break-glass feature for recovering from situations like an owner leaving the company or a subscription nobody can manage.

You turn it on in the Microsoft Entra admin center under Properties by switching Access management for Azure resources to Yes, or with the REST API.

az rest --method post \
  --url "/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"

Use it briefly: assign the needed roles, then remove the root-scope assignment, because it is a very broad permission. The actions are recorded in the directory and Azure logs, so review them.

Take quiz
Which Azure role does elevate access grant at root scope?
User Access Administrator
Owner
Contributor
Reader
When should the elevated access be removed?
Never, it is permanent by design
After one year automatically
Right after the needed role assignments are made
Only when the tenant is deleted

42. What is the Role Based Access Control Administrator role?

Role Based Access Control Administrator is a built-in role that can manage access to Azure resources by creating and deleting role assignments. Unlike User Access Administrator, it is designed to be constrained with conditions.

A condition can limit which roles the holder may assign, which principal types they may assign to, or both. For example, a team lead can be allowed to give developers only Reader and Virtual Machine Contributor on their subscription, but never Owner.

This solves the escalation problem of User Access Administrator, where the holder can assign any role, including Owner, to themselves. Delegation becomes safe enough to hand to application teams.

The role cannot manage access through other means, such as Azure Policy, and it does not create custom role definitions.

Take quiz
What makes this role safer to delegate than User Access Administrator?
Conditions can limit which roles and principals it may assign
It expires every 24 hours automatically
It cannot assign any roles
It works only on resources, not subscriptions
A condition on this role could restrict a team lead from assigning which role?
Every role equally
Owner
Reader
Virtual Machine Contributor

43. What are Azure role assignment conditions (ABAC)?

Attribute-based access control (ABAC) adds an extra check to a role assignment. The role still has to allow the action, and the condition must also evaluate to true, based on attributes of the resource or the request.

The classic example is storage. You can give a user Storage Blob Data Reader on a whole account but limit it to one container:

(
 (
  !(ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'})
 )
 OR
 (
  @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'project-a'
 )
)

Other attributes include blob index tags and, for role-assignment delegation, the role being assigned. Conditions only work with roles whose actions support them.

They also reduce the number of assignments. One conditional assignment replaces many container-level ones, which helps with the 4,000 limit.

Take quiz
What must be true for an assignment with a condition to grant access?
The role allows the action and the condition evaluates to true
The role must be Owner
The user must be a Global Administrator
The condition alone grants access
What is a practical benefit of ABAC on a storage account?
Encrypting blobs with customer keys
Turning off the storage firewall
Limiting a data role to one container without per-container assignments
Increasing the storage account size limit

44. How does Privileged Identity Management work with Azure RBAC?

Privileged Identity Management (PIM) makes Azure role assignments just-in-time. Instead of holding Owner all day, a user is eligible and must activate the role when needed. The activation expires automatically, usually after a few hours. PIM needs Microsoft Entra ID P2 or ID Governance licensing.

Assignment type Behavior
Eligible No access until the user activates the role, optionally with MFA, justification, a ticket number, or approval.
Active Access is available immediately, either permanently or until an end date.

To use it, you onboard the subscription or management group in PIM, then convert permanent assignments for privileged roles such as Owner, Contributor, and User Access Administrator to eligible.

Benefits: a smaller attack window, a clear activation audit trail, and less standing privilege. Eligible assignments also help with the role assignment limit because they are not counted as active assignments.

Take quiz
What must a user do to use an eligible PIM role assignment?
Activate it, possibly with MFA, justification, or approval
Nothing, it is always active
Re-register the subscription
Ask Microsoft support to enable it
What is the main security gain from PIM?
Elevated access is time-bound instead of standing
Resource locks are removed
Roles become deny assignments
Custom roles are no longer needed

45. How do you audit Azure RBAC changes?

Every role assignment and role definition change is recorded in the Azure Activity Log. The key operations are Microsoft.Authorization/roleAssignments/write, .../roleAssignments/delete, and Microsoft.Authorization/roleDefinitions/write.

The Activity Log keeps data for only 90 days, so send it to a Log Analytics workspace through diagnostic settings for long-term queries and alerts.

AzureActivity
| where OperationNameValue in~ (
    "MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE",
    "MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/DELETE")
| where ActivityStatusValue == "Success"
| project TimeGenerated, Caller, OperationNameValue, Properties
| order by TimeGenerated desc

To see the current state across subscriptions, query the authorizationresources table in Azure Resource Graph. For ongoing hygiene, add an alert on Owner assignments and schedule Microsoft Entra access reviews.

Take quiz
How long does the Azure Activity Log keep data by default?
90 days
Indefinitely
1 year
7 days
Which operation name records the creation of a role assignment?
Microsoft.Resources/deployments/read
Microsoft.Authorization/roleAssignments/write
Microsoft.Authorization/policyAssignments/read
Microsoft.Insights/diagnosticSettings/write

46. How can you optimize role assignments to avoid subscription limits?

With a hard cap of 4,000 assignments per subscription, the goal is to replace many narrow assignments with fewer broader ones without increasing real privilege. Start by finding where the assignments come from:

authorizationresources
| where type =~ "microsoft.authorization/roleassignments"
| extend principalId = tostring(properties.principalId),
         principalType = tostring(properties.principalType)
| summarize assignments = count() by principalId, principalType
| order by assignments desc

Then apply these fixes, roughly in order of effort:

  1. Delete orphans left behind by deleted identities.
  2. Swap users for groups. One group assignment replaces many user assignments.
  3. Remove duplicates where a role is already inherited from a higher scope.
  4. Combine roles. One custom role can replace several built-in assignments for the same principal.
  5. Use conditions so one assignment covers what used to be many resource-level ones.
  6. Make privileged roles eligible in PIM.
  7. Move to management group scope where it is appropriate, since those are not counted.
Take quiz
Which action reduces assignment count by replacing many user entries with one?
Creating a new subscription for each user
Assigning the role to a security group
Lowering the scope to single resources
Adding more resource locks
Which kind of assignments do NOT count toward the subscription limit?
Resource group assignments
Group assignments at subscription scope
Single-resource assignments
Management group assignments

47. How do you manage Azure RBAC as code with Bicep?

Declare each assignment as a Microsoft.Authorization/roleAssignments resource, set its scope, and give it a deterministic name using guid() so re-deployments are idempotent.

param principalId string
param storageName string

resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' existing = {
  name: storageName
}

var blobReaderRoleId = '2a2b9908-6ea1-4ae2-8e65-a410df84e7d1' // Storage Blob Data Reader

resource blobReader 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(storage.id, principalId, blobReaderRoleId)
  scope: storage
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', blobReaderRoleId)
    principalId: principalId
    principalType: 'ServicePrincipal'
  }
}

Three habits keep this reliable: always set principalType to avoid replication errors with new identities, use role definition GUIDs instead of names, and make sure the deploying identity itself has a role-assignment permission. Terraform does the same with azurerm_role_assignment.

Take quiz
Why should the assignment name be built with guid() from scope, principal, and role?
So it counts as a management group assignment
So the assignment expires automatically
So redeploying produces the same name and stays idempotent
So it works across tenants
What extra permission does the deployment identity need to create assignments?
Global Administrator in Microsoft Entra ID
Role-assignment write permission at the target scope
Reader on the tenant root
Billing Administrator

48. Explain the internal working of Azure RBAC authorization in Azure Resource Manager?

When you call a management API, Azure Resource Manager (ARM) is the front door, and it performs the authorization check before the request reaches the resource provider.

sequenceDiagram
  participant C as Client
  participant E as Microsoft Entra ID
  participant A as Azure Resource Manager
  participant R as Resource Provider
  C->>E: Sign in, request token for management.azure.com
  E-->>C: Access token (object ID, tenant, claims)
  C->>A: API call with bearer token
  A->>A: Validate token
  A->>A: Gather role assignments at scope and parents
  A->>A: Check deny assignments, then role actions and conditions
  alt allowed
    A->>R: Forward request
    R-->>C: Result
  else not allowed
    A-->>C: 403 AuthorizationFailed
  end
  1. Token. The caller gets a token for ARM. It carries the object ID and tenant.
  2. Validation. ARM checks signature, audience, and expiry.
  3. Assignment lookup. ARM finds assignments for the principal and its group memberships at the target scope and every parent scope.
  4. Evaluation. Deny assignments are checked first, then whether some role allows the action and any condition is true.
  5. Forward or reject. If allowed, the request goes to the resource provider; otherwise it returns 403.

For the data plane, the service itself, such as Storage or Key Vault, validates the token and performs the equivalent check against DataActions. Locks and Azure Policy run as separate checks.

Take quiz
Which component performs the RBAC check for a management operation?
Azure Monitor
The resource provider after executing the call
Azure Resource Manager
The client SDK
What HTTP status does a failed authorization return?
301 Moved Permanently
500 InternalServerError
403 AuthorizationFailed
204 No Content

49. Why can Contributor access still expose storage data through account keys?

Because Contributor includes Microsoft.Storage/storageAccounts/listKeys/action. Anyone who can list the account keys can authenticate with Shared Key, and that bypasses Azure RBAC data roles entirely. It gives full read, write, and delete over all data in the account.

So a Contributor with no data role can still read every blob. It is a hidden privilege escalation from the control plane to the data plane, and it makes data-plane RBAC meaningless if left open.

How to close the gap:

  1. Disable shared key authorization on the account: az storage account update -n stappdata -g rg-app --allow-shared-key-access false.
  2. Use Microsoft Entra ID with data roles such as Storage Blob Data Contributor.
  3. Avoid giving Contributor on storage accounts to people who should not see data. Use a custom role without listKeys.
  4. If keys must exist, rotate them and store them in Key Vault.

The same pattern exists with SAS tokens: anyone who holds the key can mint them.

Take quiz
Which permission lets Contributor reach blob data without a data role?
Microsoft.Storage/storageAccounts/read
Microsoft.Insights/metrics/read
Microsoft.Authorization/roleAssignments/write
listKeys on the storage account
Which setting closes this escalation path?
Enabling soft delete on blobs
Disabling shared key access on the storage account
Moving the account to another region
Adding a tag to the account

50. How do you design Azure RBAC for a multi-subscription landing zone?

Design around management groups, Entra groups, and the narrowest useful scope. Roles flow from the top of the hierarchy to workloads, and guardrails come from Azure Policy, not from trusting individuals.

Level Typical assignment Who
Tenant root / top MG Reader (security), limited Owner (break-glass only) Security and cloud-center-of-excellence groups
Platform MGs (identity, connectivity, management) Contributor or specific roles, via PIM Platform engineering groups
Landing zone MGs (corp, online) Reader for governance; policy does the rest Governance and audit groups
Application subscription or resource group Contributor, or job-function roles Application team groups

  1. Groups only. Every assignment targets a Microsoft Entra group named by scope and role.
  2. PIM for privileged roles. Owner and User Access Administrator are eligible and time-bound. Microsoft advises keeping subscription owners to a small number.
  3. Delegate safely. App leads get Role Based Access Control Administrator with conditions, not Owner.
  4. Custom roles at management group scope, control plane only, kept in source control.
  5. Policy guardrails for location, tags, and allowed SKUs, so Contributor is safe to hand out.
  6. Break-glass accounts and an elevate-access procedure for emergencies.
  7. Audit. Activity Log to Log Analytics plus periodic access reviews.
Take quiz
Which approach best limits standing privilege for Owner in a landing zone?
Make Owner eligible through PIM with time-bound activation
Give Owner to every application team permanently
Assign Owner to individual users at the tenant root
Remove all resource locks
How should an application team lead be allowed to onboard developers safely?
Role Based Access Control Administrator with conditions on assignable roles
Global Administrator in Microsoft Entra ID
User Access Administrator with no limits
Owner on the tenant root management group
«
»

Comments & Discussions