Using Azure ABAC for Attribute Based Access

Author

Reads 1.1K

Security Logo
Credit: pexels.com, Security Logo

Azure ABAC is a powerful tool that allows you to control access to your Azure resources based on attributes. This means you can grant access to resources based on a user's attributes, such as their job title or department.

With Azure ABAC, you can define policies that assign permissions based on these attributes. For example, you can create a policy that grants access to a specific resource only to users who have a certain attribute, like "HR" in their job title.

This approach is more flexible and scalable than traditional role-based access control (RBAC) methods. By using attributes, you can create more fine-grained access controls that adapt to changing business needs.

Azure ABAC integrates seamlessly with Azure Active Directory (Azure AD), allowing you to leverage your existing identity infrastructure. This means you can use the same identities and access controls across your Azure resources and on-premises systems.

Azure ABAC Basics

Azure ABAC is built on top of Azure RBAC, allowing you to add role assignment conditions for fine-grained access control.

Credit: youtube.com, ABAC and RBAC in Azure

It lets you use attributes for specific actions, providing an additional, optional check to a role assignment. Each role assignment condition filters down permissions provisioned as a part of the role definition and assignment.

You can specify an attribute by including the source as a prefix, such as @Environment, @Principal, @Request, or @Resource.

Here are some common attribute sources:

Actions

Actions play a crucial role in Azure ABAC, and I'm excited to share some key facts with you.

You can add conditions to built-in or custom role assignments that have blob storage or queue storage data actions. This includes roles like Storage Blob Data Contributor and Storage Queue Data Message Processor.

Some built-in roles that support conditions include Storage Blob Data Owner, Storage Blob Data Reader, Storage Queue Data Contributor, and Storage Queue Data Message Sender.

For a list of the storage actions you can use in conditions, check out the resources listed in the article.

Credit: youtube.com, Role-based access control (RBAC) vs. Attribute-based access control (ABAC)

The Storage Blob Data Contributor role is a great example of a role that supports conditions, and it's often used to grant access to blob storage resources.

Here's a quick rundown of the storage actions you can use in conditions:

  • Storage Blob Data Contributor
  • Storage Blob Data Owner
  • Storage Blob Data Reader
  • Storage Queue Data Contributor
  • Storage Queue Data Message Processor
  • Storage Queue Data Message Sender
  • Storage Queue Data Reader

These roles are just a few examples of the many roles that support conditions in Azure ABAC.

Attributes

Attributes play a crucial role in Azure ABAC, and understanding them is essential for creating effective conditions.

There are different sources of attributes, and each source has its own description and code prefix. For example, the Environment source provides attributes associated with the environment of the request, such as the network origin of the request or the current date and time, and its code prefix is @Environment.

The Principal source provides custom security attributes assigned to the security principal requesting access to a resource, and its code prefix is @Principal.

The Request source provides attributes that are part of the action request, such as setting the blob index tag, and its code prefix is @Request.

Credit: youtube.com, Manage access to Azure resources at scale using Attribute Based Access Control (ABAC)

The Resource source provides attributes that are a property of the resource, such as a container name, and its code prefix is @Resource.

Here's a summary of the attribute sources:

ABAC

ABAC allows you to add role assignment conditions to achieve fine-grained access control, building on Azure RBAC and letting you add attributes for specific actions.

Each role assignment condition provides an additional, optional check to a role assignment, filtering down permissions provisioned as a part of the role definition and assignment.

User attributes used in ABAC include username, job title, department, security clearance level, and management level.

Object attributes used in ABAC include file type, date the file was last updated, file name, and data sensitivity.

Action attributes used in ABAC include reading, copying, editing, file transferring, or deleting.

Environment attributes used in ABAC include time, location, network, and other dynamic factors such as users' device type, the number of transactions made within a 24-hour span, or the users' relationship with a third party.

Credit: youtube.com, New Attribute-Based Access Control for Blob

ABAC requires a more thorough setup compared to RBAC, and troubleshooting errors requires more time and resources.

Here are some common examples of attributes used in ABAC:

  • User attributes: username, job title, department, security clearance level, management level
  • Object attributes: file type, date the file was last updated, file name, data sensitivity
  • Action attributes: reading, copying, editing, file transferring, deleting
  • Environment attributes: time, location, network, device type, transactions, relationship with third party

Principal attributes are custom security attributes assigned to the security principal requesting access to a resource, such as a user or an enterprise application (service principal).

To use principal attributes, you must have Microsoft Entra permissions for the signed-in user, such as the Attribute Assignment Administrator role, and custom security attributes defined in Microsoft Entra ID.

Scope

The scope in Azure RBAC refers to a set of resources with specific access, enabling you to grant the relevant security principal to a certain role.

Limiting the scope means limiting the scope of resources at risk if the security principal is compromised.

Azure RBAC lets you specify a scope at four levels, including a management group level, a subscription level, a resource group level, and a resource level.

Check this out: Azure Resource

Credit: youtube.com, Fundamentals of RBAC and ABAC|​How role based access control works|What is ABAC| Best Practices

Each hierarchy level makes the scope more specific, and you can assign roles at any of these four levels.

The level you choose determines how the role is applied, so it's essential to consider this when assigning roles.

Azure also lets you use management groups, a level of scope above subscriptions, which support complex hierarchies.

A management group is a level of scope above subscriptions, allowing for more organized and structured access control.

Management groups are useful for large-scale deployments, making it easier to manage access and permissions across multiple subscriptions.

Condition Rules

A condition in Azure ABAC is basically a rule that determines whether an action can be performed on a resource.

The format of a condition is simple: it consists of a targeted action and an expression, which evaluates to true or false.

An action is an operation that a user can perform on a resource type, such as "Read a blob", and the expression checks a specific condition, like the container name being "blobs-example-container".

You can add an ABAC condition to a new or existing Azure role assignment, and the syntax for a role assignment condition is what you need to follow.

Simple Condition

Credit: youtube.com, Basic concept of Conditions sentences/ condition rules

A simple condition is the most basic type of condition, and it consists of a targeted action and an expression. The action is an operation that a user can perform on a resource type.

An expression is a statement that evaluates to true or false, which determines whether the action is allowed to be performed. The format of a simple condition is described in the article.

The action in a simple condition can be something like "Read a blob." The expression checks whether a specific condition is met, such as the container name being "blobs-example-container." This is an example of how a simple condition is structured.

A simple condition is used to determine whether an action is allowed or not. It's a straightforward way to define a rule for a condition.

For All Values

For All Values, we have two main concepts: ForAnyOfAnyValues and ForAllOfAnyValues. ForAnyOfAnyValues evaluates to true if at least one value on the left-hand side satisfies the comparison to at least one value on the right-hand side.

A businessman uses a secure card reader access system against a concrete wall.
Credit: pexels.com, A businessman uses a secure card reader access system against a concrete wall.

ForAllOfAnyValues, on the other hand, evaluates to true only if every value on the left-hand side satisfies the comparison to at least one value on the right-hand side. This means that if even one value doesn't match, the entire expression is false.

Let's take a look at some examples. ForAnyOfAnyValues:StringEquals could be used to check if an encryption scope name equals 'validScope1' or 'validScope2', and if it does, then the expression evaluates to true.

The ForAllOfAnyValues operator is similar, but it requires that all values on the left-hand side match at least one value on the right-hand side. For instance, if we have the values 'red' and 'blue' and we want to check if they are all equal to 'orange', 'red', or 'blue', then the expression would evaluate to false because 'blue' doesn't match.

Here's a summary of the ForAllOfAnyValues operators:

These operators can be used in various scenarios, such as checking if multiple values are present in a list or if a set of values meets certain criteria.

Condition Evaluation

Credit: youtube.com, New Attribute-Based Access Control for Blob

A condition is evaluated to true or false based on the action and expression.

The expression checks whether a condition is met, such as whether the container name is blobs-example-container.

An action is an operation that a user can perform on a resource type, like "Read a blob".

Condition Format

A condition format is a crucial concept to grasp when working with role assignment conditions. It's essentially a way to understand how conditions are structured.

The most basic condition consists of a targeted action and an expression, which evaluates to true or false. The action is an operation that a user can perform on a resource type.

A simple condition format is composed of a targeted action and an expression. This format helps to determine whether the action is allowed to be performed.

The action can be something like "Read a blob", and the expression checks whether the container name is "blobs-example-container". This is just a basic example, but it illustrates the concept.

Credit: youtube.com, Conditional Formatting with Multiple Conditions

In a condition, the action is followed by an expression that determines whether the action is allowed. The expression can be a statement that checks for certain conditions.

The condition format is essential to understanding how role assignment conditions work. It's a fundamental concept that helps you create and manage conditions effectively.

Action Matches

Action Matches is a key concept in condition evaluation. It checks if the current action matches a specified action pattern.

The ActionMatches operator is used to achieve this. It's a powerful tool that allows you to fine-tune your conditions.

The format of the ActionMatches operator is straightforward: ActionMatches{'action-pattern'}. For example, ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'}.

This operator is useful when you need to match a specific action pattern. In the example above, the action being checked must equal "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read" for the condition to be true.

Here are some examples of using the ActionMatches operator:

  • ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'}: If the action being checked equals "Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read", then true
  • ActionMatches{'Microsoft.Authorization/roleAssignments/*'}: If the action being checked equals "Microsoft.Authorization/roleAssignments/write", then true
  • ActionMatches{'Microsoft.Authorization/roleDefinitions/*'}: If the action being checked equals "Microsoft.Authorization/roleAssignments/write", then false

These examples demonstrate how the ActionMatches operator can be used to create specific conditions. By using this operator, you can ensure that only the desired actions are allowed or denied.

Adding Conditions

Credit: youtube.com, Intro and demo to ACR with ABAC

Adding conditions to Azure ABAC is a straightforward process. You can add an ABAC condition to a new or existing Azure role assignment.

The condition format is essential to understand, consisting of a targeted action and an expression. The expression evaluates to true or false, determining whether the action is allowed to be performed.

A simple condition has a format of an action and an expression. For instance, a condition with an action of "Read a blob" has an expression that checks whether the container name is "blobs-example-container."

The condition syntax is also crucial, allowing you to specify the action and expression clearly. This is particularly important when creating conditions that involve multiple expressions.

You can add an ABAC condition in three steps. First, you need to specify the action and expression. Then, you can add multiple expressions, depending on the operator. Finally, you can save the condition to the role assignment.

Credit: youtube.com, Entra ID (Azure AD) Custom Security Attributes

For example, Bob added an ABAC condition to Charlie's role assignment, requiring that a resource attribute named Category be equal to Lighting to allow read access. This is a great way to simplify role assignments, especially when working with large teams or complex resources.

Including multiple expressions in a condition allows you to check against multiple values, depending on the operator. This can be particularly useful when working with attributes that have multiple possible values.

Calvin Connelly

Senior Writer

Calvin Connelly is a seasoned writer with a passion for crafting engaging content on a wide range of topics. With a keen eye for detail and a knack for storytelling, Calvin has established himself as a versatile and reliable voice in the world of writing. In addition to his general writing expertise, Calvin has developed a particular interest in covering important and timely subjects that impact society.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.