Lab 3: Governance Practice With Tags, Resource Locks, Azure Policy and RBAC Reader Role
Goal
Practice four governance tools on one resource group.
Step 1: Create a Group With Tags
bash
az group create --name rg-lab3 --location centralindia --tags env=lab owner=student
az group show --name rg-lab3 --query tags
Step 2: Create a Storage Account and Tag It
bash
az storage account create --name stlab3demo12345 --resource-group rg-lab3 --location centralindia --sku Standard_LRS --tags env=lab cost-center=training
Tag note Tags on the group are not inherited by its resources. Each resource has its own tags.
Step 3: Add a Delete Lock
bash
az lock create --name no-delete --lock-type CanNotDelete --resource-group rg-lab3
az storage account delete --name stlab3demo12345 --resource-group rg-lab3 --yes
The delete command fails because of the lock. Remove it before cleanup:
bash
az lock delete --name no-delete --resource-group rg-lab3
Step 4: Assign Azure Policy (Allowed Locations)
- In the portal search Policy, then Assignments, then Assign policy
- Scope: the resource group
rg-lab3 - Policy definition: Allowed locations
- Parameters: choose Central India only
- Create the assignment and wait a few minutes
Step 5: Test the Policy
bash
az storage account create --name stlab3other12345 --resource-group rg-lab3 --location eastus --sku Standard_LRS
The request is denied by policy because East US is not allowed.
Step 6: Look at Access (RBAC)
- Open rg-lab3, then Access control (IAM)
- Click Role assignments and see who has Owner
- Click Roles and read the description of Reader and Contributor
- If you have a second test user, give Reader and confirm they cannot create anything
Step 7: Clean Up
- Delete the policy assignment from Policy, Assignments
- Make sure the lock is removed (Step 3)
- Delete the group
bash
az group delete --name rg-lab3 --yes --no-wait
Questions
- Why did the delete fail even though you are Owner?
- Which tool blocked the East US storage account?
- Are tags on a group inherited by resources?
Conclusion
You used tags, a delete lock, an allowed-locations policy and RBAC views to practice Azure governance.
Quick Summary: tags; storage; lock; policy; test; RBAC; cleanup.

