Intermediate · Microsoft Azure essentials · topic 24 of 50 · 30 min
Microsoft Entra ID and Azure RBAC
Explanation
Two questions: who are you, and what may you do?
Authentication answers "who are you?": proving your identity, for example with a password and a code on your phone. Authorisation answers "what may you do?": read this storage account, restart that VM. In Azure, Microsoft Entra ID handles authentication, and Azure role-based access control (Azure RBAC) handles authorisation for Azure resources.
Microsoft Entra ID is the new name, from 2023, for Azure Active Directory (Azure AD). Many older documents, job posts and exam dumps still say Azure AD; they mean the same service. It is a cloud identity service, not the same thing as the Windows Server Active Directory that runs in office server rooms, although the two are often connected.
Kinds of identities
| Identity | What it is | Example |
|---|---|---|
| User | A person who signs in | asha@contoso.com |
| Group | A set of users (or other identities). Assign access to the group, not to each person | grp-web-developers |
| Service principal | An identity for an application or script, created from an app registration. It signs in with a secret or certificate | A CI/CD pipeline that deploys to Azure |
| Managed identity | A service principal that Azure creates and manages for a resource. No secrets for you to store or rotate | A VM or Function app reading Key Vault |
Managed identities come in two kinds. A system-assigned identity is created for one resource and deleted with it. A user-assigned identity is a separate resource you create once and attach to several resources; it lives until you delete it. Whenever Azure code needs to call another Azure service, prefer a managed identity over a stored secret.
Signing in safely
- MFA (multi-factor authentication): something you know plus something you have, such as the Microsoft Authenticator app. It stops most password attacks.
- Passwordless: Authenticator sign-in, passkeys or FIDO2 security keys, and Windows Hello for Business. Nothing to phish.
- Conditional Access: if-then rules, for example "if the user is an admin, require MFA" or "block sign-ins from outside India for this app". It needs an Entra ID P1 licence or higher.
- Security defaults: a free, simple baseline that turns on MFA for everyone. Use it if you have no Conditional Access policies.
Azure RBAC: role assignments
A role assignment has three parts. The security principal is who (a user, group, service principal or managed identity). The role definition is what they may do, a list of allowed actions. The scope is where: a management group, a subscription, a resource group or a single resource. Assignments are inherited downward: Reader on a subscription means Reader on every resource group and resource in it.
| Built-in role | Can do | Cannot do |
|---|---|---|
| Owner | Everything, including granting access to others | Nothing is blocked |
| Contributor | Create, change and delete all resources | Grant access to others (assign roles) |
| Reader | View everything | Change anything |
| User Access Administrator | Manage who has access (role assignments), and read | Create or change other resources |
Azure RBAC is additive: if you have Reader from one assignment and Contributor from another, you get both. There are hundreds of narrower built-in roles too, such as Virtual Machine Contributor or Storage Blob Data Reader, and you can write custom roles in JSON.
az role assignment create --assignee asha@contoso.com --role "Reader" \
--scope "/subscriptions/<subscription-id>/resourceGroups/rg-web"
az role assignment list --assignee asha@contoso.com --all --output table
az vm identity assign --resource-group rg-web --name vm-web-01 # system-assigned managed identity{
"Name": "VM Operator (custom)",
"IsCustom": true,
"Description": "Can see, start, stop and restart virtual machines.",
"Actions": [
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/virtualMachines/start/action",
"Microsoft.Compute/virtualMachines/powerOff/action",
"Microsoft.Compute/virtualMachines/restart/action"
],
"NotActions": [],
"AssignableScopes": ["/subscriptions/<subscription-id>"]
}Entra roles are not Azure roles
There are two separate role systems, and mixing them up is a classic interview question. Microsoft Entra roles, such as Global Administrator or User Administrator, manage the directory: creating users, resetting passwords, registering apps. Azure roles, such as Owner or Reader, manage Azure resources: VMs, networks, storage. A Global Administrator does not automatically get access to subscriptions, although they can choose to elevate their access when needed.
Least privilege and PIM
Least privilege means giving each identity only the access it needs, at the smallest scope, for only as long as needed. Assign roles to groups rather than people, prefer narrow built-in roles over Owner, and choose a resource group scope over a subscription scope where you can.
Privileged Identity Management (PIM) adds just-in-time access. Instead of being Owner all the time, an engineer is "eligible" and activates the role for, say, two hours, with a reason, MFA and sometimes an approval. Every activation is logged. PIM needs Entra ID P2 or Entra ID Governance licences.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Microsoft Entra ID and Azure RBAC · 1/8
This lesson covers identity and access in Azure: who you are, and what you are allowed to do.
Prefer a video by a teacher? Find free videos on “microsoft entra id azure rbac role assignment managed identity tutorial” on YouTube ↗
In real life: Access at an IT services company in Chennai
An IT services company manages Azure for a hospital client. Its developers are in an Entra group with Contributor on the non-production subscription and Reader on production. Only two senior engineers are eligible for Owner on production through PIM, for up to four hours with a ticket number. The hospital's auditors get Reader at the management group level, so they see everything and change nothing. The app's Function app uses a system-assigned managed identity with Key Vault Secrets User on one key vault, so no database password lives in code or configuration files.
Practice (0/3 done)
A developer must create and delete VMs in rg-dev but must NOT be able to give anyone else access. Which built-in role at rg-dev fits?
Scopes are written as paths, for example "/mg-college/sub-prod/rg-web/vm-web-01" (a simplified form of real Azure scopes). An assignment is a tuple (principal, role, scope). An assignment applies to a target scope when the target equals the assignment scope or is below it (target starts with scope + "/"). groups maps a user to the groups they belong to; assignments to those groups also apply. Write effective_roles(assignments, principal, scope, groups=None) returning a sorted list of distinct role names, and can(assignments, principal, scope, action, groups=None) returning True if any effective role allows the action, using ROLE_ACTIONS.
Plan the access for a small startup with 3 developers, 1 tester, 1 finance person and a web app running on an Azure VM that reads secrets from Key Vault. They have one production and one development subscription. Write the groups, roles and scopes you would use, and how the app gets its secrets.
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- Azure compute and storageMicrosoft Azure essentials · same module
- Azure networking, Functions, databases and monitoringMicrosoft Azure essentials · same module
- Cloud identity and access managementCyber Security: from zero to SOC analyst · Cloud security basics
- Identity and access management, least privilege and RBACCyber Security: from zero to SOC analyst · Identity and network defence
- Google Cloud structure: projects, billing and IAMGoogle Cloud and comparing the clouds
- Identity is the new perimeterCloud security and compliance
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What was Microsoft Entra ID called before 2023?
Answer: Azure Active Directory (Azure AD)
Microsoft renamed Azure Active Directory to Microsoft Entra ID in 2023. The service is the same.
Which three parts make up an Azure role assignment?
Answer: Security principal, role definition and scope
Who (security principal), what (role definition) and where (scope).
You give a group Reader on a subscription. What can they read?
Answer: Every resource group and resource in that subscription
Role assignments are inherited by every scope below, including future resources.
A Function app needs to read a storage account without any stored secret. What should it use?
Answer: A managed identity with a narrow data role
A managed identity gets tokens from Entra ID automatically; you then grant it a role such as Storage Blob Data Reader.
What is the difference between Entra roles and Azure roles?
Answer: Entra roles manage the directory (users, apps); Azure roles manage Azure resources
Global Administrator is an Entra role; Owner and Contributor are Azure roles. They are separate systems.
Which Azure built-in role lets someone look but not change?Related
In RBAC, permissions are attached to…Related
Answer: Roles
Roles carry permissions; people are given roles.
From Identity and access management, least privilege and RBAC
Which IAM identity gives temporary credentials and is the right choice for a Lambda function?Related
Answer: IAM role
Lambda runs with an execution role; AWS supplies temporary credentials.
Which Indian Azure region is in Pune?Related
Answer: Central India
Central India is in Pune, South India in Chennai and West India in Mumbai.
From How Azure is organised: tenants, subscriptions and resource groups
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 2 more topics in “Microsoft Azure essentials” before its exam: Azure compute and storage, Azure networking, Functions, databases and monitoring.
- Module 6 exam: Microsoft Azure essentials · 13 questions · 20 min, without help. 4 topics of this module still to finish first.
- Then the next module, Google Cloud and comparing the clouds. 50 topics left in the course before the final exam.
← Previous: How Azure is organised: tenants, subscriptions and resource groups