Skip to content
Visual explainer 2h 30m to learn 5 steps

Grant access to a resource with Azure RBAC

Assign the least-privileged role at the right scope and explain how it differs from an Entra directory role.

By Invicly Tech, , in Microsoft Azure Cloud Engineering. About 12 minutes to read.

Topic 4 of 33

In short

Azure role-based access control (RBAC) decides who can do what to Azure resources. Every grant is a role assignment made of three parts: a security principal (who), a role definition (what actions) and a scope (where). Assignments are inherited downwards, and they are separate from Microsoft Entra directory roles, which control users, groups and tenant settings rather than resources.

Think of it like this: A role assignment is a key card: the person, the kind of doors it opens, and which floor of the building it works on.

Explained simply

Once people and apps start using Azure, you need to control who can do what. Azure does this with role-based access control, or RBAC. Instead of listing every permission for every person, you give them a role, which is a named bundle of permissions, at a particular place in your Azure hierarchy.

Every grant answers three questions. Who? That is the security principal: a user, a group, an app's identity or a managed identity. What? That is the role, such as Reader, which can look but not change. Where? That is the scope: a management group, a subscription, a resource group or one resource.

Access flows downwards. If you are a Reader on a subscription, you can read every resource group and resource inside it. So a grant high up is very wide. The safe habit is to grant at the lowest level that still lets the person do their job.

Azure roles are not the same as Microsoft Entra roles. Entra roles, such as Global Administrator or User Administrator, manage users, groups and tenant settings. Azure roles manage resources like VMs and storage. Someone can be all-powerful in one system and have no access at all in the other.

Press Play on a diagram to walk through it one step at a time.

LayersInheritance down the scopes
  1. 1
    Management group

    Reader here can read every subscription below.

  2. 2
    Subscription

    Contributor here can change every resource group.

  3. 3
    Resource group

    The usual scope for a team or an app.

  4. 4
    Resource

    Narrowest scope, for example one storage account.

CompareAzure roles versus Microsoft Entra roles
Azure RBAC roles
  • Control Azure resources
  • Owner, Contributor, Reader, data roles
  • Scoped to management group down to resource
  • Managed with az role assignment
Microsoft Entra roles
  • Control the directory and tenant
  • Global Administrator, User Administrator
  • Scoped to the tenant or an administrative unit
  • Managed in the Entra admin center or Graph
MapPicking a role for common jobs
What does the person or app need?
  • View settings and costs
    • Reader
  • Deploy and change resources
    • Contributor
    • Or a service role such as Website Contributor
  • Read or write data inside a service
    • Storage Blob Data Reader or Contributor
    • Key Vault Secrets User
  • Grant access to others
    • Role Based Access Control Administrator, with conditions
    • Owner only when truly needed
  • Manage users and groups
    • An Entra role such as User Administrator

In depth

Built-in roles you will use most

Azure has hundreds of built-in roles, but a handful cover most needs. Reader can view everything at the scope but change nothing. Contributor can create, change and delete resources but cannot grant access to others. Owner can do everything, including assigning roles. User Access Administrator and Role Based Access Control Administrator manage role assignments without managing resources; the latter can be limited with conditions so it can only hand out certain roles.

Then there are service-specific roles. Some are control plane, such as Virtual Machine Contributor, which manages VMs but not the network they connect to. Others are data plane, such as Storage Blob Data Reader or Key Vault Secrets User, which work on the data inside a resource. A good habit is to search the built-in list for the job, for example blob read, before reaching for Contributor.

  • Reader: look, no changes
  • Contributor: manage resources, no access grants
  • Owner: everything, including access grants
  • Data roles: read or write the contents, such as blobs or secrets

How Azure decides: actions, data actions and deny

A role definition lists Actions (control-plane operations such as Microsoft.Storage/storageAccounts/write) and DataActions (data operations such as reading a blob), plus NotActions and NotDataActions that subtract from those lists. NotActions is not a deny: if another role allows the same operation, it is still allowed.

When a request arrives, Azure Resource Manager collects every role assignment for the caller and the groups they belong to, at the target scope and every scope above it. If any of them allows the operation, it is allowed. The only thing that overrides an allow is a deny assignment, which Azure creates for features such as managed applications and deployment stacks; you cannot create one directly. This additive model is why removing one assignment does not always remove access: another assignment higher up may still allow it.

FlowHow a permission check is evaluated
  1. 1
    Get token

    Caller's identity and group memberships

  2. 2
    Find deny assignments

    If one matches, the request is blocked

  3. 3
    Collect role assignments

    At the target scope and every scope above

  4. 4
    Match actions

    Does any role's Actions or DataActions include the operation?

  5. 5
    Allow or 403

    Allowed if any role matches, otherwise AuthorizationFailed

Checking effective access

Two questions come up all the time: what can this person do, and who can do things here? The portal answers both under Access control (IAM) on any scope. Check access shows a principal's role assignments at that scope, including inherited ones, and Role assignments lists everyone with access there.

The CLI gives the same information in a form you can save. az role assignment list --scope with --include-inherited shows every assignment that applies at that scope. az role assignment list --assignee with --all shows where a principal has access across the subscription. Remember that group membership counts: a user with no direct assignments may still have access through a group, so check the groups too. New assignments usually apply within minutes; if a test still fails, sign out and back in to get a fresh token.

  • Portal: Access control (IAM), then Check access
  • az role assignment list --scope ID --include-inherited
  • az role assignment list --assignee ID --all
  • Look at group memberships, not only direct grants

Azure roles versus Entra roles

Microsoft Entra roles are directory roles. They control the tenant: creating users, resetting passwords, registering apps, configuring Conditional Access. They are scoped to the whole tenant or to an administrative unit. Azure roles control resources and are scoped from management groups down to single resources.

The two meet in one place. A Global Administrator can switch on Access management for Azure resources, which gives them User Access Administrator at the root scope, so they can grant themselves Azure access. This is meant for recovery, for example when nobody has Owner on a subscription, and should be switched off again after use. For day-to-day work, use Azure roles for resource work and keep Entra roles for directory work. Privileged Identity Management can make both kinds just-in-time, but it needs a Microsoft Entra ID P2 or Entra ID Governance licence.

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Name principal, role and scope~30m
  2. 2
    Follow inheritance down scopes~30m
  3. 3
    Pick a built-in role~30m
  4. 4
    Check effective access~30m
  5. 5
    Separate Azure RBAC from Entra roles~30m

Key points

  • Assign roles to groups or managed identities, not to individual users, so access follows team membership.
  • Pick the narrowest scope and the least powerful role that still does the job.
  • Permissions add up: if any assignment allows an action, it is allowed, unless a deny assignment blocks it.
  • Control-plane roles (Contributor) manage a resource; data-plane roles (Storage Blob Data Reader) read its contents.
  • Being a Global Administrator in Entra does not by itself give access to subscriptions.

Key terms

Tap a card to flip it. 0/6 known

Examples

bash
RG_ID=$(az group show --name rg-lab-api --query id -o tsv)
GROUP_ID=$(az ad group show --group "lab-readers" --query id -o tsv)

az role assignment create --assignee-object-id "$GROUP_ID" \
  --assignee-principal-type Group --role "Reader" --scope "$RG_ID"

# What can this group do, including inherited assignments?
az role assignment list --assignee "$GROUP_ID" --all --include-inherited -o table

Give a group read access to one resource group, then list its effective assignments.

Giving a support team read-only access to one app

Contoso's support team needs to see the orders app's settings and logs but must not change them. Prerequisites: Owner or Role Based Access Control Administrator on rg-orders-prod, and an Entra group called orders-support. Steps: look up the group's object ID and the resource group's ID, assign Reader on the resource group to the group, then list the assignment. Evidence: a support engineer can open the app in the portal, but Save is greyed out and a change attempt returns AuthorizationFailed. Rollback: delete the assignment.

bash
RG_ID=$(az group show -n rg-orders-prod --query id -o tsv)
GROUP_ID=$(az ad group show --group orders-support --query id -o tsv)

az role assignment create --assignee-object-id "$GROUP_ID" \
  --assignee-principal-type Group --role Reader --scope "$RG_ID"

az role assignment list --scope "$RG_ID" --include-inherited \
  --query "[].{who:principalName, role:roleDefinitionName, scope:scope}" -o table

# Rollback
az role assignment delete --assignee "$GROUP_ID" --role Reader --scope "$RG_ID"

Why does Alex still have access after we removed it?

An engineer removes Alex's Contributor assignment on rg-lab-api, but Alex can still change resources. Listing assignments with inherited ones included shows the reason: the group platform-engineers, which Alex belongs to, holds Contributor on the whole subscription. Because RBAC is additive, the subscription-level grant still allows the action. The fix is either to remove Alex from the group or to narrow that group's assignment to the resource groups it really needs. The lesson is to check inherited and group-based assignments, not only direct ones.

Quick reference

  • Role assignment = principal (who) + role definition (what) + scope (where).
  • Assign to groups or managed identities, not individual users.
  • Contributor manages resources but cannot grant access; Owner can do both.
  • Data access needs data roles, such as Storage Blob Data Reader or Key Vault Secrets User.
  • RBAC is additive: any matching allow wins unless a deny assignment blocks it.
  • az role assignment list --scope ID --include-inherited -o table shows who has access.
  • Entra roles manage the directory; Azure roles manage resources. They are separate systems.

Common mistakes

  • Granting Owner at subscription scope because it was quicker, which also lets the person grant access to others.
  • Giving Contributor on a storage account and expecting the app to read blobs with its identity; that needs a data role.
  • Testing straight after assigning a role; changes can take a few minutes to apply, and cached tokens may need a fresh sign-in.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which role can create and delete resources but cannot give other people access?

Question 2

2An app's identity has Contributor on a storage account but gets 403 reading a blob with Entra auth. Why?

Question 3

3Where should you assign a role so a team can manage one app's resources only?

Question 4

4A user is Global Administrator in Entra ID. What Azure resource access do they have by default?

Question 5

5You removed a user's direct Reader assignment but they can still read resources. What is the most likely cause?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    For each need, name the principal, role and scope: a group of auditors viewing everything in one subscription; a web app reading blobs in one storage account; a developer deploying into rg-lab-api.

  2. Exercise 2medium

    In your lab, create an Entra security group (or use one you have), assign it Reader on rg-lab-api, and prove the assignment with an inherited listing. Then remove it. If you cannot create groups in your tenant, assign Reader to your own user on a test resource group instead.

  3. Exercise 3hard

    Write a custom role called Lab VM Operator that can read VMs and start, restart and deallocate them in one resource group, but cannot create or delete them. Show the JSON and the command to create it.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

How long does a new role assignment take to work?
Usually a few minutes, sometimes longer at management group scope. If it still fails, sign out and in again so the client gets a fresh token.
Should I give developers Owner on their subscription?
Usually not. Contributor lets them build; Owner also lets them grant access to anyone, which is a security decision that should sit with fewer people.
Can I block one action for one person with RBAC?
Not with a role assignment, because RBAC only allows. You remove or narrow their roles, use a policy for what resources may look like, or use a lock to block deletes.

Go deeper

ShareXLinkedInWhatsApp