What is Azure RBAC?
Azure role-based access control (Azure RBAC) enables access management for Azure resources. It’s an authorization system built into the Azure Resource Manager. You can use Azure RBAC to define which users can access Azure cloud resources and assign a set of privileges to each user group.
Azure RBAC vs Azure ABAC
Azure RBAC lets you manage access to Azure resources, defining what users can do with resources and which areas they can access. It lets you use role definitions and role assignments to control access. However, it does not offer fine-grained access management and can be difficult to manage when you have hundreds of role assignments.
Azure attribute-based access control (ABAC) works differently.
Azure ABAC allows you to add role assignment conditions to achieve fine-grained access control. It builds on Azure RBAC, letting you add attributes for specific actions. Each role assignment condition provides an additional, optional check to a role assignment. Once you set it up, the condition can filter down permissions provisioned as a part of the role definition and assignment.
Azure RBAC Concepts
Azure RBAC Roles
In Azure RBAC, a role definition is a set of permissions (role). It defines the actions users can take, such as write, delete, and read. You can define high-level roles, such as an owner, or specific roles, such as a virtual machine (VM) reader.
Azure provides various built-in roles, including a virtual machine contributor role that allows users to create and manage VMs. If the built-in roles do not satisfy your requirements, you can also define Azure custom roles. You can use data actions to grant access to data stored in a specific object.
Scope
The term scope refers to a set of resources with specific access. It enables you to grant the relevant security principal to a certain role. Limiting the scope limits the resources at risk if the security principal is compromised.
Azure RBAC lets you specify a scope at four levels: management group, subscription, resource group, and resource. Azure structures scopes in a parent-child relationship, with each hierarchy level making the scope more specific. You can assign roles at any of the four levels, and the level you choose determines how the role is applied.
Azure also lets you use management groups, a level of scope above subscriptions. Management groups support complex hierarchies. The diagram below illustrates an example of a hierarchy of management groups and subscriptions.
Role Assignments
Role assignments let you attach role definitions to specific users, groups, service principals, or managed identities at a certain scope. When creating a role assignment, you grant specific access, and removing the assignment revokes this access.
This diagram shows an example of a role assignment:
This example assigns a contributor role to the marketing group—only for the pharma-sales resource group. It lets all users in the marketing group create or manage Azure resources in the pharma-sales resource group. It does not give marketing users access to resources outside the pharma-sales resource group.
Azure Groups
Role assignments are transitive for groups, so users gain the permissions assigned to their groups. If user A is a member of group B and group B is a member of group C with its own role assignment, user A gets the permissions in group C’s role assignment.
Azure RBAC uses an additive model to prevent issues when users get several overlapping role assignments. You can see an example of this principle in the image below. A certain user is granted a reader role by a resource group and a contributor role at the subscription level. The sum of the reader and contributor permissions is the contributor role. The reader role assignment has no impact.
Best Practices for Azure RBAC
Only Grant the Access Users Need
With Azure RBAC, you can isolate teams from each other and grant each team only the access it needs to do its job.
Instead of granting unlimited permissions to everyone with an Azure subscription or resource, you can only allow specific actions within specific scopes. Avoid assigning broad roles, even if they seem more convenient at first. When you create a custom role, include only the permissions your users need. That reduces the risk if a principal account is compromised.
The following diagram shows the recommended pattern for granting permissions in Azure RBAC.
Use Azure AD Privileged Identity Management
To protect privileged accounts from attacks, you can use Azure Active Directory Privileged Identity Management (PIM) to reduce privilege issuance time and improve visibility through reports and alerts. PIM helps protect privileged accounts by providing temporary privileged access to Azure AD and Azure resources. Access is time-limited, after which privileges are automatically revoked.
Learn more about privileged identity management.
Assign Roles Using Unique Role ID Instead of the Role Name
Role names may change over time, but the role ID always stays the same. Role names commonly change when you rename your own custom role, or when you use a preview role that has (Preview) in the name. When the role is released from preview, it is automatically renamed.
When you assign roles using scripting or automation, always assign users to a role ID. This way, scripts won’t break if the name changes.
Assign Roles to Groups and Limit Subscription Owners
To make role assignments easier to manage, assign roles to groups instead of directly to users. This minimizes the number of role assignments. Azure limits the total role assignments allowed per subscription.
Microsoft recommends having a maximum of 3 owners for each Azure subscription, to reduce the likelihood of a breach by a compromised or malicious insider.
Cloud RBAC with Frontegg
Frontegg provides an out-of-the-box RBAC model implementation. Customers can create their own roles and permissions that represent their product models and use cases. End users can also create custom roles that represent their permissions model, without changing a single line of code in the product. Try it out now.
Put this into practice with Frontegg
Frontegg is customer identity and access management (CIAM) for B2B SaaS. It's free up to 7,500 monthly active users, including 5 SSO/SCIM connections.
Start for free