Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Access Policies vs RBAC in Azure
📖 Scenario: You are managing access to an Azure Key Vault in a small company. You want to control who can read secrets and who can manage the vault itself. Azure offers two ways to control access: Access Policies and Role-Based Access Control (RBAC).In this project, you will create a simple Azure Key Vault access setup using both Access Policies and RBAC to understand their differences and how they work.
🎯 Goal: Build an Azure Key Vault configuration that uses Access Policies to allow a user to read secrets and RBAC to assign a role to another user to manage the vault.
📋 What You'll Learn
Create an Azure Key Vault resource named myKeyVault.
Create an Access Policy that grants read permission on secrets to a user with object ID user-object-id-1.
Create an RBAC role assignment that assigns the Key Vault Contributor role to a user with object ID user-object-id-2.
Use valid Azure Resource Manager (ARM) JSON template syntax.
💡 Why This Matters
🌍 Real World
Managing access to Azure Key Vaults is a common task in cloud security to protect sensitive data like secrets and keys.
💼 Career
Understanding Access Policies and RBAC is essential for cloud administrators and security engineers working with Azure.
Progress0 / 4 steps
1
Create the Azure Key Vault resource
Create an Azure Key Vault resource named myKeyVault in the ARM template with the type Microsoft.KeyVault/vaults and API version 2019-09-01. Set the location to eastus and include an empty properties object.
Azure
Hint
Define the resource with the exact type, name, location, and apiVersion as specified.
2
Add an Access Policy for secret read permission
Inside the properties of myKeyVault, add an accessPolicies array with one object. This object must have tenantId set to 00000000-0000-0000-0000-000000000000, objectId set to user-object-id-1, and permissions with secrets containing get.
Azure
Hint
Remember to place the accessPolicies inside the properties object.
3
Add an RBAC role assignment for Key Vault Contributor
Add a new resource of type Microsoft.Authorization/roleAssignments with API version 2022-04-01. Set the name to a GUID string 11111111-1111-1111-1111-111111111111. Set properties with roleDefinitionId pointing to the built-in Key Vault Contributor role ID /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/00482a5a-887f-4fb3-b363-3b7fe8e74483 (use literal string as shown), and principalId set to user-object-id-2. This resource should be separate from the Key Vault resource.
Azure
Hint
Remember this is a separate resource object in the ARM template array.
4
Complete the ARM template with full resource array
Wrap the two resource objects (the Key Vault and the role assignment) inside a resources array in a full ARM template JSON structure. Include schema as https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json# and contentVersion as 1.0.0.0. The final template should have resources containing both the Key Vault and the role assignment.
Azure
Hint
Make sure the two resource objects are inside the resources array with the correct schema and contentVersion.
Practice
(1/5)
1. What is the main difference between Azure Access Policies and RBAC?
easy
A. RBAC controls network traffic; Access Policies manage user passwords.
B. Access Policies grant permissions directly on resources; RBAC assigns roles at scopes.
C. Access Policies are used only for virtual machines; RBAC is for databases.
D. RBAC is a legacy system; Access Policies are the modern replacement.
Solution
Step 1: Understand Access Policies
Access Policies give permissions directly on specific resources, like a key vault.
Step 2: Understand RBAC
RBAC assigns roles with permissions at different levels like subscription or resource group.
Final Answer:
Access Policies grant permissions directly on resources; RBAC assigns roles at scopes. -> Option B
Hint: Key vault secrets need access policies, not just RBAC [OK]
Common Mistakes:
Assuming RBAC alone controls key vault secrets
Thinking subscription-level RBAC restricts access
Believing portal restart fixes permission issues
5. You want to secure an Azure Key Vault so that only a specific user can read secrets, and a group can manage keys. Which approach follows best practices?
hard
A. Assign specific RBAC roles to the user for secret read (Key Vault Secrets User) and to the group for key management (Key Vault Crypto Officer).
B. Create an access policy granting the user secret read permission; assign an RBAC role to the group for key management.
C. Use access policies for both user and group to grant all permissions.
D. Assign the user an RBAC role for secrets and the group an access policy for keys.
Solution
Step 1: Choose RBAC as best practice
Azure recommends RBAC for Key Vault. Disable access policies and enable RBAC authorization on the Key Vault.
Step 2: Assign granular roles at Key Vault scope
Assign 'Key Vault Secrets User' role to user (get/list secrets). Assign 'Key Vault Crypto Officer' role to group (manage keys).
Final Answer:
Assign specific RBAC roles to the user for secret read (Key Vault Secrets User) and to the group for key management (Key Vault Crypto Officer). -> Option A
Quick Check:
RBAC Secrets User + Crypto Officer roles [OK]
Hint: RBAC best practice: Secrets User + Crypto Officer roles [OK]
Common Mistakes:
Trying to mix Access Policies and RBAC (not possible)
Using access policies for everything (legacy method)