How to Create RBAC Role in Azure for Beginners

Author

Posted Oct 22, 2024

Reads 1.1K

Close-Up Photo Of Control Panel
Credit: pexels.com, Close-Up Photo Of Control Panel

Creating a Role-Based Access Control (RBAC) role in Azure is a straightforward process that can be completed in just a few steps. First, you need to decide which type of role you want to create: custom or built-in.

Custom roles offer more flexibility, but they require a detailed definition of the permissions and actions that the role will have. Built-in roles, on the other hand, are pre-defined and can be easily applied to users or groups.

To create a custom role, you'll need to define the permissions and actions that the role will have, which can be a bit more involved. But don't worry, we'll walk you through it step by step.

Related reading: Azure Create Custom Role

Prerequisites

To create a role in Azure's Role-Based Access Control (RBAC), you need to have the right permissions. You must have Microsoft.Authorization/roleAssignments/write permissions, such as being a Role Based Access Control Administrator or User Access Administrator.

To get started, sign in to the Azure portal. This will give you access to the various scopes where you can grant access. You can search for Management groups, Subscriptions, Resource groups, or a specific resource in the Search box at the top.

You'll need to click on the specific resource for the scope you want to grant access to. For example, if you're searching for a Resource group, you'll see it listed as a clickable option.

Broaden your view: Watch Role Models

Define Role Scope

Credit: youtube.com, Azure Role-based Access Control (RBAC)

To define the scope of a role in Azure RBAC, you need to specify a set of resources the access applies to. This can be done at four levels: management group, subscription, resource group, and resource.

The scope of a role determines the level of access a user has to Azure resources. For example, assigning a role at the management group level provides access to all resources within that group, while assigning a role at the resource level provides access to a single resource.

You can specify the scope of a role when creating a new role assignment in the Access control (IAM) page. To do this, click the Role assignments tab and then click Add > Add role assignment. Select the role you want to use and click Next.

Scope

You can specify a scope at four levels in Azure: management group, subscription, resource group, and resource. Each level gets progressively more specific.

Additional reading: Azure Create Resource Group

Credit: youtube.com, Roles and Scopes in Azure Identity | azure ad roles scopes | oauth2.0 roles vs scopes

Limiting the scope means limiting the resources at risk if the security principal is compromised. This is a crucial aspect of Azure RBAC, as it helps you grant the right level of access to users and services.

Azure structures scopes in a parent-child relationship, with each hierarchy level making the scope more specific. This means that the level you choose determines how the role is applied.

You can assign roles at any of the four levels, but keep in mind that the level you choose will affect the scope of resources the access applies to.

Here are the four levels of scope in Azure, listed from broad to narrow:

Management GroupSubscriptionResource GroupResource

By understanding the different levels of scope, you can effectively manage access and ensure that users have the right level of access to resources.

What Is?

Azure RBAC is an authorization system built into the Azure Resource Manager. It's a powerful tool that enables access management for Azure resources.

Credit: youtube.com, S02E25 - Scope Tags, Scope Groups & Roles - Securing Intune w/ Role Based Access Control - (I.T)

Azure RBAC allows you to define which specific users should be allowed access to Azure cloud resources. You can assign a set of privileges for each user group, giving you fine-grained control over who can do what.

By using Azure RBAC, you can restrict access to sensitive resources and ensure that users only have the permissions they need to perform their tasks. This helps prevent unauthorized changes or data breaches.

Azure RBAC is built into the Azure Resource Manager, making it easy to integrate with your existing Azure setup.

Configure Role

To create a custom RBAC role in Azure, you must assign an RBAC role to your app registration to grant Alert Logic permission to monitor your environments. This allows limited and controlled access to your environments.

You can create a custom role in the CLI, which is useful if you don't want to create it in the Azure portal. To do this, ensure you have either Azure PowerShell or Azure CLI 2.0 installed.

Credit: youtube.com, How to create custom RBAC roles in Azure

To create a custom role in the CLI, follow these steps:

1. Create a new text file and copy the Alert Logic role into it.

2. Make changes to the file, such as updating the name and description.

3. Save the text file as a JSON file.

4. Log in to your Azure account and specify the default subscription.

5. Create your custom role in Azure using the `az role definition create` or `New-AzureRmRoleDefinition` command.

Once you've created your custom role, you can verify it appears in the Azure portal under Access control (IAM).

Delegate Condition

If you selected one of the following privileged roles, you'll need to follow a specific set of steps to delegate a condition: Owner, Role Based Access Control Administrator, or User Access Administrator.

To do this, you'll need to select the Allow user to only assign selected roles to selected principals (fewer privileges) option on the Conditions tab under What user can do.

Clicking Select roles and principals will allow you to add a condition that constrains the roles and principals this user can assign roles to.

To delegate Azure role assignment management to others with conditions, you'll need to follow the steps outlined in the Azure documentation.

Edit the Template

Security Logo
Credit: pexels.com, Security Logo

To edit the template, you need to update the name and description to describe your custom role. This is a crucial step in making the role easily identifiable.

You should delete the ID field, as Azure will create an ID when you create the role. This is a built-in feature of Azure that simplifies the process.

Set IsCustom to true, indicating that this is a custom role. This will help you distinguish it from built-in roles.

Change the AssignableScope to a specific subscription or list of subscriptions, as you don't have rights to apply the role to all subscriptions. This is a common limitation when creating custom roles.

To adjust your permissions, you can add a small number of allow permissions to the Actions section. Alternatively, you can use the NotActions section to deny permissions or grant every permission except one.

To determine what actions or permissions you want to grant, you can find a list of available actions in two ways. First, use the Azure portal to navigate to any resource's "Access Control (IAM)" section, then click on "roles" and find a role that likely uses the resource you are interested in. From there, click on "permissions" and locate the resource you are interested in to see the list of available actions.

Woman using a secure mobile app, showcasing data encryption on a smartphone.
Credit: pexels.com, Woman using a secure mobile app, showcasing data encryption on a smartphone.

Alternatively, you can use PowerShell to list all actions on a resource. For example, you can use the command below to list actions on the Microsoft Compute resource.

Once you identify the actions you want to grant (or deny), you can add them to the JSON file. You can grant rights to low-level actions or at a higher level to all actions beneath this level.

assistant

As an assistant, I can help you navigate the process of configuring roles in Azure. To create a custom RBAC role, you'll need to create a role document and a custom role in Azure.

You can create a role document by copying the Alert Logic RBAC role into a new text file. Then, you'll need to make changes to the file, such as updating the name and description, and setting the IsCustom field to true.

To create a custom role in Azure, you'll need to use the Azure CLI or Azure PowerShell. You'll need to log in to your Azure account and specify the default subscription, then create a new role definition using the az role definition create command or the New-AzureRmRoleDefinition command.

A close-up image of an illuminated security keypad mounted on a wall.
Credit: pexels.com, A close-up image of an illuminated security keypad mounted on a wall.

Once you've created the custom role, you'll need to verify that it appears in the Roles tab in Subscriptions > Access Control (IAM) in the Azure portal.

Here are the steps to create a custom role in Azure:

1. Create a new text file and copy the Alert Logic RBAC role into it.

2. Make changes to the file, such as updating the name and description, and setting the IsCustom field to true.

3. Save the text file as a JSON file.

4. Log in to your Azure account and specify the default subscription using the az login and az account set commands or the Login-AzureRmAccount and Get-AzureRmSubscription commands.

5. Create a new role definition using the az role definition create command or the New-AzureRmRoleDefinition command.

6. Verify that the custom role appears in the Roles tab in Subscriptions > Access Control (IAM) in the Azure portal.

Groups

Groups are a powerful way to manage role assignments in Azure, allowing users to gain permissions assigned to groups.

Credit: youtube.com, Configuring Role Based Access Control

In Azure, groups are transitive, meaning 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.

This transitive property makes it easier to manage permissions, but it also means you should be mindful of the permissions being assigned to groups.

Role assignments are additive, preventing issues when users get several overlapping role assignments.

Frequently Asked Questions

How do I add a role to RBAC?

To add a role to RBAC, click +Add above the user list and select the created RBAC role from the list. Then, proceed to add users to the selected role.

How do I create a new role in Azure?

To create a new role in Azure, navigate to the Access control (IAM) page in the Azure portal and click Add custom role. This will open the Create a custom role page where you can define the new role's permissions and settings.

What is an RBAC role in Azure?

An RBAC role in Azure defines a set of permissions that determine what actions a user or service can perform on Azure resources. It's a way to control access and ensure that users only have the privileges they need to do their job.

Sources

  1. Azure portal (azure.com)
  2. portal (azure.com)
  3. cisecurity.org/benchmark/azure (cisecurity.org)
  4. Azure portal (azure.com)
  5. RBAC in Azure: A Practical Guide (frontegg.com)
  6. Custom Azure RBAC Roles (samcogan.com)

Ann Predovic

Lead Writer

Ann Predovic is a seasoned writer with a passion for crafting informative and engaging content. With a keen eye for detail and a knack for research, she has established herself as a go-to expert in various fields, including technology and software. Her writing career has taken her down a path of exploring complex topics, making them accessible to a broad audience.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.