Governance: management groups, Policy, locks and tags
Organise subscriptions, enforce standards with Azure Policy, protect resources with locks, and label everything with tags.
In this lesson you'll learn
- The hierarchy from tenant root to resource, and how moves work
- Azure Policy definitions, initiatives, effects and remediation
- CanNotDelete and ReadOnly locks, and their side effects
- Tags, and why they are not inherited
1. The hierarchy
New to Azure governance? Start here
Azure organises everything into nested containers, like folders. Resources live in resource groups, which live in subscriptions (the billing unit), which can be grouped into management groups. Settings applied to a container flow down to everything inside it.
- Each subscription has exactly one parent management group.
- Moving a resource to another resource group or subscription never changes its region. The resource picks up the policies and access of its new scope, and its resource ID changes.
2. Azure Policy
Policy controls what can be deployed and how it must be configured. RBAC controls who can deploy. You need both.
- Definition: the rule, such as "allowed locations" or "require a tag".
- Initiative: a bundle of definitions tracked together, such as an ISO 27001 baseline.
- Assignment: applies a definition or initiative to a scope, with optional parameters and exclusions.
| Effect | What happens |
|---|---|
| Deny | The deployment is blocked |
| Audit | Allowed, but marked non-compliant |
| Append | Adds fields during create or update |
| Modify | Adds or changes properties and tags, and can fix existing resources |
| DeployIfNotExists | Deploys a missing related resource, such as a monitoring extension |
| AuditIfNotExists | Flags when a related resource is missing |
Example: reading an assignment
Policy "Not allowed resource types" with parameter Microsoft.Sql/servers is assigned to Subscription1, with resource group RG-Data excluded.
- Scope: Subscription1. Exclusion: RG-Data.
- The rule denies SQL servers.
- Result: SQL servers can be created only in RG-Data, and are blocked everywhere else in the subscription.
Exam focus
An exclusion removes a scope from evaluation. An exemption keeps it evaluated but marks it exempt, with a reason (waiver or mitigated) and an optional expiry date.
3. Resource locks
| Lock | Read | Modify | Delete |
|---|---|---|---|
| CanNotDelete | Yes | Yes | No |
| ReadOnly | Yes | No | No |
- Locks apply at subscription, resource group or resource level, not management groups.
- Locks override RBAC. Even an Owner must remove the lock first.
- Only roles with Microsoft.Authorization/locks permissions (Owner, User Access Administrator) can create or delete locks.
Example
A SS Kaiser admin puts a ReadOnly lock on the production storage account to be safe. The next morning, apps that list storage keys fail, because listing keys is a POST action that ReadOnly blocks. A CanNotDelete lock would have protected the account without breaking anything.
4. Tags
Tags are name and value pairs, such as CostCenter = Retail or Environment = Prod. They make it possible to filter resources and break down costs.
- Tags are not inherited. A tag on a resource group does not appear on its resources.
- To copy tags down automatically, use the built-in policy "Inherit a tag from the resource group if missing" (a Modify policy).
- Tags appear in cost data from the day they are applied, not retroactively.
Exam traps to remember
- Moving a resource never changes its region.
- Policy assignments do not change existing resources without remediation.
- Locks and tags work on subscriptions, resource groups and resources, not on management groups.
- ReadOnly on a storage account can block listing keys.
Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.
Practise in the app