Azure Policy, Locks, Tags and Management Groups: Enforce Rules and Organize Resources

Microsoft Certified Azure Administrator Associate AZ 103 55 min min read Updated: Nov 17, 2026 Intermediate
Azure Policy, Locks, Tags and Management Groups: Enforce Rules and Organize Resources
Intermediate Topic 1 of 3

Management Groups

  • A container above subscriptions. Policy and RBAC assigned here inherit to all subscriptions below
  • Up to six levels deep (not counting subscriptions). Every tenant has a root management group
  • Use to apply rules to many subscriptions at once
bash az account management-group create --name mg-prod --display-name "Production" az account management-group subscription add --name mg-prod --subscription <sub-id> az account management-group list -o table

Azure Policy

ConceptMeaning
DefinitionThe rule (condition and effect)
InitiativeA group of definitions
AssignmentApplies a definition or initiative to a scope
ComplianceReport of resources that meet or break the rule
RemediationFixes existing resources for modify and deployIfNotExists
EffectBehavior
DenyBlocks creation or change
AuditAllows but flags
Append / ModifyAdds or changes properties such as tags
DeployIfNotExistsDeploys a related resource if missing
DisabledOff
bash # Assign a built-in policy: allowed locations az policy assignment create --name allowed-locations --display-name "Allowed locations" \ --policy $(az policy definition list --query "[?displayName=='Allowed locations'].name | [0]" -o tsv) \ --params '{"listOfAllowedLocations":{"value":["centralindia","southindia"]}}' --scope /subscriptions/<sub-id> az policy state summarize --resource-group rg-demo az policy remediation create --name fix-tags --policy-assignment <assignment-id>
Policy is not RBAC RBAC controls who can act. Policy controls what is allowed, even for Owners. Policy evaluates when resources are created or updated, and on a regular schedule.

Resource Locks

LockEffect
CanNotDeleteCan read and change, cannot delete
ReadOnlyCan only read. Blocks changes (can have side effects, such as listing keys being blocked)
bash az lock create --name keep-rg --lock-type CanNotDelete --resource-group rg-prod az lock list -o table az lock delete --name keep-rg --resource-group rg-prod
  • Locks apply to everyone, including Owners. Remove the lock to delete
  • Locks inherit down the scope

Tags

bash az tag create --resource-id /subscriptions/<sub-id>/resourceGroups/rg-demo --tags CostCenter=1001 Environment=Dev az resource list --tag Environment=Dev -o table az group update -n rg-demo --set tags.Owner=Asha
  • Up to 50 tag name/value pairs per resource
  • Tags help cost reports, automation and ownership
  • Use a policy to require or inherit tags

Moving Resources

bash az resource move --destination-group rg-new --ids $(az resource show -g rg-old -n myvm --resource-type Microsoft.Compute/virtualMachines --query id -o tsv) az resource move --destination-group rg-new --destination-subscription-id <other-sub-id> --ids <resource-id>
  • Not every resource type can move. Validate first (portal does it)
  • Resources keep their region. The resource ID changes
  • Moving between subscriptions needs permissions on both sides and the same tenant

Azure Resource Graph

kql resources | where type == "microsoft.compute/virtualmachines" | summarize count() by location resources | where isnull(tags.Owner) | project name, type, resourceGroup

Practice

  1. Assign an Allowed locations policy and try to create a resource elsewhere
  2. Add a CanNotDelete lock and try to delete the group
  3. Find resources without an Owner tag using Resource Graph
  4. Move a storage account to another resource group

Conclusion

Use management groups to apply rules at scale, Azure Policy to enforce standards, locks to prevent accidents, tags to organize and Resource Graph to query everything quickly.

Quick Summary: management groups; Policy; locks; tags; moving; Resource Graph.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators