Lesson 03 — Role-Based Access Control (RBAC)
Why RBAC is the Cornerstone of Azure Security
Azure RBAC is the mechanism that answers: "Can this identity perform this action at this scope?" Every API call to Azure Resource Manager (ARM) is evaluated against RBAC before the operation is executed. Every mistake in RBAC — a role assigned at too broad a scope, a permanent privileged assignment instead of a just-in-time one, a misconfigured custom role — creates real security risk that compounds over time as an environment grows.
In the AZ-104 exam, RBAC questions are among the most common and the most nuanced. The exam tests not just what roles exist, but the precise mechanics of how permissions are evaluated: inheritance, additive accumulation, NotActions semantics, and the interaction between RBAC and Azure Policy.
The Four Components of a Role Assignment
Every Azure RBAC role assignment is the combination of exactly four things:
Who can create role assignments?
Only two built-in roles can create role assignments:
- Owner — full resource access plus the ability to manage access
- User Access Administrator — can manage access only, with no resource permissions of their own
Role Definitions: Structure and Semantics
A role definition is a JSON document containing five top-level fields. You must understand each — they appear in exam questions and in production custom role authoring.
{
"Name": "Custom VM Operator",
"Description": "Start, stop, and restart VMs. Cannot create or delete.",
"Actions": [
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/deallocate/action",
"Microsoft.Compute/virtualMachines/restart/action",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Resources/subscriptions/resourceGroups/read"
],
"NotActions": [],
"DataActions": [],
"NotDataActions": [],
"AssignableScopes": [
"/subscriptions/a1b2c3d4-1234-5678-abcd-ef1234567890"
]
}
Actions vs. DataActions — the most important distinction
| Field | What it controls | Evaluated by | Examples |
|---|---|---|---|
| Actions | Azure Resource Manager (ARM) management plane operations — creating, deleting, and configuring resources | ARM / RBAC engine | Microsoft.Storage/storageAccounts/writeMicrosoft.KeyVault/vaults/deploy/action |
| DataActions | Data plane operations — reading/writing data within a resource (blob data, Key Vault secret values, queue messages) | The individual service's data plane, delegated from RBAC | Microsoft.Storage/storageAccounts/blobServices/containers/blobs/readMicrosoft.KeyVault/vaults/secrets/getSecret/action |
| NotActions | Subtracted from a wildcard * in Actions — does NOT mean deny |
ARM / RBAC engine | Microsoft.Authorization/*/Delete |
| NotDataActions | Subtracted from a wildcard in DataActions — same semantics as NotActions but for data plane | Service data plane | Microsoft.Storage/storageAccounts/blobServices/containers/blobs/delete |
NotActions: ["Microsoft.Authorization/*/Delete"] does not prevent a user from deleting role assignments. It only means "exclude this from the wildcard in my Actions list." If a second role assignment grants Microsoft.Authorization/*/Delete explicitly, the user can perform that action. The only way to prevent an action unconditionally is a Deny assignment — which you cannot create directly via RBAC (see the Deny Assignments section below).
Actions: ["*"] which includes all management plane operations on Key Vault and Storage. But Contributor has no DataActions — meaning a Contributor can create a Key Vault but cannot read the secrets inside it. To read secrets, you need Key Vault Secrets User (a data plane role). This separation of management plane and data plane is critical for zero-trust architecture.
Built-In Roles to Memorise
There are over 100 built-in roles in Azure. The exam tests a specific subset. Memorise these precisely.
General-purpose roles
| Role | What it can do | What it cannot do |
|---|---|---|
| Owner | Full access to all resources and can manage access (create role assignments) | Cannot override Azure Policy Deny assignments |
| Contributor | Full access to create, update, delete all resources | Cannot manage access (no role assignment creation). Cannot grant access to others. |
| Reader | View all resources | Cannot make any changes, cannot read secrets/data plane |
| User Access Administrator | Manage user access (create role assignments) at the assigned scope | Cannot manage resources themselves — no compute, network, or storage actions |
Service-specific roles (exam-relevant)
| Role | Purpose |
|---|---|
| Storage Blob Data Contributor | Read, write, delete blob data (DataActions). Does not grant management plane access to storage accounts. |
| Storage Blob Data Reader | Read blob data only. Common for application identities needing read-only storage access. |
| Key Vault Secrets Officer | Manage secrets in Key Vault (create, update, delete, list). Also a DataActions role. |
| Key Vault Secrets User | Read (get) secret values only. Minimum required role for applications reading secrets. |
| Network Contributor | Manage virtual networks, NSGs, load balancers, route tables. Cannot manage VMs or subscriptions. |
| Virtual Machine Contributor | Create and manage VMs. Does not include access to VNets, Storage, or Key Vaults — those require separate assignments. |
| Monitoring Contributor | Read monitoring data and edit monitoring settings. Required for policy remediation tasks that deploy diagnostic settings. |
Custom Role Definitions
When no built-in role matches your least-privilege requirement precisely, you create a custom role. Custom roles are defined at the tenant level but are scoped to specific subscriptions or management groups via AssignableScopes.
Key facts about custom roles
- Maximum of 5,000 custom role definitions per tenant (a hard limit).
- Custom roles are stored in the tenant but can only be assigned within the scopes listed in
AssignableScopes. - You can update a custom role definition at any time — existing assignments automatically reflect the updated permissions.
- Custom roles can be created via the portal, Azure CLI, PowerShell, ARM/Bicep templates, or Terraform.
AssignableScopes — a common exam source of confusion
AssignableScopes defines where the role can be assigned, not where it applies. Setting AssignableScopes to /subscriptions/sub-A means an administrator in sub-B cannot assign this role in their subscription — even though the role definition technically lives in the shared tenant. This is a tenant-level definition with a subscription-level assignment restriction.
"AssignableScopes": [
"/subscriptions/a1b2c3d4-1234-5678-abcd-ef1234567890",
"/subscriptions/b2c3d4e5-2345-6789-bcde-fg2345678901"
]
# Or scoped to the entire tenant (management group root):
"AssignableScopes": [
"/providers/Microsoft.Management/managementGroups/tenant-root-group"
]
az role definition list --name "Contributor" --output json to export the definition. This ensures you don't accidentally miss a required action that the built-in role includes through a wildcard.
Privileged Identity Management (PIM)
Privileged Identity Management is the Entra ID P2 feature that converts permanent ("standing") privileged access into time-bounded, auditable, just-in-time access. It is not optional in any enterprise environment — it is the control that makes privileged access manageable at scale without accepting permanent standing risk.
Active vs. Eligible assignments
| Assignment Type | What it means | When to use |
|---|---|---|
| Active assignment | The principal has the role right now, continuously, without any activation step | Break-glass accounts, automation service accounts, read-only monitoring roles. Never for Owner, Contributor, or any privileged role. |
| Eligible assignment | The principal has the ability to activate the role, but it is not active until they request activation through PIM | All privileged roles in production. Engineers activate when they need to perform privileged work, with a business justification, and the activation expires. |
PIM activation workflow
Deny Assignments
A deny assignment blocks a security principal from performing specific actions, even if a role assignment would otherwise allow those actions. Deny takes absolute precedence over allow.
How deny assignments are created
You cannot create deny assignments directly via the Azure RBAC interface. They are created by specific Azure mechanisms:
- Azure Blueprints (now deprecated — being replaced by Deployment Stacks) — could lock down resources deployed by the blueprint
- Managed Applications — the managed resource group managed by a publisher has deny assignments to prevent the consumer from modifying the managed resources
- Azure Deployment Stacks — the modern replacement for Blueprints; deny assignments protect stack-managed resources from out-of-band changes
Classic Administrator Roles (Deprecated — Know for the Exam)
Azure has a legacy model from the pre-RBAC era with three classic administrator roles. These have been fully deprecated and removed from new subscriptions, but the exam may still reference them. Know what they were:
| Classic Role | What it was equivalent to | Status |
|---|---|---|
| Account Administrator | Billing owner of the subscription (the person who signed up) | Deprecated; replaced by billing roles in MCA/EA |
| Service Administrator | Equivalent to Owner at subscription scope | Deprecated; replaced by RBAC Owner |
| Co-Administrator | Equivalent to Owner at subscription scope (up to 200 per subscription) | Deprecated; replaced by RBAC Owner assignments |
RBAC Best Practices for Enterprise Environments
- Assign roles to groups, not individual users. When a user leaves and is disabled, their individual role assignments linger until cleaned up. Group-based assignments are removed automatically when the user is removed from the group.
- Use PIM for all privileged roles. Any role that can create, modify, or delete resources or manage access should be Eligible in PIM, not Active.
- Apply least privilege — start with Reader, escalate with justification. The default access posture for any new team member should be Reader at the subscription scope. Escalation to Contributor or above requires documented justification.
- Never use Owner at subscription scope for day-to-day operations. Owner at subscription scope is appropriate only for break-glass accounts (held in PIM as Eligible) and automation that specifically requires access management.
- Conduct regular access reviews. Entra ID P2 provides Access Reviews. Schedule quarterly reviews for privileged role holders. Remove access that hasn't been used in 90+ days (detectable via Entra sign-in and audit logs).
- Prefer resource-group-scoped assignments over subscription-scoped. Narrower scope = smaller blast radius. Assign roles at the most specific scope that satisfies the requirement.
Hands-On: Inspect and Author RBAC in the Portal
- Check your effective access: Open any subscription or resource group → Access control (IAM) → View my access. This shows all role assignments that apply to you at this scope — including inherited assignments from parent scopes. Note the "Inherited from" column.
-
Inspect a built-in role definition: In Access control (IAM) → Roles, find Contributor and click the three-dot menu → View. Examine the JSON definition. Note
Actions: ["*"], theNotActionslist (which includesMicrosoft.Authorization/*/WriteandMicrosoft.Authorization/*/Delete— this is why Contributor cannot manage access), and the emptyDataActions. -
Create a custom role via JSON: In Access control (IAM) → Add → Add custom role. Start from scratch. Name it
VM-StartStop-Operator. On the JSON tab, paste a definition that includes onlyMicrosoft.Compute/virtualMachines/start/action,Microsoft.Compute/virtualMachines/deallocate/action,Microsoft.Compute/virtualMachines/restart/action, andMicrosoft.Compute/virtualMachines/read. Set AssignableScopes to your subscription. Review and create. - Verify scope inheritance: Assign the Reader role to any user at the subscription scope. Then navigate to any resource group inside that subscription → Access control (IAM) → Role assignments. You will see the Reader assignment appear here, labelled as "Inherited" — this demonstrates the scope inheritance model.
Check Your Understanding
Click any option to see immediate feedback. These questions reflect real exam reasoning and production decision-making.
1. A user has the Contributor role on a resource group. They try to assign the Reader role to a colleague on that same resource group. What happens?
Microsoft.Authorization/*/Write and Microsoft.Authorization/*/Delete in its NotActions. Role assignment creation is an authorization action — it requires Owner or User Access Administrator. This is a deliberate design: giving someone the ability to manage resources does not imply the ability to grant others access to those resources. This separation of duties is fundamental to the RBAC model.2. What is the correct distinction between Actions and DataActions in an Azure role definition?
3. A custom role has AssignableScopes set to /subscriptions/sub-A. A colleague who administers subscription sub-B (in the same tenant) wants to assign this role in sub-B. What is true?
4. Role definition X has NotActions: ["Microsoft.Authorization/*/Delete"]. Role definition Y has Actions: ["Microsoft.Authorization/*/Delete"]. A user is assigned both Role X and Role Y at the same scope. Can the user delete role assignments?
Actions: ["*"]) minus the NotActions exclusion means Role X alone does not grant delete. But Role Y explicitly grants it. Since RBAC is additive, the user has the effective permissions from both roles combined — and since Role Y explicitly includes the action, the user can delete role assignments. To actually deny an action unconditionally, you need a Deny Assignment, which cannot be created directly.5. What Entra ID license is required to use Privileged Identity Management (PIM) for Azure resource roles?
6. Your security team requires that no engineer permanently holds the Owner role on production subscriptions. What is the correct implementation?
Also read: Understand Azure role definitions and Configure PIM for Azure resources. The role definitions article covering Actions vs. DataActions is the most-tested technical distinction in this domain.
This lesson covered the mechanics of RBAC. There is significant depth to explore — ask your teacher to go deeper on any of these:
- Walk me through authoring a custom role JSON definition for a "read-only Key Vault auditor" who can list secrets but not read their values.
- How does Azure RBAC evaluation order work when a user has multiple role assignments at different scopes — what is the exact resolution algorithm?
- How do Deployment Stacks deny assignments work differently from Blueprint deny assignments, and why are Stacks the better choice?
- What happens to PIM eligible assignments when a user's Entra P2 license is removed — do they immediately lose access?