Governance: management groups, Policy, locks and tags

AZ-104 Azure AdministratorIdentities and governanceAbout 25 minutesBy Cloud Hands On

Organise subscriptions, enforce standards with Azure Policy, protect resources with locks, and label everything with tags.

In this lesson you'll learn

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.

Tenant root group, management groups for production and development, subscriptions, resource groups and resources Tenant root group MG: Production MG: Development Sub: Retail-Prod Sub: Finance-Prod Sub: Dev-Test RG: rg-web Up to 6 levelsbelow root
Assign a policy to MG: Production and every subscription under it is covered, including new ones.
  • 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.

  1. Definition: the rule, such as "allowed locations" or "require a tag".
  2. Initiative: a bundle of definitions tracked together, such as an ISO 27001 baseline.
  3. Assignment: applies a definition or initiative to a scope, with optional parameters and exclusions.
EffectWhat happens
DenyThe deployment is blocked
AuditAllowed, but marked non-compliant
AppendAdds fields during create or update
ModifyAdds or changes properties and tags, and can fix existing resources
DeployIfNotExistsDeploys a missing related resource, such as a monitoring extension
AuditIfNotExistsFlags when a related resource is missing
New policies do not fix the past. Existing resources are only changed by a remediation task, which works with Modify and DeployIfNotExists.
Example: reading an assignment

Policy "Not allowed resource types" with parameter Microsoft.Sql/servers is assigned to Subscription1, with resource group RG-Data excluded.

  1. Scope: Subscription1. Exclusion: RG-Data.
  2. The rule denies SQL servers.
  3. 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

LockReadModifyDelete
CanNotDeleteYesYesNo
ReadOnlyYesNoNo
  • 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

Keep going