Manage Azure Role-Based Access Control: Built-in Roles, Scopes, Custom Roles, Deny Assignments and Troubleshooting Access
The Three Parts
A role assignment = who (security principal) + what (role definition) + where (scope).
| Part | Examples |
|---|---|
| Principal | User, group, service principal, managed identity |
| Role | Owner, Contributor, Reader, Virtual Machine Contributor |
| Scope | Management group, subscription, resource group, resource |
Important Built-in Roles
| Role | Permissions |
|---|---|
| Owner | Everything and can assign roles |
| Contributor | Create and manage resources, cannot assign roles |
| Reader | View only |
| User Access Administrator | Manage access only |
| Virtual Machine Contributor | Manage VMs but not the network or storage they use |
| Storage Blob Data Reader / Contributor | Data plane access to blobs |
| Network Contributor | Manage networks |
Control plane vs data plane Contributor can manage a storage account but does not automatically read blob data. Data roles such as Storage Blob Data Reader are needed for data.
Assign Roles
bash
az role assignment create --assignee asha@contoso.com --role "Virtual Machine Contributor" --resource-group rg-demo
az role assignment create --assignee-object-id <group-id> --assignee-principal-type Group --role Reader --scope /subscriptions/<sub-id>
az role assignment list --resource-group rg-demo --output table
az role assignment delete --assignee asha@contoso.com --role "Virtual Machine Contributor" --resource-group rg-demo
powershell
New-AzRoleAssignment -SignInName asha@contoso.com -RoleDefinitionName "Reader" -ResourceGroupName rg-demo
Get-AzRoleAssignment -ResourceGroupName rg-demo | Format-Table DisplayName, RoleDefinitionName, Scope
- Roles inherit downward: a role at subscription applies to every group and resource inside
- Roles are additive. A user gets the union of all assignments (unless a deny assignment applies)
- Assign to groups, not individuals
Custom Roles
json
{
"Name": "VM Operator",
"Description": "Can start, stop and restart VMs",
"Actions": [
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/restart/action",
"Microsoft.Compute/virtualMachines/deallocate/action"
],
"NotActions": [],
"AssignableScopes": ["/subscriptions/<sub-id>"]
}
bash
az role definition create --role-definition @vm-operator.json
az role definition list --custom-role-only true -o table
Actionsallow operations,NotActionssubtract from them,DataActionscover data plane- Create custom roles only when built-in roles are too broad or too narrow
Check and Troubleshoot Access
- Use Access control (IAM) > Check access to see effective permissions of a user
- Look at role assignments at every scope above the resource
- Check deny assignments (created by Blueprints and managed apps), Azure Policy and resource locks
- Changes can take a few minutes to apply. Sign out and in or refresh the token
Practice
- Give a user Reader on a resource group and test that they cannot create resources
- Create a custom role that can only start and stop VMs
- Use Check access to prove a user's permissions
- Explain Contributor versus Owner in one sentence
Conclusion
RBAC uses principal, role and scope with inheritance. Use groups, built-in roles first, custom roles when needed and Check access to troubleshoot.
Quick Summary: three parts; roles; assignments; custom roles; troubleshooting.

