Introduction to RBAC

Azure Role-Based Access Control (RBAC) helps you manage who has access to what resources in Azure. It's a fundamental part of Azure security, allowing you to grant users, groups, and service principals the permissions they need to perform their jobs, and no more.

RBAC is used to grant granular access to Azure resources. This is different from Azure subscription management, which controls access to subscription-level resources. With RBAC, you can control access at various levels, such as the management group, subscription, resource group, or even a single resource.

Roles

A role definition consists of a set of permissions. Azure RBAC has three fundamental types of roles:

Permissions

Permissions define what operations are allowed on a resource. Permissions are grouped into roles. Azure RBAC includes a set of permissions, such as:

A role can contain many permissions. When you assign a role to a principal, you are granting them all the permissions included in that role.

Scope

Scope is the set of resources to which access applies. Azure RBAC has four levels of scope:

Access is inherited down the hierarchy. For example, permissions assigned at the subscription scope are inherited by all resource groups and resources within that subscription.

Role Assignments

A role assignment is the process of granting a principal (user, group, service principal, or managed identity) a specific role at a specific scope. This is how you effectively grant permissions.

To create a role assignment, you need:

  1. The security principal that needs access.
  2. The role definition to assign.
  3. The scope at which to assign the role.

You can manage role assignments through the Azure portal, Azure CLI, Azure PowerShell, or REST API.

Example Role Assignment (Azure CLI)

Assign the 'Reader' role to a user on a specific resource group:

az role assignment create --role "Reader" --assignee "user@example.com" --resource-group "myResourceGroup"

Custom Roles

If Azure's built-in roles don't meet your organization's needs, you can create custom roles. Custom roles allow you to define a specific set of permissions that align with your security requirements.

Custom roles are defined using JSON. They can be created at the subscription or resource group scope.

Key properties of a custom role definition:

Best Practices for RBAC

Following best practices ensures effective security and manageability: