Tutorial / Cram Notes

Role-Based Access Control (RBAC) is a method of regulating access to resources based on the roles of individual users within an organization. RBAC ensures that only authenticated users are given permission to access certain resources or perform specific tasks. Azure Active Directory (Azure AD) roles are a critical component in managing and securing your Azure environment, particularly when preparing for the AZ-104 Microsoft Azure Administrator exam.

Understanding Azure RBAC

Azure RBAC provides fine-grained access management to Azure resources, allowing you to segregate duties within your team and grant only the amount of access necessary to users to perform their jobs. Instead of giving everybody unrestricted permissions in your Azure subscription or resources, you can allocate permissions based on the needs of a particular job.

Key Concepts of Azure RBAC

  • Roles: A set of permissions that allows users to perform specific actions, such as read, write, or delete.
  • Scope: The set of resources that the access applies to. Scope can be set at multiple levels: management group, subscription, resource group, and resource.

Pre-defined Azure RBAC Roles

Azure comes with several built-in roles that you can assign to users, groups, service principals, and managed identities. Here are a few example roles:

  • Owner: Has full management access, including the right to delegate access to other users.
  • Contributor: Can create and manage all types of Azure resources but cannot grant access to others.
  • Reader: Can view existing Azure resources.
  • User Access Administrator: Can manage user access to Azure resources.

Custom Roles

While pre-defined roles should meet most of your organizational requirements, there may be situations where you need a more tailored set of permissions. This is where custom roles come into play.

To create custom roles, you can either start from scratch or clone an existing role and modify the permissions. Custom roles can be created using the Azure portal, Azure PowerShell, Azure CLI, or the REST API.

Here is an example of creating a custom role with Azure CLI:

az role definition create –role-definition ‘{
“Name”: “Custom Virtual Machine Operator”,
“Description”: “Perform actions on virtual machines”,
“Actions”: [
“Microsoft.Compute/virtualMachines/start/action”,
“Microsoft.Compute/virtualMachines/restart/action”
],
“AssignableScopes”: [“/subscriptions/your-subscription-id”]
}’

In this example, a custom role named “Custom Virtual Machine Operator” is created which allows the user to start and restart virtual machines in the specified subscription.

Azure AD Roles

Azure AD roles are different from Azure RBAC roles and are used for managing access to Azure AD resources. While Azure RBAC roles control permissions within Azure services, Azure AD roles are primarily used to manage Azure AD and other Microsoft services like Microsoft 365.

Key Concepts of Azure AD Roles

  • Role Assignments: Assigning roles to users, groups, or service principals.
  • Directory Roles: Set of permissions that are used to manage Azure AD and other Microsoft services.

Examples of Azure AD Roles

  • Global Administrator: Has access to all administrative features in Azure AD.
  • User Administrator: Can create and manage users and groups, assign roles in Azure AD.
  • Compliance Administrator: Can manage compliance-related features in Microsoft 365.

Combining Azure RBAC and Azure AD Roles

It’s important to understand the distinction between these two sets of roles and how they complement each other. An Azure Administrator must use both sets of roles to effectively manage access to Azure resources and Azure AD functionality.

Best Practices for Assigning Roles

When assigning roles in Azure:

  1. Follow the Principle of Least Privilege: Assign users only the permissions they need to do their jobs.
  2. Regularly Review Access: Periodically review roles and access permissions to make sure they are still relevant.
  3. Audit Role Assignments: Use Azure’s activity logs to audit role assignments and ensure compliance.

In summary, Azure RBAC and Azure AD roles are essential tools for any Azure Administrator, especially for those preparing for the AZ-104 exam. They help secure and manage the resources within Azure and Azure AD by providing precise control over who can do what. Understanding the difference between Azure RBAC and Azure AD roles, how to create and assign custom roles, and following best practices are key to maintaining a secure and efficient Azure environment.

Practice Test with Explanation

True or False: Custom RBAC roles can be created at the subscription level and automatically apply to all resource groups and resources within the subscription.

  • (A) True
  • (B) False

Answer: A

Explanation: Custom RBAC roles created at the subscription level apply to all resource groups and resources within the subscription. RBAC roles are inherited by all resources within its scope.

True or False: Azure AD roles and Azure RBAC roles are the same thing and are interchangeable.

  • (A) True
  • (B) False

Answer: B

Explanation: Azure AD roles are used for managing Azure Active Directory resources, while Azure RBAC roles are used for managing Azure resources. They are distinct and serve different purposes.

Which of the following options can you assign RBAC roles to?

  • (A) User accounts
  • (B) Groups
  • (C) Service Principals
  • (D) Managed Identities

(Select all that apply)

Answer: A, B, C, D

Explanation: RBAC roles can be assigned to user accounts, groups, service principals, and managed identities.

What is the maximum number of custom RBAC roles you can create within an Azure subscription?

  • (A) 10
  • (B) 30
  • (C) 100
  • (D) 5000

Answer: D

Explanation: You can create up to 5000 custom RBAC roles per Azure subscription.

True or False: To create a custom RBAC role, you must start from a JSON format file with the role’s definition.

  • (A) True
  • (B) False

Answer: A

Explanation: Creating a custom RBAC role requires starting with a JSON format file that contains the role definition, including the permissions and assignable scopes.

When you need to grant the permission to manage only the virtual machines in a specific resource group, which of the following would you use?

  • (A) Azure AD roles
  • (B) Built-in RBAC roles
  • (C) Custom RBAC roles
  • (D) Azure policies

Answer: C

Explanation: Custom RBAC roles allow you to define granular permissions, such as managing the virtual machines in a specific resource group, which built-in roles may not exactly provide.

True or False: RBAC role assignments are stored within Azure Active Directory.

  • (A) True
  • (B) False

Answer: A

Explanation: All role assignments in Azure, whether for RBAC or Azure AD roles, are stored within Azure Active Directory.

Which Azure PowerShell cmdlet is used to create a new custom RBAC role?

  • (A) New-AzRoleAssignment
  • (B) New-AzRoleDefinition
  • (C) Set-AzRoleDefinition
  • (D) Create-AzCustomRole

Answer: B

Explanation: The New-AzRoleDefinition cmdlet is used for creating a new RBAC role definition in Azure.

True or False: Once you create a custom RBAC role, you cannot change its definition.

  • (A) True
  • (B) False

Answer: B

Explanation: You can change the definition of a custom RBAC role after creating it by updating the role definition JSON file and using the Set-AzRoleDefinition cmdlet.

What should you do if you want to make a custom RBAC role available across multiple subscriptions?

  • (A) Create the role in each subscription individually.
  • (B) Create the role in Azure AD and assign it to each subscription.
  • (C) Define the role at the management group level.
  • (D) Duplicate the role definition JSON file for each subscription.

Answer: C

Explanation: Custom RBAC roles should be defined at the management group level to make them available across all included subscriptions.

Interview Questions

What is RBAC in Azure?

RBAC stands for role-based access control, which is a feature in Azure that enables organizations to manage access to their resources based on user roles.

Why might an organization need to create custom RBAC roles in Azure?

An organization might need to create custom RBAC roles in Azure to align with their specific needs for access to resources, to reduce the risk of unauthorized access or data breaches, and to improve efficiency and compliance.

What is the syntax for creating a new custom RBAC role definition in PowerShell?

The syntax for creating a new custom RBAC role definition in PowerShell is New-AzRoleDefinition -Name “” -Description “” -Actions “” -AssignableScopes “

What is the syntax for creating a new custom Azure AD role definition using the Azure CLI?

The syntax for creating a new custom Azure AD role definition using the Azure CLI is az ad sp create –id

How can you add permissions to a new custom Azure AD role using the Azure CLI?

You can add permissions to a new custom Azure AD role using the Azure CLI by running the command az ad app permission add –id –api –api-permissions

What is a scope in RBAC?

A scope in RBAC refers to the level of access that a role has to a resource, such as a subscription or a resource group.

How can you verify that a new custom RBAC role was created in PowerShell?

You can verify that a new custom RBAC role was created in PowerShell by running the command Get-AzRoleDefinition -Name “

How can you verify that a new custom Azure AD role was created using the Azure CLI?

You can verify that a new custom Azure AD role was created using the Azure CLI by running the command az ad app show –id

What are some benefits of creating custom RBAC and Azure AD roles?

Benefits of creating custom RBAC and Azure AD roles include tailored access to resources, reduced risk of unauthorized access or data breaches, increased efficiency in access management, and improved compliance with necessary standards.

What is the difference between RBAC and Azure AD roles?

RBAC is a feature in Azure that enables organizations to manage access to their resources based on user roles, while Azure AD roles are used to manage access to Azure AD resources, such as users and groups.

How do you assign a custom role to a user in Azure?

To assign a custom role to a user in Azure, go to the Access control (IAM) tab for the resource or resource group, click Add, select the custom role, and enter the user’s email address or object ID.

How can you revoke a custom role assignment in Azure?

To revoke a custom role assignment in Azure, go to the Access control (IAM) tab for the resource or resource group, find the user or group with the assignment, click the three dots next to the assignment, and select Remove.

Can you create a custom RBAC role that has permissions for a specific resource only?

Yes, you can create a custom RBAC role that has permissions for a specific resource only by specifying the resource ID as the assignable scope when creating the role definition.

Can you modify a custom RBAC role definition after it has been created?

Yes, you can modify a custom RBAC role definition after it has been created by running the Set-AzRoleDefinition cmdlet in PowerShell.

0 0 votes
Article Rating
Subscribe
Notify of
guest
22 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Anton Christiansen
9 months ago

Great article on custom RBAC and Azure AD roles! It’s exactly what I needed to understand for the AZ-104 exam.

Guillaume Garcia
1 year ago

What’s the difference between built-in roles and custom roles?

Francis Brede
1 year ago

Can someone explain the JSON structure for defining a custom role?

Jessica Carr
1 year ago

I appreciate this blog post!

Lucas Petersen
1 year ago

I created a custom role but it’s not working as expected. Any troubleshooting tips?

Ed Fitzpatrick
1 year ago

Does each subscription require unique custom roles, or can they be shared?

Carlos Medina
1 year ago

How are DataActions different from Actions in the custom role JSON schema?

Abel Carrera
1 year ago

This explanation of role-based access control features is very helpful. Thanks!

22
0
Would love your thoughts, please comment.x
()
x