Who can delete the production database in your Azure subscription? If the honest answer is “too many people”, you need Azure RBAC. Azure role-based access control, backed by Microsoft Entra ID identities, decides exactly who can do what, where. This guide covers the model sysadmins actually use day to day, with CLI examples for assigning and auditing roles.
The Three Building Blocks of Azure RBAC – Microsoft Entra ID and Azure RBAC
Every access grant in Azure RBAC combines three elements:
- Security principal — who is asking: a user, a group, a service principal or a managed identity from Microsoft Entra ID, the identity directory for your tenant.
- Role definition — what they may do: a named set of actions such as
Microsoft.Compute/virtualMachines/start/action. - Scope — where it applies: a management group, a subscription, a resource group, or a single resource. Assignments inherit downward.
The golden rule is least privilege: grant the narrowest role at the narrowest scope that still lets someone do their job.
Built-In Roles You Will Use Every Week – Microsoft Entra ID and Azure RBAC
- Owner — full control including access management. Reserve for a tiny number of admins.
- Contributor — create and manage all resources, but cannot change who has access.
- Reader — view everything, change nothing. Perfect for auditors and juniors.
- Virtual Machine Contributor — manage VMs only, without touching their networking or storage accounts.
- Storage Blob Data Contributor — read/write blob data; note that storage data roles are separate from control-plane roles like Contributor.
- AKS Cluster Admin / User roles — govern who can pull cluster credentials.

Prerequisites
- Azure CLI signed in as a user who already holds Owner or User Access Administrator at the target scope
- The email address or object ID of the person receiving access
Step 1: Assign a Role with Azure CLI
SUBSCRIPTION_ID=$(az account show --query id --output tsv)
az role assignment create \
--assignee [email protected] \
--role "Reader" \
--scope /subscriptions/$SUBSCRIPTION_ID/resourceGroups/rg-linux-prod
That grants read-only visibility of one resource group — not the whole subscription. When you are done testing CLI basics like this, our Azure CLI essential commands guide shows how to script these operations across many groups.
Step 2: Assign Roles to Groups, Not Individuals
az ad group create --display-name "Linux Sysadmins" --mail-nickname linux-sysadmins
az ad group member add --group "Linux Sysadmins" --member-id <user-object-id>
GROUP_ID=$(az ad group show --group "Linux Sysadmins" --query id --output tsv)
az role assignment create \
--assignee-object-id $GROUP_ID \
--assignee-principal-type Group \
--role "Virtual Machine Contributor" \
--scope /subscriptions/$SUBSCRIPTION_ID/resourceGroups/rg-linux-prod
Now onboarding is one group membership change in Microsoft Entra ID, and offboarding is just as clean.
Step 3: Audit Who Has What
az role assignment list \
--scope /subscriptions/$SUBSCRIPTION_ID/resourceGroups/rg-linux-prod \
--output table
Review this output monthly. Stale Owner assignments for people who changed teams are one of the most common audit findings. Microsoft documents every built-in role and the evaluation logic in the Azure RBAC overview on Microsoft Learn.
Going Further: PIM and Conditional Access
For powerful roles, Microsoft Entra Privileged Identity Management (PIM) makes assignments eligible instead of permanent: an admin activates Owner for a few hours, with approval and MFA, and the activation is logged. Conditional Access policies add context — for example, requiring a compliant device before allowing Azure management from a new country.
Custom Roles: When the Built-Ins Do Not Fit
Sometimes no built-in role matches — the helpdesk should restart VMs but never delete them, for example. Custom roles define exactly that boundary as JSON. Create one by cloning an existing role and editing its actions:
az role definition list --name "Virtual Machine Contributor" --output json > vm-contributor.json
# edit Actions / NotActions in the file, then:
az role definition create --role-definition vm-restarter.json
A restarter role keeps actions such as Microsoft.Compute/virtualMachines/read, start/action and restart/action, while simply omitting delete — in RBAC, anything not granted is denied. Limit custom roles to cases where a built-in genuinely fails; every custom definition is one more thing to document, version and review when Microsoft ships new resource providers.
Do Not Forget the Break-Glass Accounts
Tight access control has one dangerous edge case: the day Conditional Access or a PIM misconfiguration locks out every administrator, including you. The standard defense is one or two break-glass accounts — cloud-only accounts with permanent Owner rights, excluded from Conditional Access policies, protected by a very long password plus a hardware security key, and stored in a sealed, monitored process. Microsoft Entra ID sign-in logs should alert whenever these accounts are touched. Test the break-glass login quarterly; an emergency account that nobody has verified in two years tends to have an expired phone number attached precisely when it is needed most.
Troubleshooting
- Assignment succeeds but access does not work: RBAC propagation can take a few minutes. Also check for deny assignments and confirm the user is refreshing their token (sign out and back in).
- AuthorizationFailed on role assignment: your own account lacks User Access Administrator or Owner at that scope — Contributor alone cannot grant roles.
- Data operations still denied on storage: control-plane roles do not include data-plane rights. Add a data role such as Storage Blob Data Reader explicitly.
Conclusion
Azure RBAC with Microsoft Entra ID groups gives you least-privilege access that scales with your team. Assign roles to groups at resource-group scope, audit assignments regularly, and keep Owner rare — your future incident reviews will thank you.