Lab 02 – Role-Based Access Control (RBAC) & Azure Policy
⏱️Total Estimated Time: 45 minutes
Objectives
Assign built-in roles at different scopes (subscription, resource group, resource)
Create a custom RBAC role
Create and assign an Azure Policy definition and initiative
Use Policy to enforce tagging and allowed locations
Prerequisites
Owner or User Access Administrator on the subscription
Lab 01 users/groups (optional, can use any test user)
Estimated Time
45 minutes total
Part 1 – Create a Resource Group for This Lab
⏱️ 5 minutes
✓
Step 1: Create resource group
Search for Resource groups > Create
Subscription: your subscription. Resource group: rg-az104-lab02
Region: East US
Select Review + create > Create
ℹ️
Tip
Resource groups are free containers. Always organize resources into RGs by project, environment, or cost center.
Part 1 Validation
Part 2 – Assign Built-in Roles
⏱️ 10 minutes
Understanding RBAC Scopes
❗
Important
RBAC assignments inherit down the hierarchy: Subscription → Resource Group → Resource. An assignment at the RG level applies to all resources within it.
✓
Step 1: Assign Reader role at Resource Group scope
Go to rg-az104-lab02 > Access control (IAM) > Add > Add role assignment
Role tab: select Reader. Select Next
Members tab: Assign access to User, group, or service principal
Select members > choose grp-az104-lab (from Lab 01)
Review + assign
✓
Step 2: Assign Storage role at Resource scope
⚠️
Warning
Resource-level assignments are more restrictive. Bob here can only access this one storage account, not others in the RG.
Create a storage account (or use one from Lab 04)
Open the storage account > Access control (IAM) > Add role assignment
Role = Storage Blob Data Contributor > assign to Bob
This grants Bob access only at this storage account scope, not the whole RG
Part 2 Validation
Part 3 – Create a Custom Role
⏱️ 8 minutes
Why Custom Roles?
ℹ️
Tip
Built-in roles like "Virtual Machine Contributor" are too broad. Custom roles let you grant minimal permissions—only what's needed.
✓
Step 1: Start custom role
Go to the subscription > Access control (IAM) > Add > Add custom role
Basics tab:
Custom role name: VM Operator (Start/Stop only)
Description: Can start and restart VMs but not create or delete them
Baseline permissions: Clone a role > select Virtual Machine Contributor