D1 · Identity, Governance & Monitoring

RBAC and Custom Roles

Authorization design in AZ-305 revolves around the principle of least privilege: choosing the most restrictive role possible, at the smallest possible scope, assigned to groups. And when no built-in role fits, designing a custom role.

Interactive

🔑RBAC — role inheritance by scope

User John has Reader assigned on the Subscription and Contributor on RG-Frontend. Roles flow downward. Hover over each node to see the effective access.

Reader (inherits)Contributor (inherits)Assigned role
Root MGMgmt GroupSubscriptionResource GroupResource👤JohnuserIcon-general-11Root MGTenant rootIcon-general-11Contoso CorpManagement GroupIcon-general-2Prod-SubSubscription✓ Reader assignedIcon-general-7RG-FrontendResource Group✓ ContributorIcon-general-7RG-BackendInheritance onlyIcon-compute-21web-01Effective: ContributorContributor ✓

Effective access — John

Subscription

Readerassigned

RG-Frontend

Contributorassigned + inherited

RG-Backend

Readerinherited

VM web-01

Contributoreffective

Key rule

Permissions are additive. The most permissive role wins. Only a Deny Assignment breaks this rule.

⬇️ Downward inheritance

A role on the Subscription applies to every RG and resource in that Subscription. A role on an RG applies only to the resources in that RG.

➕ RBAC is additive

Multiple assignments are unioned together. Reader on Sub + Contributor on RG = effective Contributor on that RG. The most permissive role wins.

🚫 No upward inheritance

Contributor on RG-Frontend grants no access on RG-Backend or on the Subscription. Permissions only flow downward.

RBAC model: roles, scopes and assignments

An assignment = security principal (user, group, service principal, managed identity) + role definition (list of allowed actions) + scope (, subscription, RG or resource). Assignments are inherited downward and are additive.

Evaluation rules

  • • Permissions = union of ALL your assignments (there's no "most specific role wins")
  • • NotActions subtracts actions from Actions within the SAME role — it's NOT a global deny
  • • Deny assignments (created by Azure, e.g. /managed apps) DO override allows
  • • Control plane (ARM) vs data plane: DataActions control access to data (blobs, queues, secrets)

Design best practices

  • • Assign to groups, not individuals
  • • Minimum necessary scope: RG before subscription, subscription before MG
  • • Avoid broad Owner/Contributor — prefer service-specific roles
  • • Privileged access via PIM (eligible), never standing
  • • Limit: ~4000 assignments per subscription — another reason to use groups

Built-in roles you must know

RoleAllowsDoes NOT allow
OwnerEverything, including managing RBAC—
ContributorCreate/manage all resourcesAssign roles, reliably manage locks
ReaderView all resourcesAny changes; doesn't read secrets/data
User Access AdministratorManage access (assign roles)Manage resources
Role Based Access Control AdministratorAssign roles with conditions (more restricted than UAA)Manage resources
Storage Blob Data ContributorRead/write/delete blobs (data plane)Manage the storage account itself
Key Vault AdministratorFull data plane of (RBAC mode)Manage the Key Vault resource itself (control plane)
Network ContributorManage networking (VNets, NSGs...)Other resource types
Virtual Machine ContributorManage VMsAccess the VNet or log in to the VM

Classic trap

Contributor CANNOT assign roles. If a scenario asks for someone to manage resources AND grant access to others, they need Owner or Contributor + User Access Administrator (better: RBAC Administrator with conditions, less privilege).

— when and how

Create a custom role only when no built-in role satisfies least privilege. Classic example: "operators must be able to restart VMs but not create or delete them" — no built-in role gives exactly that.

Anatomy of a custom role

{
  "Name": "VM Operator",
  "Description": "Restart and view VMs",
  "Actions": [
    "Microsoft.Compute/virtualMachines/read",
    "Microsoft.Compute/virtualMachines/restart/action",
    "Microsoft.Compute/virtualMachines/start/action"
  ],
  "NotActions": [],
  "DataActions": [],
  "AssignableScopes": [
    "/providers/Microsoft.Management/
     managementGroups/production"
  ]
}

Design rules

  • • AssignableScopes defines WHERE it can be assigned — use a management group to reuse it across all child subscriptions
  • • Quick pattern: clone a built-in role and trim its actions (Actions/NotActions)
  • • The * wildcard is allowed but discouraged (breaks least privilege)
  • • Limit: 5000 custom roles per tenant
  • • Don't forget DataActions if the access is to data (blobs, secrets, messages)

roles vs Azure RBAC

Entra ID roles (directory)

  • •Govern the DIRECTORY: users, groups, apps, licenses
  • •Examples: Global Administrator, User Administrator, Application Administrator
  • •Scope: the tenant (or administrative units)
  • •Don't grant access to Azure resources by themselves

Azure RBAC (resources)

  • •Govern RESOURCES: VMs, storage, networking, databases
  • •Examples: Owner, Contributor, Reader, service-specific roles
  • •Scope: management group / subscription / RG / resource
  • •A Global Admin does NOT see Azure resources... unless they activate "elevate access" (grants User Access Administrator at root — always audit this)

Decision table

RequirementDesign
Devs manage resources in their RG but can't grant access to othersContributor on the resource group
App reads blobs without account keys + Storage Blob Data Reader (DataAction)
Operators only restart/start VMsCustom role (read + start/restart actions)
Reuse a custom role across 20 subscriptionsAssignableScopes = parent management group
Helpdesk resets user passwordsEntra ID role: Helpdesk/User Administrator (not RBAC)
Manage who has access without being able to touch resourcesUser Access Administrator (or RBAC Administrator with conditions)
Admin access only during incidentsPIM with eligible assignment
1000 users with the same accessAssign to a security group, never individually

Did you get this topic?

Test what you just learned

The operations team must be able to start, stop and restart production VMs across 15 subscriptions, without being able to create, delete or reconfigure them. You want minimal administrative effort. What do you design?

Ready to test "RBAC and Custom Roles"?

Put what you learned to the test with original AZ-305 exam questions.

Start AZ-305 mock exam

Unlimited mock exams with the Pro plan

Log in to track your progress.