Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Authorization Using “Azure Role-Based Access Control” (Azure RBAC) in Azure Data Lake Storage Gen2

Oindrila Chakraborty
Dev Genius
Published in
9 min readMay 18, 2022

Introduction to Access Control Model in Azure Data Lake Storage Gen2

Data Lake Storage Gen2 supports the followingAuthorizationmechanisms -

A) Role-Based Access Control (Azure RBAC) - Azure RBAC grantscoarse-grainaccess to Storage Account data, like - Read or Write access to All of the data in a Storage Account.

B) Access Control Lists (ACL) - ACLs grantfine-grainedaccess, such as - Write access to a specific Directory or File.

Both the “Authorizationmechanisms, i.e., Azure RBAC and ACL, require the user, or, the application to have an Identity in Azure AD.

Shared Access Key grants access to a user, or, an application without requiring to have an Identity in Azure Active Directory (Azure AD). With these two forms of “Authentication”, the “Azure RBAC” and “ACLs” have no effect.

What is Role-Based Access Control (Azure RBAC)

Access Management for Cloud Resources is a critical function for any organization that is using the Cloud. Azure Role-Based Access Control (Azure RBAC) helps to manage -

  • Which User” has “Access” to Azure Resources
  • What the “User” can “Do” with those Azure Resources
  • What “Areas” the “User” has “Access” to

Following are examples of some of the Scenarios that can be done using Role-Based Access Control (Azure RBAC) with -

  • Allow one User to Manage the Virtual Machines in a Subscription and another User to Manage the Virtual Networks.
  • Allow a DBA Group to Manage the SQL Databases in a Subscription.
  • Allow a User to Manage All the Resources in a Resource Group, such as Virtual Machines, Websites, and, Subnets.

Allow an Application to Access All the Resources in a Resource Group.

How Azure Role-Based Access Control (Azure RBAC) Works

The way to control Access to Azure Resources using the Azure Role-Based Access Control (Azure RBAC) is to Assign the Azure Roles. This is howPermissions” are Enforced. A “Role Assignmentconsists of the following three elements -

A) Security Principal - A “Security Principal” is an Object that represents a “User”, “Group”, “Service Principal”, or, “Managed Identity” that is “Requesting” the “Access” to an Azure Resource.

A “Role” can be Assigned to any of these “Security Principals”.

B) Role Definition - A “Role Definition” is a “Collection of Permissions”. It is typically just called a “Role”. A “Role Definitionlists the Actions that can be Performed, such as - “Read”, “Write” and “Delete”. “Roles” can be High-Level, like - “Owner”, or, can be Specific, like - “Virtual Machine Reader”.

Built-In Role - Azure has severalBuilt-In Roles” that can be used. Example - the “Virtual Machine ContributorRole allows a User to “Create” and “Manage” the Virtual Machines.
If the “Built-In Rolesdon’t meet the specific needs of the organizations, then the Azure Admin of the respective organizations can createAzure Custom Roles”.

Azure has “Data Actions” that enables to grantAccess” to Data within an “Object”. Example - if a User has “ReadData Access to a Storage Account, then that User can “Read” the “Blobs”, or, “Messageswithin that Storage Account.

C) Scope - “Scope” is the “Set of Resourcesthat the “Accessapplies to. When a “Role” is “Assigned”, the “Actionsallowed by that “Role” can be furtherLimited” by defining a “Scope”. It is important to understand the “Scope” so that the Azure Admin can grant a “Security Principal” just the “Access” that it really needs. ByLimiting the Scope”, the Azure Admin can “Limit” what “Resources” are at Risk, if the “Security Principal” is ever “Compromised”.

Scope Levels - In Azure, it is possible to specify a “Scope” at four levels -

1. Management Group
2. Subscription
3. Resource Group
4. Resource

Scopes” are structured in a “Parent-ChildRelationship. Each Level of Hierarchy makes the “Scope” more specific. It is possible to “Assign” the “Roles” at any of these “Levels” of “Scope”. The selectedLeveldetermines how widely the “Role” is applied. “Lower Levelsinherit the “Role Permissions” from the “Higher Levels”.

Azure Role Assignment Using Role-Based Access Control (Azure RBAC)

A “Role Assignment” is the Process of attaching a “Role Definitionto a “User”, “Group”, “Service Principal”, or, “Managed Identity” at a particularScope” for the purpose of grantingAccess”.

  • Access” is “Granted” by “Creating” a “Role Assignment”.
  • Access” is “Revoked” by “Removing” a “Role Assignment”.

Following diagram shows an example of a “Role Assignment”. In the example, the “Marketing Group has been Assigned the “ContributorRole for the “Pharma-SalesResource Group. This means that “Users” in the “MarketingGroup can “Create” or “Manage” any Azure Resource in the “Pharma-SalesResource Group. “MarketingUsers do not haveAccess” to “Resourcesoutside the “Pharma-SalesResource Group, unless the Users are Part of anotherRole Assignment”.

It is possible to “Assign” the “Rolesusing the “Azure Portal”, “Azure CLI”, “Azure PowerShell”, “Azure SDKs”, or, “REST APIs”.

Transitive Role Assignment in Group - “Role Assignments” are “Transitive” for the “Groupswhich means that if a “User” is a “Member” of a “Group” and thatGroup” is a “Member” of anotherGroupthat has a “Role Assignment”, then that “User” will have the “Permissions” in the “Role Assignment”.

Multiple Role Assignments - Azure RBAC is an “Additive Model”. So, if a “User” has multipleOverlapping Role Assignments”, the “Effective Permissions” for that “User” are the “Sum” of the “Role Assignments”.

Following diagram shows an example of a “Multiple Role Assignment”. In the example, a “User” is “Granted” the “ContributorRole at the “SubscriptionScope, and, the “ReaderRole at the “Resource GroupScope. The “Sum” of the “ContributorPermission and the “ReaderPermission is “Effectively” the “ContributorRole for the “SubscriptionScope. Therefore, in this case, the “ReaderRole Assignment has no impact.

Azure Deny Assignment Using Role-Based Access Control (Azure RBAC)

PreviouslyAzure RBACwas an “Allow-Only ModelwithNo Deny”, but, nowAzure RBACsupports the “Deny Assignments” in a “Limitedway.

A “Deny Assignmentdefines a “Set of Actionsthat are “Not Allowed” and attaches that “Set of Deny Actionsto a “User”, or, a “Group”, or, a “Service Principal”, or, a “Managed Identity” at a particularScope” for the purpose of “Denying Access”. In other words, “Deny Assignmentsblock the “Usersfrom performing specifiedActions”, even if a “Role Assignmentgrants the “Users” some other “Accesses”, because, “Deny Assignments” take “Precedenceover the “Role Assignments”.

How Azure Role-Based Access Control (Azure RBAC) Determines If a User Has Access to an Azure Resource

The following are the High-Level steps that “Azure RBACuses to determine if a “UserhasAccessto an “Azure Resource”. These steps apply toAzure Resource Manager” or “Data Plane Services”, integrated withAzure RBAC”.

Step 1 - A “User”, or, a “Service Principalacquires a “Tokenfor the “Azure Resource Manager”.

The “Tokenincludes the “User’s Group Memberships” (includingTransitive Group Memberships”).

Step 2 - The “Usermakes a “REST APIcall to the “Azure Resource Managerwith the “Tokenattached.

Step 3 - “Azure Resource Managerretrieves all the “Role Assignments” and the “Deny Assignmentsthat are applied to the concernedAzure Resource”, upon which the “Action” is being taken.

Step 4 - If a “Deny Assignment” is applied on the concernedAzure Resource”, the “Access” is “Blocked”. Otherwise, the “Evaluationcontinues.

Step 5 - “Azure Resource Managernarrows down the “Role Assignmentsthat are applied to the “User”, or, theirGroup”, and, determines whatRoles” the “Userhas for the concernedAzure Resource”.

Step 6 - The “Azure Resource Managerdetermines if the “Action” in the “APIcall is “Included” in the “Roles” the “Userhas for the concernedAzure Resource”.

If the “RolesincludeActionsthat have a “Wildcard” (“*”), the “Effective Permissions” are computed by “Subtracting” the “NotActionsfrom the allowedActions”. Similarly, the sameSubtraction” is done for any “DataActions”.

  • Effective Management Permissions = Actions — NotActions
  • Effective Data Permissions = DataActions — NotDataActions

Step 7 - If the “Userdoesn’t have a “Rolewith the “Actionat the requestedScope”, “Access” in “Not Allowed”. Otherwise, anyConditions” are “Evaluated”.

Step 8 - If the “Role AssignmentsincludeConditions”, those are “Evaluated”. Otherwise, “Access” is “Allowed”.

Step 9 - If the “Conditions” are met, “Access” is “Allowed”. Otherwise, “Access” in “Not Allowed”.

The following diagram is “Summary” of the “Evaluation Logic” -

Add, and, View the Role Permissions in an Azure Data Lake Storage Gen2 Instance

In every Azure resource, e.g., Azure Data Lake Storage Gen2, there is a feature called “Access control (IAM)”. “IAMstands for “Identity and Access Management”. Using this feature the “Role Permissionsapplied to the concernedAzure Resource” can be added, as well as, viewed.

To assign a “Role” of “Contributor” on the Azure Data Lake Storage Gen2 instance “adlsoindrila2022marchfor the Azure Data Factory Instance “ADF-Oindrila-2022-Marchusing the “Managed IdentitySecurity Principal, perform the following steps -

Step 1 - Open Azure Data Lake Storage Gen2 instance “adlsoindrila2022march”. Click on the “Access Control (IAM)link.

Step 2 - Click on+ Addbutton, followed by, click onAdd role assignmentlink, or, click on the “Add role assignmentbutton from the “Grant access to this resourcetile.

Step 3 - In the “Add role assignmentpage, underRoletab for the Azure Data Lake Storage Gen2 instance “adlsoindrila2022march”, it can be seen that, there are more than 60 built-in Roles in Microsoft Azure.

The “Roles” will vary depending on the specific Resource on which the “Role Assignment” is being set upon, e.g., the “Roles available for Storage Account are different than the “Roles available for Virtual Machines.

Step 4 - Select the “ContributorRole from the options, and, click on the “Nextbutton.

Step 5 - In the “Memberstab, select the RadiobuttonManaged identityfor the propertyAssign access to”. Then, click on the link+ Select membersfor the propertyMembers”.

Step 6 - In the opened bladeSelect managed identities”, select the properSubscription” to use from the DropdownSubscription”, and, selectData factory (V2) (1)” from the DropdownManaged identity”.

Upon selecting the properManaged Identity”, the “Managed Identityinformation for the Azure Data Factory Instance “ADF-Oindrila-2022-March” is displayed under the DropdownSelect”.

Upon selecting the displayedManaged Identityinformation for the Azure Data Factory Instance “ADF-Oindrila-2022-March”, the same information gets displayed under the “Selected memberssection. Click on the “Selectbutton.

Now, the “Managed Identity” of the Azure Data Factory Instance “ADF-Oindrila-2022-March” is selected as the “Member” in the “Memberstab of the “Add role assignmentpage. Then, click on the “Review + assignbutton.

Next, review if the following information regarding the “Role Assignment” is correct, or, not in the “Review + assigntab -

  • Role” to be “Assigned”.
  • The “Scopewhere the “Role” is being “Assigned”.
  • Managed Identityinformation of the Azure Data Factory Instance “ADF-Oindrila-2022-March”.

Finally, click on the “Review + assignbutton.

To verify if the “Role” of “Contributor” is properly assigned on the Azure Data Lake Storage Gen2 instance “adlsoindrila2022marchfor the Azure Data Factory Instance “ADF-Oindrila-2022-Marchusing the “Managed IdentitySecurity Principal, perform the following steps -

Step 1 - Open Azure Data Lake Storage Gen2 instance “adlsoindrila2022march”. Click on the “Access Control (IAM)link.

Step 2 - Click onRole assignmentstab. All the “Role Assignmentson the Azure Data Lake Storage Gen2 instance “adlsoindrila2022march” are displayed -

--

--

I have 11+ experience in IT industry. I love to learn about the data and work with data. I am happy to share my knowledge with all. Hope this will be of help.