Azure Landing Zone Hour 2: Resource Organization and Governance — Subscriptions, Naming, and Azure Policy

In hour 1 you built the management group hierarchy and reviewed the big picture of the ALZ default policies. This hour zooms in: how to split subscriptions, how to name and tag resources, how each part of Azure Policy works, how policies are evaluated, remediation and exemptions, and how to use compliance data and Resource Graph to prove that the platform is really governed
ALZ library platform/alz/2026.11.0alz provider 0.22.1 · avm-ptn-alz 0.23.0Azure Policy · Resource GraphVerified against official docs · 2026-11-18
Lab safety notice Run all labs in this hour in a dedicated sandbox Entra tenant (a new free tenant or a lab tenant provided by your company). Do not run labs in a production tenant. This hour creates policy definitions, assignments, remediation tasks, and exemptions on management groups such as alz and landingzones. Deny and DenyAction will block requests for real. You get Owner on the root management group by elevating access through “Access management for Azure resources” in Entra. Revoke it when the lab is finished.
Overall learning goals
  • Explain why subscriptions are the scale unit of ALZ (the boundaries for scale, quotas, policy, billing, and RBAC). Plan subscriptions for platform and application landing zones, place them in the right management groups, and describe a fallback for when you have only one subscription.
  • Write a naming and tagging standard (CAF abbreviation + workload + environment + region), and enforce it with Azure Policy: resource groups must have a costCenter tag, and resources inherit tags from their resource group automatically.
  • Break down Azure Policy into definitions, initiatives, assignments, parameters, and scopes. Write a custom definition and initiative, assign them on a management group, and understand notScopes, definitionVersion, overrides, and resourceSelectors.
  • Explain the 11 effects in the official evaluation order: disabled → append / modify → deny → audit → manual → auditIfNotExists → denyAction, plus auditIfNotExists and deployIfNotExists after a request succeeds. Use DenyAction to prevent accidental deletion.
  • Use remediation tasks + managed identities to fix existing resources. Handle exceptions with exemptions (Waiver / Mitigated, expiration dates, and policy components), and distinguish exemptions from exclusions.
  • Read the folder structure, calendar-based version numbers, and upgrade process of the ALZ policy library (Azure-Landing-Zones-Library). Know how to change default assignments without forking the library.
  • Use az policy state and Azure Resource Graph (policyresources, resourcecontainers, resources) to build compliance and tag reports across management groups, and complete one governance review.

1-hour timetable

#TimeModuleCore contentAnimation / interactionLab (sandbox tenant)
0Before classWarm-upCheck the hour 1 management group hierarchy, subscription placement, and permissions. Starting point if you have only one subscriptionEnvironment checklistStarting script (creates missing hierarchy)
100–06Subscription designSubscription = boundary for scale / policy / billing / RBAC; platform vs. application subscriptions; limits; subscription placement; subscription vending; tenant transfer restrictionsSubscription placement simulator (which assignments it inherits)Place 4 subscriptions in the right management groups and verify
206–13Naming and tagsCAF abbreviations and naming patterns, name length limits, four required tags, tag inheritance, and cost allocationName generator + validatorEnforce the costCenter tag on resource groups + resource tag inheritance
313–21Policy deep diveDefinition structure (mode, parameters, aliases, conditions), initiatives, assignment properties, definition location, and assignment scope rulesScope resolver: which assignments apply to a given resourceCustom definition + initiative, DoNotEnforce trial run
421–28EffectsThe 11 effects, evaluation order, and real behavior of Deny / Audit / Modify / DINE / DenyActionCore animation: how a request moves through the ARM and policy engine evaluation pipelineDeny blocks, Modify rewrites, DenyAction prevents deletion
528–35Remediation and exemptionsRemediation task parameters, managed identity permissions, exemption categories and expiration, exclusions vs. exemptionsRemediation task execution simulatorFix tags on existing resources; create a time-limited exemption for one resource
635–42ALZ policy libraryLibrary folder structure, archetypes and architectures, version tags, library_references in the alz provider, upgrades and customizationLibrary resolution and version upgrade comparisonReview library contents and compare 2026.10.0 with 2026.11.0
742–50Compliance and Resource GraphCompliance state and percentages, evaluation triggers, on-demand scans, ARG tables and KQL, throttling and pagingKQL query builderCompliance and missing-tag reports across management groups
850–60Governance reviewReview checklist, 10 common mistakes, troubleshooting decision treeGovernance review scorecard + troubleshooting treeRun a review on the lab tenant and fix the issues
—After classCheat sheet · Capstone labDeliver a governance baseline for the myapp application landing zoneFinal quiz: 12 questionsCapstone lab

Knowledge Coverage Matrix

Target skillM1M2M3M4M5M6M7M8Key commands / fieldsLab
Subscription planning and placement✓·✓··✓✓✓az account management-group subscription addPlace 4 subscriptions
Naming and tagging standards·✓✓✓✓·✓✓tags, field('name'), like / matchcostCenter enforcement and inheritance
Write definitions and initiatives·✓✓✓·✓·✓az policy definition create, set-definition createlab-gov-baseline
Assignments, parameters, and scopes✓✓✓·✓✓·✓--scope, --not-scopes, --enforcement-modeDoNotEnforce trial run
Effects and evaluation order·✓✓✓✓✓·✓then.effect, detailsDeny / Modify / DenyAction
Remediation and managed identities·✓·✓✓✓·✓az policy remediation create, roleDefinitionIdsFixing tags on existing resources
Exemptions and exception management··✓·✓·✓✓az policy exemption createTime-limited Waiver
ALZ library and version upgrades···✓·✓·✓library_references, definitionVersionVersion comparison
Compliance reporting and Resource Graph✓✓··✓·✓✓az policy state, az graph queryCross-MG reporting

What this hour does not cover (and where to learn it)

TopicWhy it is not in this hourWhere to learn it
CAF stages, ALZ design areas, where the management group hierarchy comes from, comparison of deployment optionsCovered in hour 1. This hour uses its results directlyHour 1
Azure RBAC, custom roles, PIM, workload identity federationIdentity and access get their own hour. This hour covers only the managed identity permissions that remediation tasks needHour 3
Network details of Private DNS zone DINE policies, Firewall, UDRBelongs to network topologyHour 4
DINE policy details for Defender for Cloud, AMA, and DCR; cost management reportsBelongs to management and monitoringHour 5: Management and Monitoring
Policy-as-code pipeline (EPAC, full avm-ptn-alz deployment), subscription vending moduleNeeds the automation background from hour 6Hour 6: Automation
Terraform syntax, azurerm / azapi basicsPrerequisite courseTerraform in 8 Hours

How to use this course material

10 pages per module
Theory · diagrams · animation · commands · lab · production case · troubleshooting · quiz · voice · video. The animation in Module 4 is the core of this hour: how a request passes through disabled, modify, deny, audit, denyAction, and then DINE after the request completes.
Learning progress
A module counts toward your progress when you score ≥ 70% on its quiz or click “Mark this module complete.” Progress is saved in this browser. If local storage is blocked, progress is cleared on refresh.
English voice narration
The “Voice” tab reads the script aloud with the browser’s built-in Web Speech API (en-US). If no English voice pack is installed, you can still read the script or pass it to another TTS tool.
Version note This hour uses the Azure-Landing-Zones-Library platform/alz/2026.11.0 (released 2026-11-06), the Terraform provider Azure/alz 0.22.1, the module Azure/avm-ptn-alz/azurerm 0.23.0, and Azure CLI 2.x (az policy and az graph extensions) as its baseline. Verified on 2026-11-18. (The date in the sidebar is the date the page skeleton was generated.) Platform facts that matter for this hour: there are 11 policy effects (including denyAction, manual, addToNetworkGroup, and mutate). Assignments support definitionVersion, overrides, resourceSelectors, and the new Enroll enforcement mode. The ALZ default hierarchy has 12 management groups (including security and local). None of the cloud commands were run against a real tenant. All output is sample output.

Module 0 · Warm-up: management group hierarchy and policy starting point

Confirm that the ALZ management group hierarchy, subscriptions, and permissions from hour 1 still work. If you don't have the results from the previous hour, follow the starting steps on this page to set them up
Before class ≈ 10 minutesAzure CLISandbox tenant
Prerequisites
  • You have completed Hour 1. The sandbox tenant has an intermediate root management group alz (display name “Azure Landing Zones”) with these child management groups: platform (with security, management, connectivity, and identity under it), landingzones (with corp, online, and local under it), sandbox, and decommissioned. These IDs match the official ALZ library defaults and have no prefix. Only the intermediate root is called alz.
  • Subscriptions (ideal case): sub-alz-management, sub-alz-connectivity, sub-alz-identity, and sub-lz-corp-myapp. CAF also recommends a dedicated security subscription (optional; this hour calls it sub-alz-security).
  • Permissions: Owner on the alz management group (or at least Resource Policy Contributor + User Access Administrator, to grant permissions to the remediation task's managed identity).
  • Tools: Azure CLI 2.x (az version), az extension add --name resource-graph, jq, git. Terraform 1.x is optional for Module 6.
  • Prerequisite courses: Terraform in 8 Hours (IaC basics), and hour 3 of any CI platform course (OIDC and deployment identity, such as GitHub hour 3).

Connecting to Hour 1

What hour 1 left youHow to use this hour
Management group hierarchy (12 MGs)Module 1 places subscriptions in it. The assignment scopes in Module 3 are all these MGs
Overview of the ALZ default policies (root: 17 assignments, landingzones: 53, corp: 5…)Module 4 uses its Deny and DenyAction examples. Module 6 explains where these assignments come from and how they are upgraded
Deployment options (IaC Accelerator, avm-ptn-alz)This hour uses the Azure CLI to demonstrate policy mechanics. Module 6 shows how the same things are expressed in the alz provider
Resource naming convention rg-alz-mgmt-cc, vnet-hub-cc…Module 2 turns it into a standard and enforces it with policy

Starting steps (if you don't have the Hour 1 results)

# 0) Sign in to the sandbox tenant (do not sign in to the production tenant!)
az login --tenant <sandbox-tenant-id>
az account show --query "{tenant:tenantId, user:user.name}" -o table

# 1) Elevate access as a Global Administrator (this gives you User Access Administrator on the root "/"), then assign yourself Owner on the root MG
az rest --method post --url "/providers/Microsoft.Authorization/elevateAccess?api-version=2016-07-01"
TENANT_ID=$(az account show --query tenantId -o tsv)
ME=$(az ad signed-in-user show --query id -o tsv)
az role assignment create --assignee "$ME" --role Owner --scope "/providers/Microsoft.Management/managementGroups/$TENANT_ID"

# 2) Create the minimum hierarchy (matches the ALZ default IDs)
az account management-group create --name alz --display-name "Azure Landing Zones"
for mg in platform landingzones sandbox decommissioned; do
  az account management-group create --name $mg --display-name "${mg^}" --parent alz
done
for mg in security management connectivity identity; do
  az account management-group create --name $mg --display-name "${mg^}" --parent platform
done
for mg in corp online local; do
  az account management-group create --name $mg --display-name "${mg^}" --parent landingzones
done
{
  "displayName": "Azure Landing Zones",
  "id": "/providers/Microsoft.Management/managementGroups/alz",
  "name": "alz",
  "type": "Microsoft.Management/managementGroups"
}

Tip: ${mg^} is the bash syntax for capitalizing the first letter, and it is used only for display names. The official display name for landingzones is “Landing zones.” To fix it, run az account management-group update --name landingzones --display-name "Landing zones".

Fallback when you have only one subscription

You can complete this hour with one subscription. Place your only subscription (still called sub-lz-corp-myapp below) under the corp management group. Put all platform resources (such as rg-alz-mgmt-cc) in this subscription too. Do all policy labs on the landingzones / corp management groups. The results are the same as with multiple subscriptions. Only the “subscription placement” in Module 1 and the cross-subscription report in Module 7 will show a single row. Do not place this subscription under platform, or the application landing zone assignments later in the hour will not apply to it.

Self-check checklist

az account management-group show --name alz --expand --recurse \
  --query "children[].{name:name, children:children[].name}" -o json
az account management-group entities list --query "[?type=='/subscriptions'].{sub:displayName, parent:parent.id}" -o table
az policy assignment list --scope /providers/Microsoft.Management/managementGroups/alz --query "length(@)"
az extension add --name resource-graph --upgrade 2>/dev/null; az graph query -q "resourcecontainers | summarize count() by type" -o table
[
  { "name": "platform",     "children": ["security","management","connectivity","identity"] },
  { "name": "landingzones", "children": ["corp","online","local"] },
  { "name": "sandbox",      "children": null },
  { "name": "decommissioned","children": null }
]
Sub                   Parent
--------------------  ------------------------------------------------
sub-alz-management    /providers/Microsoft.Management/managementGroups/management
sub-alz-connectivity  /providers/Microsoft.Management/managementGroups/connectivity
sub-alz-identity      /providers/Microsoft.Management/managementGroups/identity
sub-lz-corp-myapp     /providers/Microsoft.Management/managementGroups/corp
0
Type                                              Count_
------------------------------------------------  ------
microsoft.management/managementgroups             13
microsoft.resources/subscriptions                 4
microsoft.resources/subscriptions/resourcegroups  6
  • ☐ 4 child MGs under alz, 4 under platform, and 3 under landingzones (12 MGs + the tenant root = 13).
  • ☐ Subscriptions are in the correct MGs. (If you built only the hierarchy in hour 1 and did not place subscriptions, the Module 1 lab completes this step.)
  • ☐ Number of assignments on alz: 0 if you built only the hierarchy; 17 if you deployed the ALZ default policies with the accelerator in hour 1. This hour works in both cases. All lab assignments start with lab- to make cleanup easier.
  • ☐ az graph query returns results (confirms the resource-graph extension is installed and permissions are correct).

Module 1 · Subscription design: subscriptions as scale units, limits, and placement

00:00 – 06:00 · A subscription is not just “a bill.” It is the boundary for scale, quotas, policy, RBAC, and billing. The management group it sits in decides which dozens of policies it inherits
6 minutesCAF subscription design areaSubscription-level evaluation completes about 30 minutes after placement★★★★★
Learning goals
  • Name the five dimensions of a subscription as a boundary: scale / quotas, policy, RBAC, billing, and networking (a VNet cannot span subscriptions; it can only be peered).
  • Plan platform subscriptions (management, security, connectivity, and identity, each separate) and application landing zone subscriptions (by workload + environment) following CAF guidance, and place them in the right management groups.
  • Remember the key limits: 980 resource groups per subscription, 50 tags per resource, 800 deployment history entries, and up to 6 levels of MG hierarchy (not counting the root and subscription levels).
  • Use the CLI to move subscriptions, set the default management group and the “require authorization” hierarchy setting, and know how long policies take to apply after a subscription moves.
Prerequisite: the management group hierarchy from hour 1. Importance: ★★★★★ (if you split subscriptions wrong, every later policy and network design has to be reworked)

What: what a subscription is in ALZ

In CAF, a subscription is the unit of management, billing, and scale. A resource must belong to a resource group, a resource group must belong to a subscription, and a subscription can sit under only one management group (each MG or subscription has exactly one parent). One of the ALZ design principles, subscription democratization, means treating subscriptions as “standard units delivered to application teams,” rather than having the platform team squeeze everything into a few large shared subscriptions.

BoundaryWhat it meansImpact on design
Scale / quotasQuotas such as vCPUs, public IPs, and storage accounts are counted per subscription + region. Resource group counts, deployment history, and similar limits are hard limits at the subscription levelLarge workloads (HPC, SAP, IoT) get their own subscription to avoid competing with other workloads for quota
PolicyA subscription inherits all policy assignments on its MG chain. You can also assign policies directly on the subscriptionPCI, production, and development need different policies → different subscriptions / different MGs
RBACA subscription Owner can manage everything in it (including role assignments)One subscription per team gives clear permission boundaries. Platform subscriptions go only to the platform team
BillingA natural dimension for bills, budgets, and cost analysisPlatform costs and each application's costs can be separated without relying on tags
NetworkingA VNet belongs to a subscription and cannot be shared across subscriptions. It can only be peered or connected through a hubWorkloads that need to reach each other are planned in the same hub-and-spoke topology (hour 4)

Why: why not put everything in one big subscription

  • Hard limits will hit you: up to 980 resource groups per subscription; 800 deployment history entries per subscription; up to 800 instances of each resource type in a resource group (some types are exceptions).
  • Policies cannot be differentiated: resources in the same subscription can only be told apart with resource group–level assignments or notScopes. At scale, this turns into exception hell.
  • Permissions cannot be contained: a subscription Owner has every permission. If you put the platform's Firewall and an application's VMs in the same subscription, any application Owner can change the Firewall.
  • Costs stay unclear: you can only allocate costs with tags, and tags always have gaps (Module 2 covers how to fix them).

How: subscription planning in ALZ

Subscription (name used in this course)Placed in which MGWhat it hostsNotes
sub-alz-managementmanagementLog Analytics (law-alz-mgmt-cc), automation, monitoring and alertsCAF: required
sub-alz-connectivityconnectivityHub VNet, Firewall, VPN / ExpressRoute gateways, private DNS zonesCAF: required
sub-alz-identityidentityDomain controllers (if needed), Entra Domain ServicesCAF: recommended. You can skip it if you have no AD DS requirements
sub-alz-security (optional)securityMicrosoft Sentinel, SIEM integrationSince CAF 2025-12, a separate security subscription is recommended
sub-lz-corp-myappcorpmyapp spoke VNet, application resourcesWorkloads that need internal access / are not directly exposed to the internet
sub-lz-online-*onlineInternet-facing workloadsDoes not inherit corp's “no public internet” policy
sub-sbx-<user>sandboxPersonal labsIsolated from corp's network (sandbox policies block VNet peering, among others)

What about dev / test / prod? CAF recommends separating environments with different subscriptions, but placing them under the same management group (for example, the myapp dev and prod subscriptions both under corp). Do not create one MG per environment. Express environment differences with subscription-level assignments or parameters, and keep the hierarchy at 3–4 levels.

Subscription vending: use a pipeline and IaC (such as Terraform modules or Bicep) to fulfill “I need a landing zone” requests. The pipeline creates the subscription (using the subscription alias API), places it in the target MG, creates a spoke VNet and peers it to the hub, grants the team RBAC, and sets budgets and tags. Hour 6 implements this. For this hour, remember: subscription placement should be part of the vending process, not done by hand.

Where new subscriptions go by default: they land in the tenant root management group, which means “not subject to any ALZ policy.” In the hierarchy settings, change the default management group to sandbox (or a dedicated holding MG), and turn on “require authorization to create management groups.” This stops stray subscriptions and ad hoc MGs.

Tenant transfer restrictions: CAF recommends setting both “Subscriptions leaving Microsoft Entra directory” and “Subscriptions entering Microsoft Entra directory” to Permit no one. Add exempted users only for platform operations and emergency access accounts. (These are subscription policies in Cost Management, not Azure Policy.)

When: when you need a new subscription

SignalRecommendation
New workload, new team, new environmentVend a new application landing zone subscription
The vCPU quota for a region in an existing subscription has been raised several times and is still not enoughSplit the subscription, or use Quota Groups to share quota across subscriptions
Different compliance requirements (PCI, data sovereignty)Separate subscription, and a separate MG if needed
Only one more regionNo new subscription needed. Subscriptions are not tied to a region. Use different resource groups to separate them
Active-passive regional disaster recovery (same workload)Usually the same subscription. Split only if it is active-active and has an independent lifecycle
Common misconceptions ① “One subscription per region.” Subscriptions are global. CAF recommends splitting by region only when there are regional governance requirements or quota bottlenecks. ② “Create one MG each for dev and prod.” Environment differences belong at the subscription level. Group MGs by policy needs. ③ “Quota guarantees capacity.” Quota is only a ceiling. It does not guarantee capacity in a region. For critical capacity, use capacity reservations. ④ “Policies take effect as soon as the subscription moves into an MG.” Subscription-level evaluation for subscription resource types takes about 30 minutes. Resource-level compliance waits for the next evaluation. ⑤ “Merging the platform subscriptions into one is simpler.” CAF explicitly recommends against this. Otherwise you cannot set separate policies and RBAC for management, connectivity, and identity, and you cannot separate billing.

Architecture diagram: where subscriptions sit in the ALZ hierarchy

Tenant root group alzroot: 17 assignments platform40 assignments landingzones53 assignments sandbox1 assignment decommissioned1 assignment security management connectivity identity·4 corp·5 online·0 local·1 sub-alz-management sub-alz-connectivity sub-alz-identity sub-lz-corp-myappInherits 17+53+5=75 sub-sbx-aliceInherits 17+1
Figure 1-1: A subscription placed under a leaf management group inherits the assignments along the whole MG chain. The numbers are the assignment counts on each MG when the full ALZ library 2026.11.0 default policies are deployed.

Comparison: one subscription vs. multiple subscriptions

One large subscription • Platform and application resources mixed together; subscription Owner = full control • Policies can only be separated by resource group–level assignments / notScopes • Shares the 980 resource group and 800 deployment history limits • Costs can only be allocated with tags Split by responsibility + workload • Platform subscriptions are granted only to the platform team; application teams own their subscriptions • Placing a subscription in an MG inherits the correct set of policies • Quotas and limits are per subscription, which makes scaling easier • Each subscription is a cost center, so bills are naturally separate
Figure 1-2: The subscription is the ALZ “scale unit.” To add capacity, vend more subscriptions instead of making one subscription bigger

Interactive animation: subscription placement simulator

Choose a subscription and a target management group, then play through the “move subscription” process: permission check → update the parent → ARM hierarchy cache refresh → subscription-level evaluation → resource-level compliance update. The panel on the right calculates how many ALZ default assignments it will inherit (adding up the per-MG assignment counts from library 2026.11.0).

First select a subscription, then select a target management group.
$ az account management-group subscription add --name <mg> --subscription <sub>

Core commands and parameters

CommandPurposeKey parameters / notes
az account management-group subscription addMove a subscription to an MG--name <mg> --subscription <id|name>. Requires Owner on the subscription + write permission on the source and target MGs
az account management-group subscription removeMove out of an MG (back to the tenant root)Moving out means “leaving all ALZ policies.” Use with care
az account management-group entities listList all MGs and subscriptions with their parentsUse --query to filter /subscriptions
az account management-group hierarchy-settings createSet the default MG and “require authorization”--name <tenant-id> --default-management-group <mg-id> --require-authorization-for-group-creation true
az account alias createCreate a subscription with the subscription alias API (vending process)--billing-scope, --display-name, --workload Production|DevTest. Requires the account extension and billing permissions
az vm list-usage / az network list-usagesView regional quota usage--location canadacentral
az tag create / az tag updateTag a subscription--resource-id /subscriptions/<id> (a subscription itself can have up to 50 tags)

1) Move a subscription and verify its parent

SUB_APP=$(az account show --name sub-lz-corp-myapp --query id -o tsv)
az account management-group subscription add --name corp --subscription "$SUB_APP"
az account management-group subscription show --name corp --subscription "$SUB_APP" \
  --query "{name:displayName, parent:parent.id, state:state}" -o json
{
  "name": "sub-lz-corp-myapp",
  "parent": "/providers/Microsoft.Management/managementGroups/corp",
  "state": "Active"
}

How to verify: in the portal's Management groups view, the subscription appears under Corp. Common error: you are Owner of the subscription but lack write permission on the target MG → AuthorizationFailed. Production use: the vending pipeline does this, and the placement is declared in IaC (the subscription_placement variable in avm-ptn-alz).

2) Set the default management group and “require authorization”

TENANT_ID=$(az account show --query tenantId -o tsv)
az account management-group hierarchy-settings create --name "$TENANT_ID" \
  --default-management-group "/providers/Microsoft.Management/managementGroups/sandbox" \
  --require-authorization-for-group-creation true
az account management-group hierarchy-settings list --name "$TENANT_ID" -o json
{
  "defaultManagementGroup": "/providers/Microsoft.Management/managementGroups/sandbox",
  "requireAuthorizationForGroupCreation": true
}

After you set this, new subscriptions (including Visual Studio subscriptions transferred in) land in sandbox first and are subject to sandbox policies until the vending process moves them to the right place. Creating a new MG requires Microsoft.Management/managementGroups/write on the root MG.

3) Check regional quota and the number of resource groups in the subscription

az vm list-usage --location canadacentral \
  --query "[?contains(name.value,'cores')].{name:name.localizedValue, used:currentValue, limit:limit}" -o table
az group list --query "length(@)"     # Compare with the 980 limit
Name                     Used    Limit
-----------------------  ------  -------
Total Regional vCPUs     2       10
Standard BS Family vCPUs 2       10
6

Lab: place 4 subscriptions in the right management groups

Goal and environment: in the sandbox tenant, move sub-alz-management, sub-alz-connectivity, sub-alz-identity, and sub-lz-corp-myapp to management, connectivity, identity, and corp. Set the default MG and add cost tags to the subscriptions. Cost: 0 (metadata changes only). Permissions: Owner on the alz MG + Owner on each subscription. Risk: moving a subscription changes the policies it inherits right away (if the ALZ default policies are deployed, Deny takes effect immediately).
1. Record the subscription IDs
declare -A PLACE=( [sub-alz-management]=management [sub-alz-connectivity]=connectivity \
                   [sub-alz-identity]=identity [sub-lz-corp-myapp]=corp )
for s in "${!PLACE[@]}"; do
  id=$(az account show --name "$s" --query id -o tsv 2>/dev/null) || { echo "Missing subscription $s (single-subscription fallback: only process sub-lz-corp-myapp)"; continue; }
  echo "$s $id -> ${PLACE[$s]}"
done
2. Move the subscriptions
for s in "${!PLACE[@]}"; do
  id=$(az account show --name "$s" --query id -o tsv 2>/dev/null) || continue
  az account management-group subscription add --name "${PLACE[$s]}" --subscription "$id" -o none && echo "moved $s"
done
3. Set the default MG to sandbox and turn on require authorization (see item 2 on the “Commands” tab). To verify, create a test subscription (if you have permission) or review the hierarchy settings output.
4. Tag the subscriptions (subscription-level tags are not inherited automatically by resources; Module 2 solves this with policy)
az tag update --resource-id "/subscriptions/$SUB_APP" --operation Merge \
  --tags env=prod owner=team-myapp@contoso.example costCenter=CC-1001 workload=myapp
5. Verify the placement with Resource Graph
az graph query -q "resourcecontainers
| where type == 'microsoft.resources/subscriptions'
| extend mgChain = properties.managementGroupAncestorsChain
| project name, parentMg = tostring(mgChain[0].name), tags" -o table
Name                  ParentMg      Tags
--------------------  ------------  ---------------------------------------------
sub-alz-management    management    {}
sub-alz-connectivity  connectivity  {}
sub-alz-identity      identity      {}
sub-lz-corp-myapp     corp          {"env":"prod","owner":"team-myapp@contoso.example",...}
Cleanup / keep: the placement results are used in later hours, so keep them. To undo the default MG setting: az account management-group hierarchy-settings delete --name "$TENANT_ID".

Case 1: a “shared subscription” hits the 980 resource group limit

Problem: a company put all its internal applications in sub-shared-prod. Each application and each feature branch got its own resource groups. Three years later it hit the 980 limit. New applications could not be deployed, and the subscription had as many as 60 Owners. What to do: vend new subscriptions by workload. Migrate with Resource Mover or by redeploying. Move platform resources out to the connectivity / management subscriptions first. Limits: not all resource types support cross-subscription moves. VNets and similar resources must be rebuilt. Assess before you migrate (covered in detail in hour 7).

Case 2: a Visual Studio subscription “slips” into the tenant root

Problem: a developer transferred a personal Visual Studio subscription into the company tenant. The subscription landed in the tenant root, so no ALZ policy applied, and the developer created a VM with a public IP. What to do: set the default MG to sandbox. Set “subscriptions entering the directory” to Permit no one, and list the exempted users. Use Resource Graph to run a regular query for subscriptions whose managementGroupAncestorsChain contains only the tenant root. Limits: the exempted users in a subscription policy must be individual users, not groups.

Case 3: not enough quota makes scale-out fail on launch day

Problem: on promotion day, VMSS scale-out reported QuotaExceeded. What to do: request quota based on workload size when the subscription is vended. Use a quota alert to notify the Owner at 80%. For capacity-sensitive workloads, use on-demand capacity reservations. Limits: a quota increase does not mean the region has capacity. Popular SKUs may require a different region or SKU.

Common errors and fixes

(AuthorizationFailed) The client '…' does not have authorization to perform action 'Microsoft.Management/managementGroups/subscriptions/write'

Cause: moving a subscription needs permissions in three places: Owner on the subscription (role assignment write permission), MG write permission on the target parent MG, and MG write permission on the current parent MG. Being Owner on the subscription alone is not enough.

az role assignment list --assignee "$ME" --all --query "[].{role:roleDefinitionName, scope:scope}" -o table

Fix: grant Management Group Contributor or Owner on alz (or on the source and target MGs), or have the platform team's vending identity perform the move.

Operation could not be completed as it results in exceeding approved Total Regional Cores quota

Cause: the regional vCPU quota (subscription + region) is too low.

az vm list-usage --location canadacentral -o table | grep -i -E "Total Regional|Family"

Fix: increase it in the portal under “Quotas,” or request it automatically with the Quota REST API. In the long term, split the subscription or use Quota Groups.

The subscription has moved to corp, but the Deny policy did not block anything, or the compliance page still shows old data

Cause: ARM's hierarchy and assignment caches take time to refresh. Subscription-level evaluation takes about 30 minutes. Compliance for existing resources waits for the evaluation cycle or an on-demand scan. Deny on new requests usually takes effect quickly, but it is not guaranteed to happen “within a second.”

az policy state trigger-scan --subscription "$SUB_APP" --no-wait
az policy assignment list --disable-scope-strict-match --query "[].name" -o tsv | head

Fix: wait and retry. Use --disable-scope-strict-match to confirm the subscription can actually “see” the inherited assignments.

ResourceGroupQuotaExceeded / Creating the resource group would exceed the quota of '980'

Cause: the subscription has reached the 980 resource group limit.

az group list --query "[?tags.env=='feature'].name" -o tsv | wc -l

Fix: clean up temporary resource groups. Move feature-branch environments to a separate dev subscription. In the long term, split subscriptions by workload.

Command-line exercises
1. List all subscriptions that are still directly under the tenant root management group.
TENANT_ID=$(az account show --query tenantId -o tsv)
az graph query -q "resourcecontainers | where type == 'microsoft.resources/subscriptions'
| extend parent = tostring(properties.managementGroupAncestorsChain[0].name)
| where parent == '$TENANT_ID' | project name, subscriptionId" -o table
2. Move sub-lz-online-shop from corp to online, and confirm its parent.
az account management-group subscription add --name online --subscription sub-lz-online-shop
az account management-group subscription show --name online --subscription sub-lz-online-shop --query parent.id -o tsv
Scenario analysis
A team asks for “one management group each for myapp's dev, test, and prod, with the 3 subscriptions placed in them separately,” because prod needs stricter policies. How do you respond?

I would not create an MG for each environment. Put all three subscriptions under corp so they inherit the same ALZ guardrails. Express prod's stricter requirements with subscription-level assignments. For example, assign an extra Deny only on the prod subscription, or use initiative parameters to raise Audit to Deny. This keeps the hierarchy at 3–4 levels, and new environments do not require hierarchy changes. Only if prod has a completely different compliance regime (such as PCI) should you consider a separate MG.

Verified training videos

▶
Azure Landing Zones - How many subscriptions should I use in Azure? — Azure Verified Modules
English · Official video referenced in the CAF subscription design documentation, covering how many subscriptions to use and how to split them. Directly relevant to this module
▶
Azure Landing Zones Overview — John Savill's Technical Training
English · ALZ overview, a review of the relationship between management groups and subscriptions (follow the current documentation for details)

Official documentation

Video storyboard script (about 90 seconds)

This course material cannot generate video or MP3 files directly. The storyboard and narration script are provided so you can pass them to a video tool.

Shot 1 · 0–20s
Visual: a huge subscription box packed with resource groups. The counter jumps to 980 and turns red.
Narration: Subscriptions have hard limits. You get up to 980 resource groups and up to 800 deployment history entries. Put everything in one subscription, and you will hit the wall eventually.
Shot 2 · 20–45s
Visual: the subscription splits into management, connectivity, identity, security, and several application subscriptions, each sliding into the management group tree.
Narration: ALZ splits platform subscriptions by responsibility, and vends application subscriptions by workload and environment. The subscription is the scale unit.
Shot 3 · 45–70s
Visual: as the subscription moves into corp, policy icons drop in from three levels: alz, landingzones, and corp. The counter adds 17 + 53 + 5.
Narration: The management group it sits in determines which assignments on that chain it inherits. Place it in the wrong spot, and the strictest or loosest policies end up on the wrong subscription.
Shot 4 · 70–90s
Visual: a new subscription slides from the tenant root down into sandbox.
Narration: Set the default management group to sandbox, then turn on “require authorization to create management groups,” so stray subscriptions cannot bypass governance.
or score ≥ 70% on the quiz

Module 2 · Naming and tagging standards: policy enforcement and cost allocation

06:00 – 13:00 · Most names cannot be changed once created, and without tags you cannot tell where the money goes. Write the standard first, then let Azure Policy enforce it and fill in the gaps
7 minutesCAF abbreviation table (updated 2026-11)Built-in policies: Require a tag / Inherit a tag★★★★☆
Learning goals
  • Name ALZ platform and application resources using the CAF naming pattern (resource type abbreviation + workload + environment + region + instance). Know that length, allowed characters, and uniqueness scope differ between resource types.
  • Define the four required tags: env, owner, costCenter, and workload. Explain that tags are not inherited by default, and state the naming case rules.
  • Use the built-in policies Require a tag on resource groups (Deny) and Inherit a tag from the resource group if missing (Modify) to enforce “resource groups must have the tag, and resources get it automatically.”
  • Know the limits of naming enforcement: policy can reject non-compliant names, but it cannot rename resources. Naming standards are better generated inside IaC modules.
Prerequisite: subscription placement from Module 1. Importance: ★★★★☆

What: naming standards and tagging standards

Names answer “what is this, who owns it, and in which environment and region.” Tags answer “who is responsible, who pays, and which workload does it belong to.” The CAF-recommended naming pattern is <resource type abbreviation>-<workload/application>-<environment>-<region>-<instance>. Include each part as needed. This course uses “abbreviation + workload + environment/function + region abbreviation cc (canadacentral)” throughout.

ResourceCAF abbreviationName used in this courseLength / characters / uniqueness (official naming rules)
Management groupmgalz, corp (uses the ALZ default IDs)1–90, unique within the tenant
Resource grouprgrg-alz-mgmt-cc, rg-lz-myapp-cc1–90, unique within the subscription, cannot end with a period
Virtual networkvnetvnet-hub-cc, vnet-spoke-myapp-cc2–64, unique within the resource group
Log Analytics workspaceloglaw-alz-mgmt-cc (course convention)4–63, letters, numbers, and hyphens
Azure Firewallafwafw-hub-cc1–80
Key Vaultkvkv-myapp-prod-cc-013–24, globally unique, starts with a letter, no consecutive hyphens
Storage accountststmyappprodcc013–24, globally unique, lowercase letters and numbers only (no hyphens)
User-assigned managed identityidid-policy-remediation3–128
Windows VMvmvm-myapp-cc-011–15 (hostname limit), Linux 1–64
Policy assignment (MG scope)Descriptive namelab-rg-req-costcenterResource name 1–24 (MG scope), 1–64 for other scopes; display name 1–128
About law- and log- The CAF abbreviation table uses log for Log Analytics workspaces. This course keeps the convention law-alz-mgmt-cc used across hours. Your organization should pick one and write it into the standard. Consistency matters more than which one you pick.

Tagging standard (the four required tags in this course)

TagExample valuePurposeEnforcement
envprod / dev / sbxEnvironment, shutdown policy, alert tiersRequired on resource groups + allowed value list
ownerteam-myapp@contoso.exampleWho to contact when something breaks, cost notificationsRequired on resource groups
costCenterCC-1001Cost allocation (chargeback)Required on resource groups + inherited by resources
workloadmyappAggregates costs and resources by workloadInherited by resources

Why: three tagging pitfalls

  • Not inherited by default: tags you put on a resource group or subscription do not automatically appear on the resources inside it. Either write them in IaC, add them with a Modify policy (Inherit a tag…), or turn on “tag inheritance” in Cost Management. The last option only affects cost records, not the resources themselves.
  • Case: tag names are case-insensitive in operations, but tag values are case-sensitive. Mixing CostCenter and costCenter splits reports, so fix one spelling in the standard.
  • Limits: each resource, resource group, or subscription can have up to 50 tags. Tag names can be up to 512 characters and values up to 256 characters (a few resource types have shorter limits).

How: enforce with policy (the combination ALZ recommends)

RequirementBuilt-in policy (ID)EffectAssignment location
Resource groups must have costCenterRequire a tag on resource groups (96670d01-0a4d-4649-9c89-2d3abc0a5025)Denylandingzones
Fill in costCenter from the resource group when a resource lacks itInherit a tag from the resource group if missing (ea3f2387-9b95-492a-a190-fcdc54f7b070)Modify (requires a managed identity)landingzones
The value on the resource always matches the resource groupInherit a tag from the resource group (cd3aa116-8754-49c9-a813-ad46512ece54)Modify (addOrReplace)Use with care: overwrites values the team set itself
Resources must have a given tagRequire a tag on resources (871b6d14-10aa-478d-b590-94f262ecfa99)Deny (Indexed mode)Generally not recommended: it blocks many resources that tools create automatically

The recommended pattern is “Deny on resource groups, Modify on resources.” People or pipelines create resource groups, so strict requirements there are reasonable. Many different tools create resources, including NICs and disks that the platform creates automatically. A direct Deny on resources would block many legitimate requests, so using Modify to fill in the tag is more reliable.

When: can you enforce naming with policy?

You can write a custom definition that uses field('name') with like (wildcard *) or match (# for a digit, ? for a letter, . for any character) to deny non-compliant names. The Module 3 lab writes one. Be aware, though: policy cannot rename resources. It can only deny them. Many resource names are generated automatically by services (for example, the AKS node resource group MC_…). In practice, it is better to generate names inside IaC modules (for example with the Azure Naming Tool or a Terraform naming module), and use policy only as a safety net for a few key types (resource groups and VNets).

Common misconceptions ① “If I tag the subscription with costCenter, cost reports can be split by costCenter.” Resources do not have this tag. You need policy inheritance or the tag inheritance feature in Cost Management. ② “The sooner you deny with Require a tag on resources, the better.” It blocks resources created automatically by managed services and types that do not support tags, which causes deployment failures. ③ “Tag values are not case-sensitive.” Values are case-sensitive. Prod and prod are two different values. ④ “A storage account can be named st-myapp-prod.” Storage account names can contain only lowercase letters and numbers, and they must be globally unique.

Flow chart: where tags come from

Pipeline / personaz group create rg-lz-myapp-cc--tags costCenter=CC-1001 Require a tag on RGDeny: no costCenter→ 403 RequestDisallowedByPolicyHas it → allow Resource groupcostCenter=CC-1001env=prod owner=… Any tool creates a resourceVM automatically creates NIC / diskNo tag in the request Inherit tag if missingModify: before the request reaches the RPWrite the RG's costCenter into the requestExisting resources → remediation task (Module 5) ResourcecostCenter=CC-1001Costs can be allocated in reports
Figure 2-1: Resource groups are guarded with Deny. Resources get missing tags by reading them from the resource group with Modify. (Modify rewrites the request before it is handed to the resource provider.)

Naming pattern breakdown

vnet spoke-myapp prod (optional) cc 01 (optional) CAF resource abbreviationRole + workloadEnvironmentRegion abbreviationInstance number Storage account:Remove hyphens, all lowercasestmyappprodcc01
Figure 2-2: Segments are separated by hyphens. For resource types that do not allow hyphens or have very short name limits (storage accounts, Windows VMs), compress the name according to the rules.

Interactive animation: name generator + validator

Choose a resource type and fill in the workload, environment, and instance. The generator builds the name according to this course's standard, then checks it one rule at a time against the official naming rules (length, characters, uniqueness scope). Finally, it simulates the result of this create request passing through the two tag policies.

Choose a resource type, then click “Generate and validate.”
$ # The name will appear here

Core commands and parameters

CommandPurposeKey parameters / notes
az policy definition show --name <guid>View the parameters, effects, and roleDefinitionIds of a built-in definitionBuilt-in definitions are at /providers/Microsoft.Authorization/policyDefinitions/<guid>
az policy assignment createAssign a policy--name (MG scope, ≤24 characters), --policy, --scope, --params, --mi-system-assigned --location (required for Modify / DINE)
az role assignment createGrant permissions to the assignment's managed identity (the CLI does not grant them automatically)--assignee-object-id --assignee-principal-type ServicePrincipal --role Contributor --scope
az tag update --operation Merge|Replace|DeleteModify tagsMerge does not delete existing tags; Replace does
az group create --tagsCreate a resource group and tag itSeparate multiple tags with spaces: k1=v1 k2=v2

1) View the parameters of the two built-in tag policies

az policy definition show --name 96670d01-0a4d-4649-9c89-2d3abc0a5025 \
  --query "{name:displayName, mode:mode, params:keys(parameters), effect:policyRule.then.effect}" -o json
az policy definition show --name ea3f2387-9b95-492a-a190-fcdc54f7b070 \
  --query "{name:displayName, roles:policyRule.then.details.roleDefinitionIds}" -o json
{
  "name": "Require a tag on resource groups",
  "mode": "All",
  "params": ["tagName"],
  "effect": "deny"
}
{
  "name": "Inherit a tag from the resource group if missing",
  "roles": ["/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"]
}

b24988ac-… is the built-in Contributor role. The mode of the “Require a tag on resource groups” definition is All, because resource groups are not Indexed resources (Module 3 explains mode).

2) Assign “Require a tag on resource groups” for costCenter on landingzones

LZ=/providers/Microsoft.Management/managementGroups/landingzones
az policy assignment create --name lab-rg-req-costcenter \
  --display-name "LAB: Resource groups must have costCenter" \
  --policy 96670d01-0a4d-4649-9c89-2d3abc0a5025 --scope "$LZ" \
  --params '{"tagName":{"value":"costCenter"}}'

3) Assign “Inherit a tag from the resource group if missing” for costCenter, and grant permissions to the managed identity

az policy assignment create --name lab-inherit-costcenter \
  --display-name "LAB: Inherit costCenter from RG if missing" \
  --policy ea3f2387-9b95-492a-a190-fcdc54f7b070 --scope "$LZ" \
  --params '{"tagName":{"value":"costCenter"}}' \
  --mi-system-assigned --location canadacentral
PID=$(az policy assignment show --name lab-inherit-costcenter --scope "$LZ" --query identity.principalId -o tsv)
az role assignment create --assignee-object-id "$PID" --assignee-principal-type ServicePrincipal \
  --role Contributor --scope "$LZ"
{
  "identity": { "principalId": "8f0c2e1a-0000-0000-0000-3b1d7c0e9a42", "type": "SystemAssigned" },
  "location": "canadacentral",
  "name": "lab-inherit-costcenter",
  "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/ea3f2387-9b95-492a-a190-fcdc54f7b070",
  "scope": "/providers/Microsoft.Management/managementGroups/landingzones"
}

Common error: forgetting the authorization step. Modify still applies to new requests (ARM rewrites the request), but when the remediation task deploys it fails with AuthorizationFailed. When you create an assignment in the portal, the portal grants permissions automatically based on roleDefinitionIds. With the CLI, SDK, or IaC, you must do this yourself.

Lab: resource groups must have costCenter, and resources inherit it automatically

Goal and environment: assign two built-in tag policies on landingzones and verify the effects of Deny and Modify. Subscription: sub-lz-corp-myapp (the single-subscription fallback also applies). Cost: one empty Standard_LRS storage account, essentially zero. Permissions: Resource Policy Contributor + User Access Administrator (or Owner) on landingzones.
1. Create the two assignments: run items 2 and 3 on the “Commands” tab. Wait about 5 minutes for the assignments to take effect (ARM cache refresh).
2. Verify Deny
az account set --subscription sub-lz-corp-myapp
az group create --name rg-lz-notag-cc --location canadacentral
(RequestDisallowedByPolicy) Resource 'rg-lz-notag-cc' was disallowed by policy. Reasons: 'Policy enforced'.
Policy: "LAB: Resource groups must have costCenter"
Assignment: lab-rg-req-costcenter
3. Create a resource group with a tag, then create a storage account without a tag
az group create --name rg-lz-myapp-cc --location canadacentral \
  --tags env=prod owner=team-myapp@contoso.example costCenter=CC-1001 workload=myapp
ST=stmyappprodcc$RANDOM
az storage account create --name $ST --resource-group rg-lz-myapp-cc --location canadacentral \
  --sku Standard_LRS --min-tls-version TLS1_2 --allow-blob-public-access false
az storage account show --name $ST --resource-group rg-lz-myapp-cc --query tags
{
  "costCenter": "CC-1001"
}

The request has no tag, but Modify adds costCenter before the request reaches the storage resource provider. env and workload are not added, because the assignment only targets costCenter (each tag needs its own assignment, or one reference in an initiative).

4. Check the Modify record in the activity log
az monitor activity-log list --resource-group rg-lz-myapp-cc --offset 1h \
  --query "[?contains(operationName.value,'Microsoft.Authorization/policies')].{op:operationName.value, status:status.value}" -o table
Op                                             Status
---------------------------------------------  ---------
Microsoft.Authorization/policies/modify/action  Succeeded
Keep / clean up: the two assignments and rg-lz-myapp-cc are used again in Modules 3–5, so keep them. To delete: az policy assignment delete --name lab-inherit-costcenter --scope "$LZ" (also delete the role assignment: az role assignment delete --assignee "$PID" --scope "$LZ").

Case 1: inconsistent tag casing splits the cost report

Problem: the report shows three columns, CostCenter, costcenter, and Cost Center, so finance cannot reconcile it. What to do: the standard allows only costCenter. Standardize the policy parameters. Use Resource Graph to find the old spellings (Module 7), then fix them in bulk with az tag update. Limits: tag names are case-insensitive in operations, but cost exports and some tools keep the original spelling.

Case 2: Require a tag on resources causes AKS deployment failures

Problem: a Deny on landingzones required every resource to have owner, and AKS failed when it created resources in the node resource group. What to do: switch to Deny on resource groups with Modify inheritance on resources. If you really need resource-level enforcement, run Audit for a month first to see which automatically created resources it would block. Limits: Modify can only fill in values. It cannot make types that do not support tags carry tags.

Case 3: name conflict — soft delete on Key Vault holds the name

Problem: when the environment was rebuilt, kv-myapp-prod-cc-01 reported “name already in use,” because the deleted vault was still in its soft-delete retention period. What to do: keep the instance number in the name. If you need to reuse the name, run az keyvault purge first (only where purge protection allows it). Limits: name conflicts for globally unique resources (Key Vaults, storage accounts) can come from other tenants.

Common errors and fixes

(RequestDisallowedByPolicy) Resource 'rg-…' was disallowed by policy. Policy: Require a tag on resource groups

Cause: the resource group create request has no costCenter tag, or the tag name is spelled differently. (Values are case-sensitive. Names are usually not case-sensitive in policy comparisons, but an empty value counts as missing.)

az policy assignment show --name lab-rg-req-costcenter --scope "$LZ" --query parameters

Fix: add the tag and create the resource again. Define the tag variables centrally in the pipeline template.

Modify works but the remediation task fails: The policy assignment's managed identity does not have permission … (AuthorizationFailed)

Cause: the assignment was created with the CLI, and the managed identity was not granted the roles listed in roleDefinitionIds.

az role assignment list --assignee "$PID" --all -o table

Fix: grant Contributor on the assignment scope (or a smaller role listed in the definition). After granting it, wait a few minutes before retrying the remediation task.

The storage account named st-myapp-prod is not valid / AccountNameInvalid

Cause: storage account names can only be 3–24 characters of lowercase letters and numbers.

Fix: use the compressed form stmyappprodcc01. Implement a separate rule for this type of resource in the IaC naming module.

InvalidPolicyAssignmentName / The policy assignment name '…' is invalid … at most 24 characters

Cause: the name of an assignment at management group scope can be up to 24 characters (64 for subscription scope and below).

Fix: shorten the name (for example, lab-inherit-costcenter is 22 characters). Put the descriptive information in --display-name.

Command-line exercises
1. List the resource groups in sub-lz-corp-myapp that are missing the costCenter tag.
az group list --query "[?tags.costCenter==null].name" -o tsv
2. Add workload=myapp to rg-lz-myapp-cc without deleting its existing tags.
RG_ID=$(az group show -n rg-lz-myapp-cc --query id -o tsv)
az tag update --resource-id "$RG_ID" --operation Merge --tags workload=myapp
Scenario analysis
Finance requires “every resource must have costCenter, and the Deny must go live today.” The platform team worries about false positives. Propose a phased plan.

Week 1: Deny on resource groups (Require a tag on resource groups) and Modify on resources (Inherit if missing), and run a remediation task on existing resources. Weeks 2–4: additionally assign Require a tag on resources with enforcementMode set to DoNotEnforce (evaluate only, do not block). Use Resource Graph to count non-compliant resources by type, and identify types that are created automatically or do not support tags. After that, decide whether to enable Deny on resources, and handle exceptions with resourceSelectors or exemptions. Also turn on tag inheritance in Cost Management so the reports are usable right away.

Verified training videos

No verified English video that covers ALZ naming and tagging policy was found. (Candidate videos were checked through the YouTube oEmbed lookup, and those that did not pass are not listed.) Read the official documentation first, then use the storyboard script below.

Official documentation

Video storyboard script (about 90 seconds)

Shot 1 · 0–20s
Visual: a row of messy resource names (test1, myvnet, Storage-Prod) each change into rg-lz-myapp-cc and vnet-spoke-myapp-cc.
Narration: A good name answers three questions: what is this, who owns it, and where is it. The CAF pattern is abbreviation, workload, environment, region, instance.
Shot 2 · 20–40s
Visual: a storage account name input box. Hyphens are highlighted in red, and the length counter reaches 24.
Narration: Each resource type has its own rules. Storage account names can contain only lowercase letters and numbers, up to 24 characters, and they must be globally unique.
Shot 3 · 40–70s
Visual: a resource group creation request hits a red Deny gate. Then a VM's NIC request passes through a blue Modify gate and gets a costCenter tag “stuck” on it.
Narration: Resource groups are guarded with Deny. Resources inherit tags from their resource group with Modify. This is strict, but it does not block automatically created resources by mistake.
Shot 4 · 70–90s
Visual: a cost analysis chart clearly split into sections by costCenter.
Narration: Tags are not inherited by default, and casing must be consistent. Write the standard down, let policy enforce it, and costs can be separated clearly.
or score ≥ 70% on the quiz

Module 3 · Azure Policy deep dive: definitions, initiatives, assignments, parameters, and scopes

13:00 – 21:00 · A definition says “what to check.” An initiative bundles definitions together. An assignment says “where, with which parameters, and in which mode it runs.” Scope and definition location decide what can be constrained
8 minutesdefinitionVersion · overrides · resourceSelectorsMG-scope assignment names ≤ 24 characters★★★★★
Learning goals
  • Read the structure of a policy definition: mode (All / Indexed / resource provider modes), parameters, the conditions and aliases in policyRule.if, and then.effect and details.
  • Write a custom definition and an initiative, and understand policyDefinitionReferenceId and parameter passing.
  • Know all the key properties of an assignment: scope, notScopes, parameters, enforcementMode (Default / DoNotEnforce / Enroll), nonComplianceMessages, identity, definitionVersion, overrides, and resourceSelectors.
  • Remember the scope rule: a definition is stored in a MG or subscription and can be assigned only at that location or below. This is why ALZ keeps its custom definitions centralized on the intermediate root alz.
Prerequisites: JSON, ARM resource IDs. Importance: ★★★★★

What: four objects

ObjectResource typeStored whereQuestion it answers
Policy definitionMicrosoft.Authorization/policyDefinitionsBuilt-in (global) or a specific MG / subscriptionWhat condition to check? What to do on a match (effect)?
Initiative definition…/policySetDefinitionsSame as aboveWhich definitions are managed together? How are parameters passed?
Assignment…/policyAssignmentsMG / subscription / resource group / resourceAt which scope, with which parameters, and whether to enforce?
Exemption…/policyExemptionsExempted scopeWho is exempt from an assignment, and for how long (Module 5)

Structure of a policy definition

{
  "properties": {
    "displayName": "LAB: Resource group names must start with rg-",
    "mode": "All",
    "metadata": { "category": "General", "version": "1.0.0" },
    "parameters": {
      "effect": { "type": "String", "allowedValues": ["Audit", "Deny", "Disabled"], "defaultValue": "Audit" },
      "prefix": { "type": "String", "defaultValue": "rg-" }
    },
    "policyRule": {
      "if": {
        "allOf": [
          { "field": "type", "equals": "Microsoft.Resources/subscriptions/resourceGroups" },
          { "field": "name", "notLike": "[concat(parameters('prefix'), '*')]" }
        ]
      },
      "then": { "effect": "[parameters('effect')]" }
    }
  }
}
ElementKey points
modeAll: evaluates resource groups, subscriptions, and all resource types. Indexed: evaluates only resources that support tags and location (tag and location policies use this, to avoid misjudging types that do not support tags). Resource provider modes such as Microsoft.Kubernetes.Data, Microsoft.KeyVault.Data, and Microsoft.Network.Data are used for data-plane or component-level evaluation.
parametersTypes (String, Array, Object, Boolean, Integer, Float, DateTime), allowedValues, defaultValue, metadata.strongType (shows a resource selector in the portal), metadata.assignPermissions (lets the portal grant the managed identity permissions on the scope the parameter points to). Each definition can have up to 20 parameters. Parameterizing the effect is a convention in the ALZ library. The same definition can be assigned as Audit or Deny on different MGs.
Conditionsequals, notEquals, like / notLike (one * wildcard), match (# for a digit, ? for a letter, . for any character), matchInsensitively, contains, in / notIn, containsKey, less / greater, exists; logical operators allOf, anyOf, and not; nesting limit of 512 conditions.
Fieldsname, fullName, type, location, kind, id, tags, tags['costCenter'], identity.type, plus aliases (such as Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly). Array aliases [*] are used with count expressions.
FunctionsA subset of ARM template functions, such as parameters(), field(), resourceGroup(), subscription(), concat(), and current() (inside count loops).

Initiative

"policyDefinitions": [
  { "policyDefinitionReferenceId": "rgNaming",
    "policyDefinitionId": "/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions/lab-deny-rg-naming",
    "parameters": { "effect": { "value": "[parameters('namingEffect')]" } } },
  { "policyDefinitionReferenceId": "allowedLocations",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c",
    "definitionVersion": "1.*.*",
    "parameters": { "listOfAllowedLocations": { "value": "[parameters('allowedLocations')]" } } }
]

The initiative's own parameters (namingEffect, allowedLocations) are filled in at assignment time. They are passed to member definitions through [parameters('…')]. policyDefinitionReferenceId is each member's “ID” within the initiative. Exemptions, overrides, and non-compliance messages use it to find the specific member. Limits: each initiative can have up to 1,000 policies and 400 parameters.

Key assignment properties

PropertyPurposeNotes
scope / notScopesScope and excluded sub-scopes (up to 400)Excluded resources are not evaluated and do not count toward compliance. This is different from an exemption.
parametersAssign values to definition or initiative parametersReuse the same definition on different MGs with different values
enforcementModeDefault enforces. DoNotEnforce evaluates only and does not enforce (it does not write activity log entries and does not block, but you can still fix resources manually). Enroll enforces only on sub-scopes that were enrolled through “policy enrollment.”Trial new policies with DoNotEnforce first. This is the safe rollout practice ALZ recommends.
nonComplianceMessagesCustom message shown to users when a request is denied or non-compliantResource Manager mode only. The ALZ library uses {enforcementMode} as a placeholder, which is replaced with must or should at submission.
identity + locationManaged identity for Modify / DINE remediationAn assignment can have only one identity. A system-assigned identity must specify a location (it cannot be global, and you cannot change it later).
definitionVersionChoose the version line of the definition.2.*.* automatically receives minor versions; 1.1.* pins the minor version. Patch versions are always received automatically.
overridesOverride the effect (policyEffect) or the version (definitionVersion, built-in only) without changing the definition.Each assignment allows up to 10 overrides, and each override allows up to 50 reference IDs.
resourceSelectorsApplies only to some regions or resource types, for staged rollouts.Up to 10 per assignment; kind can be resourceLocation, resourceType, or resourceWithoutLocation.

Scope rules (the easiest place to make mistakes)

  • Definition location ≥ assignment scope: a custom definition stored in alz can be assigned to alz and to all child MGs, subscriptions, and resource groups below it. A definition stored in landingzones cannot be assigned to platform. ALZ stores custom definitions and initiatives in the intermediate root alz.
  • Inheritance: an assignment applies to all child MGs, subscriptions, resource groups, and resources within its scope. When multiple assignments overlap, the result is “the strictest one wins cumulatively.” There is no “child overrides parent” rule.
  • Limits: each scope supports up to 500 policy definitions, 200 initiative definitions, and 200 assignments. A tenant supports up to 2,500 initiative definitions.
Common misconceptions ① “Assigning an Audit on a child MG relaxes a Deny on the parent MG.” No. The combined result is the strictest. To relax it, use notScopes, an exemption, or overrides on the parent assignment. ② “If I change a definition, old assignments still run the old logic.” Assignments read the latest definition content on every evaluation (within the version line allowed by definitionVersion). ③ “DoNotEnforce equals disabled.” It still evaluates and reports compliance. It just does not block, modify, or auto-deploy. ④ “Every policy in an initiative must use the same effect.” Each member can be parameterized independently, or overridden individually with overrides.

Relationship diagram: definition → initiative → assignment → scope

Built-in definitionAllowed locations for RG (e765b5de…) Custom definition @ alzlab-deny-rg-naming Built-in definitionRequire a tag on RG (96670d01…) Initiative @ alzlab-gov-baselinerefId: rgNaming / rgLocations/ rgEnvTag; 3 parameters Assignment lab-gov-baseline @ landingzones parameters: allowedLocations=[canadacentral,canadaeast] enforcementMode: DoNotEnforce → Default notScopes: [/…/managementGroups/local] nonComplianceMessages: specified separately for each refId overrides / resourceSelectors (optional) corp ✓ online ✓ local ✗ excluded Rule: a definition or initiative stored in alz can be assigned to alz or to any scope below it; If it is stored in landingzones, it cannot be assigned to platform (the assignment fails with PolicyDefinitionNotFound or an invalid-scope error).
Figure 3-1: a definition can be reused by multiple initiatives and assignments. The assignment determines the scope, parameters, and enforcement mode.

Sequence diagram: from assignment creation to effect

T0: create the assignment ≈5 minutes: the assignment is applied to the scopeNew requests start being subject to Deny / Modify Evaluation cycle startsExisting resources are evaluated one by one; larger scopes take longer Compliance results become visiblePortal / az policy state / ARG Every 24 hoursStandard evaluation cycle
Figure 3-2 (official docs): a new assignment is applied to its scope about 5 minutes later, and evaluation then starts. There is no fixed expected time for completion.

Interactive animation: scope resolver — which assignments constrain this resource?

Select a target resource. The animation moves up from resource → resource group → subscription → each level of management group to collect assignments, then removes the assignments excluded by notScopes to get the final list of effective assignments. The lab assignments are the lab-* ones created in this hour. The ALZ default assignment count is calculated for library 2026.11.0 (if your tenant has not deployed the ALZ default policies, look only at the lab assignments).

Select a target to start.
$ az policy assignment list --disable-scope-strict-match --scope <resource-id>

Core commands and parameters

CommandPurposeKey parameters / notes
az policy definition createCreate a custom definition--name --display-name --mode --rules --params --metadata --management-group|--subscription
az policy set-definition createCreate an initiative--definitions (JSON array file), --params, --definition-groups, --management-group
az policy assignment createAssign a definition or initiative--policy or --policy-set-definition (for definitions in an MG, use the full ID), --scope, --not-scopes, --params, --enforcement-mode Default|DoNotEnforce
az policy assignment updateModify an assignment (for example, switch the enforcement mode)--enforcement-mode, --not-scopes, --params
az policy assignment non-compliance-message createAdd a non-compliance message--message, --policy-definition-reference-id
az policy assignment list --disable-scope-strict-matchList all assignments that apply to a scope (including inherited ones)Without this parameter, only assignments made “exactly on this scope” are listed.
az provider show -n <ns> --expand "resourceTypes/aliases"Look up aliasesYou can also use the Azure Policy extension for VS Code.

1) Find aliases related to storage account HTTPS

az provider show --namespace Microsoft.Storage --expand "resourceTypes/aliases" \
  --query "resourceTypes[?resourceType=='storageAccounts'].aliases[].name" -o tsv | grep -i https
Microsoft.Storage/storageAccounts/supportsHttpsTrafficOnly

2) List all effective assignments on a resource group (including inherited ones)

az policy assignment list --resource-group rg-lz-myapp-cc --disable-scope-strict-match \
  --query "[].{name:name, scope:scope, mode:enforcementMode}" -o table
Name                    Scope                                                          Mode
----------------------  -------------------------------------------------------------  ------------
lab-rg-req-costcenter   /providers/Microsoft.Management/managementGroups/landingzones  Default
lab-inherit-costcenter  /providers/Microsoft.Management/managementGroups/landingzones  Default
lab-gov-baseline        /providers/Microsoft.Management/managementGroups/landingzones  DoNotEnforce

3) View the full structure of an ALZ assignment (when the ALZ default policies are deployed)

az policy assignment show --name Deny-MgmtPorts-Internet \
  --scope /providers/Microsoft.Management/managementGroups/landingzones \
  --query "{def:policyDefinitionId, mode:enforcementMode, msg:nonComplianceMessages[0].message}" -o json
{
  "def": "/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions/Deny-MgmtPorts-From-Internet",
  "mode": "Default",
  "msg": "Management port access from the Internet must be blocked."
}

Note that the definition ID points to the intermediate root alz. The ALZ library uses the placeholder managementGroups/placeholder, and the deployment tool (alz provider / Bicep) replaces it with the actual intermediate root ID. The {enforcementMode} in non-compliance messages is also replaced at deployment with must (Default) or should (DoNotEnforce).

Lab: custom definition + initiative + DoNotEnforce dry run

Goal and setup: on alz, create the custom definition lab-deny-rg-naming and the initiative lab-gov-baseline (naming + allowed locations + env tag on resource groups). Assign it to landingzones and exclude local. Observe first with DoNotEnforce, then switch to Default. Cost: 0. Permissions: Resource Policy Contributor on alz.
1. Custom definition
mkdir -p ~/alz-lab/policy && cd ~/alz-lab/policy
cat > rg-naming.rules.json <<'EOF'
{
  "if": { "allOf": [
    { "field": "type", "equals": "Microsoft.Resources/subscriptions/resourceGroups" },
    { "field": "name", "notLike": "[concat(parameters('prefix'), '*')]" },
    { "field": "name", "notLike": "MC_*" },
    { "field": "name", "notLike": "NetworkWatcherRG" }
  ] },
  "then": { "effect": "[parameters('effect')]" }
}
EOF
cat > rg-naming.params.json <<'EOF'
{ "effect": { "type": "String", "allowedValues": ["Audit","Deny","Disabled"], "defaultValue": "Audit" },
  "prefix": { "type": "String", "defaultValue": "rg-" } }
EOF
az policy definition create --name lab-deny-rg-naming --management-group alz --mode All \
  --display-name "LAB: Resource group names must start with rg-" \
  --rules rg-naming.rules.json --params rg-naming.params.json \
  --metadata category=General version=1.0.0

This excludes the MC_* resource groups that AKS creates automatically and the NetworkWatcherRG that Network Watcher creates automatically. That is why “the naming policy is only a fallback.”

2. Initiative
ALZ_DEF=/providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions
cat > baseline.defs.json <<EOF
[
  { "policyDefinitionReferenceId": "rgNaming", "policyDefinitionId": "$ALZ_DEF/lab-deny-rg-naming",
    "parameters": { "effect": { "value": "[parameters('namingEffect')]" } } },
  { "policyDefinitionReferenceId": "rgLocations",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988",
    "parameters": { "listOfAllowedLocations": { "value": "[parameters('allowedLocations')]" } } },
  { "policyDefinitionReferenceId": "rgEnvTag",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/96670d01-0a4d-4649-9c89-2d3abc0a5025",
    "parameters": { "tagName": { "value": "env" } } }
]
EOF
cat > baseline.params.json <<'EOF'
{ "namingEffect": { "type": "String", "allowedValues": ["Audit","Deny","Disabled"], "defaultValue": "Audit" },
  "allowedLocations": { "type": "Array", "defaultValue": ["canadacentral","canadaeast"] } }
EOF
az policy set-definition create --name lab-gov-baseline --management-group alz \
  --display-name "LAB: Governance baseline" --definitions baseline.defs.json --params baseline.params.json
3. Assign with DoNotEnforce to landingzones, excluding local
LZ=/providers/Microsoft.Management/managementGroups/landingzones
az policy assignment create --name lab-gov-baseline --scope "$LZ" \
  --policy-set-definition /providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policySetDefinitions/lab-gov-baseline \
  --params '{"namingEffect":{"value":"Deny"}}' \
  --not-scopes /providers/Microsoft.Management/managementGroups/local \
  --enforcement-mode DoNotEnforce
az policy assignment non-compliance-message create --name lab-gov-baseline --scope "$LZ" \
  --policy-definition-reference-id rgNaming --message "Resource group names must start with rg-. See platform naming standard v1."
4. Dry run: non-compliant requests are allowed through but logged
az group create --name myapp-temp --location westus2 --tags costCenter=CC-1001
az policy state trigger-scan --resource-group myapp-temp
az policy state list --resource-group myapp-temp --filter "complianceState eq 'NonCompliant'" \
  --query "[].{ref:policyDefinitionReferenceId, state:complianceState}" -o table
Ref               State
----------------  ------------
rgNaming          NonCompliant
rgLocations       NonCompliant
rgEnvTag          NonCompliant

Names, regions, and a missing env tag are all non-compliant. (Note: to evaluate the region of resource groups, use Allowed locations for resource groups (e765b5de-…, mode All). The common Allowed locations policy (e56962a6-…) uses Indexed mode and does not evaluate resource groups.) Because the mode is DoNotEnforce, the resource groups are still created. (Note: the costCenter policy lab-rg-req-costcenter is in Default mode, so the commands must include costCenter.)

5. Switch to enforcement, and verify the rejection and the custom message
az group delete --name myapp-temp --yes
az policy assignment update --name lab-gov-baseline --scope "$LZ" --enforcement-mode Default
# About 5 minutes later:
az group create --name myapp-temp --location canadacentral --tags costCenter=CC-1001 env=dev
(RequestDisallowedByPolicy) Resource 'myapp-temp' was disallowed by policy.
Reasons: 'Resource group names must start with rg-. See platform naming standard v1.'
Keep: lab-gov-baseline is used in Modules 7 and 8. For full course cleanup, see the cleanup script on the Capstone lab page.

Case 1: the definition was stored in the wrong place, so the platform MG cannot reuse it

Problem: A team created a custom “allowed VM SKUs” definition on landingzones, then found it could not be assigned to platform. Approach: Following the ALZ convention, store all custom definitions and initiatives on the intermediate root alz. When migrating, first create the new definition on alz and update the assignment references, then delete the old definition. Limit: A definition that an assignment references cannot be deleted. You must first update or delete the assignment.

Case 2: use overrides to temporarily downgrade one member

Problem: A Deny in a guardrail initiative blocked the preview feature of a new service, and changing the initiative requires the full release process. Approach: Add overrides to the assignment (kind=policyEffect, value=Audit, with selectors that specify that member's referenceId). After the issue is fixed, remove the override. Limits: The override effect must be within the effects the definition allows. Each assignment allows up to 10 overrides.

Case 3: roll out by region with resourceSelectors

Problem: The new policy needs to take effect in the secondary region canadaeast for a week before it is rolled out further. Approach: Add resourceSelectors to the assignment (resourceLocation in [canadaeast]). After you review compliance and denial events, add canadacentral. Limit: You cannot use resourceLocation and resourceWithoutLocation in the same selector.

Common errors and fixes

(PolicyDefinitionNotFound) The policy definition '…' could not be found

Cause: The assignment was made to a scope outside where the definition is stored (for example, the definition is on landingzones and the assignment is to platform). Or, in the CLI, only a short name was given, and the CLI looks in the current subscription rather than in the MG.

az policy definition show --name lab-deny-rg-naming --management-group alz --query id -o tsv

Fix: Use the full definition ID, or move the definition to a higher MG.

(InvalidPolicyParameters) The policy parameters '…' do not match the parameters of the policy definition

Cause: The assignment's parameter name is misspelled, the type is wrong (for example, an array written as a string), or a required parameter without a default value is missing.

az policy set-definition show --name lab-gov-baseline --management-group alz --query "parameters" -o json

Fix: Rewrite --params using the definition's parameter names and types. Values must be wrapped in {"value": …}.

(InvalidPolicyRule) Failed to parse policy rule: 'The alias '…' is not valid'

Cause: The alias does not exist, the casing or path is wrong, or an unsupported field is used in Indexed or RP mode.

Fix: Find the correct alias with az provider show --expand "resourceTypes/aliases" or the VS Code policy extension.

(PolicyAssignmentScopeLimitExceeded / QuotaExceeded) … exceeds the maximum number of policy assignments (200)

Cause: More than 200 assignments on the same scope (many individual definitions, each assigned separately).

Fix: Combine related definitions into an initiative. An initiative counts as only one assignment. This is one reason ALZ makes heavy use of initiatives such as Enforce-GR-*.

Command-line exercises
1. Temporarily override the effect of the rgNaming member in the lab-gov-baseline assignment to Audit (hint: REST field overrides).
ID=$(az policy assignment show --name lab-gov-baseline --scope "$LZ" --query id -o tsv)
az rest --method patch --url "https://management.azure.com${ID}?api-version=2024-04-01" --body '{
  "properties": { "overrides": [ { "kind": "policyEffect", "value": "Audit",
    "selectors": [ { "kind": "policyDefinitionReferenceId", "in": ["rgNaming"] } ] } ] } }'

You can also declare overrides directly in IaC. For whether the CLI provides a dedicated parameter, refer to az policy assignment update --help.

2. Find the names of all custom initiatives stored on alz.
az policy set-definition list --management-group alz --query "[?policyType=='Custom'].name" -o tsv
Scenario analysis
The security team assigned “Deny public IP” on alz, but the web app in online needs a public IP. The application team proposes assigning an Audit policy on online that allows public IPs to offset the Deny. Is this feasible? What should they do?

Not feasible. When multiple assignments overlap, the strictest result wins cumulatively, so a child-level Audit cannot offset a parent-level Deny. The correct approach is to adjust the parent assignment: add online to notScopes on the alz assignment, or assign this policy to corp instead (this is exactly why ALZ places Deny-Public-IP-On-NIC on corp by default). For an exception to a single resource, use an exemption.

Verified teaching videos

No verified English video that specifically explains the structure of policy definitions and assignment properties was found. (The YouTube oEmbed check could not verify a candidate.) The following are the official documentation and a video storyboard.

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: three cards, “Definition”, “Initiative”, and “Assignment”, flip open in turn, with arrows pointing from the definition to the initiative to the assignment.
Narration: The definition writes the rule, the initiative bundles the rules, and the assignment decides where it runs, with which parameters, and whether it is enforced.
Shot 2 · 20–45s
Visual: in the JSON, if, allOf, field, and notLike are highlighted, and the effect in then is replaced by a parameter.
Narration: A condition is made of fields and operators. It is best to parameterize the effect, so the same definition can be assigned as Audit or Deny on different management groups.
Shot 3 · 45–70s
Visual: on the management group tree, the definition is stored on alz, the assignment lands on landingzones, and local is greyed out as excluded.
Narration: The layer where a definition is stored determines where it can be assigned: that layer and everything below it. Scopes excluded by notScopes are not evaluated.
Shot 4 · 70–90s
Visual: the switch flips from DoNotEnforce to Default, and a red deny gate drops down.
Narration: Test a new policy in evaluation-only mode first, understand its impact, and then switch it to enforcement. This is the safest way to release.
Or score ≥ 70% on the quiz

Module 4 · Effects: Deny, Audit, Modify, DeployIfNotExists, and DenyAction

21:00 – 28:00 · A single request can encounter multiple policies. Which ones process it before the request reaches the resource provider, which after, and in what order, determines whether it is “denied,” “modified,” or “remediated with a deployment.”
7 min11 effectsDenyAction supports only delete★★★★★ Core of this hour
Learning objectives
  • Describe the 11 effects: addToNetworkGroup, append, audit, auditIfNotExists, deny, denyAction, deployIfNotExists, disabled, manual, modify, and mutate, and the scenarios each one fits.
  • Describe how a create or update request is evaluated, in the official order: disabled → append and modify → deny → audit → manual → auditIfNotExists → denyAction. After the resource provider returns success, auditIfNotExists and deployIfNotExists are evaluated.
  • Explain why “modify before deny” and “deny before audit,” as well as DINE's evaluationDelay (default 10 minutes) and managed identity.
  • Use DenyAction to prevent accidental deletion of critical resources, and know its boundaries (subscription deletion is not blocked, deleting a parent resource cascades to its child resources, and cascadeBehaviors).
Prerequisite: Module 3's definition structure. Importance: ★★★★★

What: overview of the 11 effects

EffectWhen it appliesWhat it doesExample in ALZ
disabledChecked firstRule is not evaluated (often used to turn a parameterized rule off)Many ALZ definitions allow Disabled as an effect parameter
appendAt request time, before the RPAppend fields to the request (legacy approach)For tag management, the official recommendation is to use modify instead
modifyAt request time, before the RP; existing resources → remediation taskAdd, replace, or remove tags. Replace can change the value of an alias, and modify the identity.type of a VM or VMSS. Requires a managed identity.Enable-DDoS-VNET (connectivity, landingzones)
denyAt request time, before the RPReturns 403 RequestDisallowedByPolicy; existing resources are marked non-compliantDeny-MgmtPorts-Internet, Deny-Storage-http, Deny-Public-IP-On-NIC
auditAt request time and in the evaluation cycleWrites an activity log warning and marks the resource non-compliant, without blocking itAudit-ResourceRGLocation
manualAttested manuallyFor controls that cannot be determined automatically; defaults to UnknownCompliance framework initiatives
auditIfNotExistsAfter the RP succeedsChecks whether “related resources” exist or meet a condition. If they do not exist, the resource is marked non-compliant.Audit-PeDnsZones
deployIfNotExistsAfter the RP succeeds (evaluationDelay); existing resources → remediation taskIf related resources do not exist, runs an ARM template deployment using the managed identityDeploy-Diag-LogsCat, Deploy-Private-DNS-Zones, Deploy-VM-Backup
denyActionAt request time (last in the list)Blocks a specified action. Currently only delete is supported. The resource status shows Protected.DenyAction-DeleteUAMIAMA (platform)
addToNetworkGroupUsed by Azure Virtual Network ManagerDynamically adds VNets that meet the condition to a network groupHour 4 AVNM
mutateAKS admission (Microsoft.Kubernetes.Data)Modifies Kubernetes objectsAKS course

How: evaluation order (official)

  1. Azure Policy lists all assignments that apply to the resource and evaluates them one by one (overlapping assignments = the strictest result wins cumulatively).
  2. disabled is checked first, to decide whether this rule needs to be evaluated at all.
  3. append and modify: these can change the request content, so they come before deny. For example, after modify adds costCenter, a “missing costCenter” deny will no longer trigger. Resource Manager mode only.
  4. deny: before audit, so that the same non-compliant request is not both rejected and logged as an audit.
  5. audit → manual → auditIfNotExists → denyAction (last).
  6. The request is handed to the resource provider. Only after the RP returns success do auditIfNotExists and deployIfNotExists check related resources and decide whether to log non-compliance or deploy.

Note: PATCH requests that change only tags evaluate only the policies whose conditions check tags. Resources under Microsoft.Resources other than subscriptions and resource groups are not evaluated. Resource provider mode (such as the Key Vault data plane) is evaluated by the RP itself, which reports the result.

Key properties of DeployIfNotExists

PropertyMeaning
type / nameThe “related resource” to look for, for example Microsoft.Insights/diagnosticSettings
existenceConditionThe condition a related resource must meet to count as compliant. If any related resource meets it, no deployment occurs.
existenceScope / resourceGroupNameWhether to look for related resources within the resource group or across the whole subscription
evaluationDelayAfterProvisioning, AfterProvisioningSuccess, AfterProvisioningFailure, or an ISO 8601 duration from 0 to 360 minutes. Default PT10M
roleDefinitionIdsRoles required by the managed identity (required)
deploymentScope / deploymentDeployment at resource group or subscription level; full ARM template (nested templates supported, linked templates not supported)

Note the division of identities: when evaluating existence conditions, the requesting principal's identity is used to read related resources. When executing the deployment, the assignment's managed identity is used.

DenyAction: preventing accidental deletion

"then": {
  "effect": "denyAction",
  "details": {
    "actionNames": [ "delete" ],
    "cascadeBehaviors": { "resourceGroup": "deny" }
  }
}
  • Returns 403. The only action currently supported is delete.
  • cascadeBehaviors.resourceGroup: supported only in definitions with Indexed mode. Values are allow / deny, default deny. Deleting a resource group that contains protected resources is also blocked.
  • Not blocked: resource removal during subscription deletion, and child and extension resources removed along with a deleted parent resource (for example, deleting a storage account also removes its diagnostic settings).
  • To prevent lockout, resource types such as policyAssignments, denyAssignments, deploymentStacks, subscriptions, and locks are not subject to denyAction.
  • Difference from resource locks: a lock is set on each individual resource and can be removed by anyone with permission. denyAction is deployed centrally by policy at the MG level, and can match a batch of resources by type, name, or tag.
Common misconceptions ① “DINE automatically fixes existing resources during the evaluation cycle.” The evaluation cycle only marks existing resources as non-compliant. Fixing them requires a remediation task (Module 5). ② “Deny also blocks existing non-compliant resources.” It only blocks new create or update requests. Existing resources are just shown as non-compliant. However, any update to an existing resource may be rejected, which often causes surprises during upgrades. ③ “append and modify are the same.” modify can replace and remove tags and can fix existing resources. The official recommendation is to use modify for tag management. ④ “denyAction protects resources from being deleted by any means.” It does not block deletion of a subscription or of a parent resource.

Pipeline diagram: policy evaluation of a single PUT request

ClientPUT storage account ARM + policy engine (before the RP) ① disabledSkip? ② append/ modify ③ deny403? ④ auditLog ⑤ manual ⑥ AINERegister ⑦ denyAction Resource providerMicrosoft.Storage 201 Success After the RP succeeds ⑧ auditIfNotExists: check related resources → if absent, log non-compliance ⑨ deployIfNotExists: wait for evaluationDelay (default 10 minutes) → deploy an ARM template using the assignment's managed identity (for example, diagnostic settings) 403 RequestDisallowedByPolicyRequest terminated; later steps are not executed Compliance dataActivity log: policies/deny|audit|modify|deployIfNotExists/actionVisible on the compliance page in about 15 minutes
Figure 4-1 official evaluation order: the first seven steps occur before the request is handed to the resource provider. Once deny matches, the request ends immediately with a 403.

Decision diagram: which effect to choose

What must this control achieve? Must never happendeny (run audit as a dry run first) Automatically correct properties / tagsmodify Add a companion resource if it is missingdeployIfNotExists See the current state firstaudit / AINE Prevent accidental deletiondenyAction ALZ's distribution: mainly preventive (deny) + proactive (DINE / modify), with audit used for controls that need manual judgment or phased enablement
Figure 4-2 rules of thumb for choosing an effect

Core animation: the request evaluation pipeline through ARM and the policy engine

Select a scenario, then press “Play” or “Next.” Each step highlights a stage of the evaluation pipeline. The log below shows the result ARM returns or the policy event in the activity log. You can switch to “DoNotEnforce” to see how the same request differs in evaluation-only mode.

Request reaches ARM
① disabled
② append / modify
③ deny
④ audit
⑤ manual
⑥ auditIfNotExists
⑦ denyAction
Resource provider
⑧⑨ AINE / DINE after the request
Compliance record
Select a scenario to start.
$ az storage account create …

Core commands and parameters

CommandPurposeKey parameters / notes
az policy event listView policy events (deny, audit, modify, and so on)--resource-group, --from, --filter
az monitor activity-log listPolicy operations in the activity logOperation name Microsoft.Authorization/policies/<effect>/action
az policy definition showView the allowed values of an effect parameter--query parameters.effect.allowedValues
az deployment group listView deployments created by DINE / remediation tasksDINE deployment names usually start with PolicyDeployment_
az resource deleteTest DenyActionWhen blocked, returns 403 with policy information

1) Test Deny: a storage account that allows HTTP (requires Deny-Storage-http or this hour's lab assignment)

az storage account create --name stmyapphttp$RANDOM --resource-group rg-lz-myapp-cc \
  --location canadacentral --sku Standard_LRS --https-only false
(RequestDisallowedByPolicy) Resource 'stmyapphttp12345' was disallowed by policy. Reasons: 'Storage accounts must use HTTPS.'.
See error details for policy resource IDs.
Code: RequestDisallowedByPolicy
Target: stmyapphttp12345
Additional Information:
Type: PolicyViolation
Info: {
    "policyAssignmentName": "lab-deny-st-http",
    "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/404c3081-a854-4457-ae30-26a93ef643f9",
    "policyDefinitionEffect": "Deny"
}

2) View recent policy events

az policy event list --resource-group rg-lz-myapp-cc --from "$(date -u -d '-1 hour' +%Y-%m-%dT%H:%M:%SZ)" \
  --query "[].{time:timestamp, assignment:policyAssignmentName, effect:policyDefinitionAction, state:complianceState}" -o table
Time                  Assignment              Effect   State
--------------------  ----------------------  -------  ------------
2026-11-18T10:21:07Z  lab-deny-st-http        deny     NonCompliant
2026-11-18T10:20:31Z  lab-inherit-costcenter  modify   Compliant

3) Test DenyAction

az resource delete --ids "$(az storage account show -n $ST -g rg-lz-myapp-cc --query id -o tsv)"
(RequestDisallowedByPolicy) Resource 'stmyappprodcc12345' was disallowed by policy.
Policy: LAB: Protect tagged resources from deletion (denyAction)

Lab: Deny blocking, Modify rewriting, DenyAction preventing deletion

Goal and setup: on landingzones, assign the built-in “Secure transfer to storage accounts should be enabled” (404c3081-…, effect parameter Deny, which uses the same definition as ALZ's Deny-Storage-http). Then use an ALZ-style denyAction definition to protect the storage account tagged protect=true. Cost: one empty storage account, almost 0. Risk: denyAction will block you from deleting the lab resource group. Be sure to delete the assignment before cleanup.
1. Deny assignment (if the ALZ default policies are deployed, Deny-Storage-http already exists on landingzones, so you can skip this step and test directly)
LZ=/providers/Microsoft.Management/managementGroups/landingzones
az policy assignment create --name lab-deny-st-http --scope "$LZ" \
  --display-name "LAB: Storage accounts must use HTTPS" \
  --policy 404c3081-a854-4457-ae30-26a93ef643f9 --params '{"effect":{"value":"Deny"}}'
az policy assignment non-compliance-message create --name lab-deny-st-http --scope "$LZ" \
  --message "Storage accounts must use HTTPS."
About 5 minutes later, run item 1 on the Commands tab. You should get a 403.
2. Observe modify before deny: create another storage account that is HTTPS-only but has no tags. Confirm it succeeds and has costCenter (from the Modify in Module 2). Check the modify and deny records in az policy event list to see the evaluation order.
3. DenyAction definition and assignment
cd ~/alz-lab/policy
cat > protect.rules.json <<'EOF'
{
  "if": { "allOf": [
    { "field": "type", "equals": "Microsoft.Storage/storageAccounts" },
    { "field": "tags['protect']", "equals": "true" }
  ] },
  "then": { "effect": "denyAction",
            "details": { "actionNames": ["delete"], "cascadeBehaviors": { "resourceGroup": "deny" } } }
}
EOF
az policy definition create --name lab-protect-delete --management-group alz --mode Indexed \
  --display-name "LAB: Protect tagged resources from deletion (denyAction)" --rules protect.rules.json
az policy assignment create --name lab-protect-delete --scope "$LZ" \
  --policy /providers/Microsoft.Management/managementGroups/alz/providers/Microsoft.Authorization/policyDefinitions/lab-protect-delete
az tag update --resource-id "$(az storage account show -n $ST -g rg-lz-myapp-cc --query id -o tsv)" \
  --operation Merge --tags protect=true
4. Verify: deleting the storage account → 403; deleting the whole resource group rg-lz-myapp-cc is also blocked (cascadeBehaviors=deny). On the compliance page, the storage account shows as Protected.
az group delete --name rg-lz-myapp-cc --yes --no-wait; sleep 20
az group show --name rg-lz-myapp-cc --query properties.provisioningState -o tsv
Succeeded

The resource group still exists (the deletion was blocked by policy, and the asynchronous delete operation failed). You can see the specific error, with a denyAction record, in the activity log.

Cleanup (keep rg-lz-myapp-cc for later modules)
az policy assignment delete --name lab-protect-delete --scope "$LZ"
az tag update --resource-id "$(az storage account show -n $ST -g rg-lz-myapp-cc --query id -o tsv)" --operation Delete --tags protect=true
# Keep lab-deny-st-http until the Capstone lab ends

Case 1: after upgrading to Deny, every routine change to old resources fails

Problem: The platform team changed the minimum TLS version policy from Audit to Deny. The next day, when application teams added tags to old storage accounts, the requests were rejected (the whole PUT request is evaluated). Approach: Before enabling Deny, use Audit / DoNotEnforce to produce a list of existing non-compliant resources. Fix the existing resources with modify or remediation tasks first, then switch to Deny. When switching, publish a non-compliance message that explains how to fix the issue. Limit: A PATCH request that only changes tags evaluates only the policies that include a tags condition, but many tools send a full PUT.

Case 2: DINE deployed diagnostic settings, but sent the logs to the wrong workspace

Problem: The workspace parameter of Deploy-Diag-LogsCat was not substituted during templating, so it pointed to a workspace that does not exist, and all remediation tasks failed. Approach: ALZ uses policy_default_values to set parameters such as the Log Analytics workspace uniformly (Module 6). After deployment, check one parameter of a DINE deployment. Limit: Changing an assignment parameter does not automatically redeploy existing diagnostic settings. You need a new remediation task (Module 5).

Case 3: DenyAction protects the user-assigned managed identity used by AMA

Problem: Someone cleaned up a managed identity that “looked unused” and deleted the one used by Azure Monitor Agent, so a whole batch of VMs stopped reporting logs. Approach: ALZ assigns DenyAction-DeleteUAMIAMA on platform by default (definition DenyAction-DeleteResources, with parameters for resource type and name). Limit: It does not protect against deleting the parent subscription of the resource group, or bypassing it by moving resources. RBAC least privilege is still required.

Common errors and fixes

(RequestDisallowedByPolicy) Resource '…' was disallowed by policy. Reasons: '…'. See error details for policy resource IDs.

Cause: A deny (or a modify with conflictEffect=deny) matched. The error details include policyAssignmentName and policyDefinitionId.

az policy assignment list --disable-scope-strict-match --query "[?name=='<assignment>'].{scope:scope,mode:enforcementMode}"
az policy definition show --name <definition> --query policyRule

Fix: Change the request according to the non-compliance message. If the business genuinely needs it, request an exemption (Module 5). Do not delete the assignment directly.

DINE resource has been NonCompliant for a long time, with no deployment

Cause: Existing resources are only marked non-compliant and are not deployed automatically. Or new resources are still within evaluationDelay (default 10 minutes). Or the managed identity lacks permissions, so the deployment fails.

az policy remediation list --query "[].{name:name,state:provisioningState}" -o table
az deployment group list -g <rg> --query "[?starts_with(name,'PolicyDeployment')].{n:name,s:properties.provisioningState}" -o table

Fix: Create a remediation task. Check the managed identity's role assignments.

(RequestDisallowedByPolicy) … policy 'Modify' conflict / The request was denied because of a conflict between modify policies

Cause: Two modify definitions change the same property, and both have conflictEffect set to deny (the default). The request is treated as a conflict and rejected. Existing resources show as Conflicting.

Fix: Merge them into one definition, or set conflictEffect to audit on one of them. For tag inheritance policies, avoid using both add and addOrReplace to modify the same tag.

Deleting resource group failed: … was disallowed by policy (denyAction)

Cause: The resource group contains resources protected by denyAction, and cascadeBehaviors.resourceGroup is deny (the default).

az policy state list --resource-group <rg> --filter "complianceState eq 'Protected'" --query "[].resourceId" -o tsv

Fix: First confirm that you really want to delete it. Then request an exemption, or remove the protection tag or delete the assignment. Do not temporarily elevate permissions to bypass this.

Command-line exercises
1. View the allowed effect values and the default effect of definition 404c3081-…
az policy definition show --name 404c3081-a854-4457-ae30-26a93ef643f9 \
  --query "{allowed:parameters.effect.allowedValues, default:parameters.effect.defaultValue}"
2. List the deployments in rg-lz-myapp-cc that were created by DINE / remediation tasks.
az deployment group list -g rg-lz-myapp-cc --query "[?starts_with(name,'PolicyDeployment')].name" -o tsv
Scenario analysis
landingzones has both: Modify (inherits costCenter from the resource group when it is missing) and Deny (resources must have costCenter). The resource group has costCenter=CC-1001. A user creates a Key Vault with no tags at all. What happens? What if the resource group itself has no costCenter either?

Case 1: In the evaluation order, modify runs before deny, so the request gets costCenter=CC-1001 added, the deny condition no longer holds, and creation succeeds. Case 2: modify reads an empty resource group tag and cannot fill in a valid value (the inheritance policy's condition is not met, or no valid value can be filled in), so deny matches and returns 403. This is exactly the point of combining “Deny on the resource group + Modify on the resource”: the resource group level guarantees there is always a value to inherit.

Verified teaching videos

No verified English video that specifically explains the evaluation order of Azure Policy effects was found. The following are the official documentation and a video storyboard.

Official documentation

Video storyboard (about 100 seconds)

Shot 1 · 0–20s
Visual: a PUT request envelope enters ARM, facing seven gates in a row: disabled, modify, deny, audit, manual, AINE, and denyAction.
Narration: Before the request reaches the resource provider, the policy engine evaluates every applicable assignment in a fixed order.
Shot 2 · 20–45s
Visual: the modify gate attaches a costCenter tag to the envelope. Then the deny gate checks the tag and gives a green light.
Narration: modify comes before deny because the rewritten request may already be compliant. deny comes before audit, so the same request is not both rejected and audited.
Shot 3 · 45–70s
Visual: another envelope has https set to false. The deny gate drops, and a red 403 is returned.
Narration: When deny matches, the request ends immediately, and the later steps are not executed.
Shot 4 · 70–100s
Visual: the resource is created successfully, a timer counts down 10 minutes, and the DINE robot deploys diagnostic settings using the managed identity. Meanwhile, a DELETE request is blocked by the denyAction shield.
Narration: After a successful request, DINE waits for the evaluation delay before deploying companion resources. denyAction, on the other hand, specifically blocks deletion to protect critical resources.
Or score ≥ 70% on the quiz

Module 5 · Remediation tasks, managed identities, and exemptions

28:00 – 35:00 · New resources are handled by policy at request time, while existing resources need remediation tasks. Real exceptions should not be handled by deleting an assignment or using notScopes. Use exemptions that have an expiry and an approval record instead.
7 minresourceCount ≤ 50,000 · parallelDeployments 1–30Expired exemptions are not deleted; they just stop applying★★★★☆
Learning objectives
  • Explain the scope of remediation tasks (only modify and deployIfNotExists), their parameters (resourceCount, parallelDeployments, failureThreshold, resourceDiscoveryMode, location filters), and their limits.
  • Configure a system-assigned or user-assigned managed identity for an assignment, and grant it access by roleDefinitionIds. Understand that “evaluation uses the caller's identity, and deployment uses the assignment's identity.”
  • Create an exemption: category Waiver / Mitigated, expiresOn, exempting only some members of an initiative, and metadata that records the approval. Know the permissions the creator needs.
  • Distinguish exclusion (notScopes) from exemption. Know that assignmentScopeValidation: DoNotValidate is used to exempt resources in advance before a subscription migration.
Prerequisites: Module 2's Modify assignments and Module 4's DINE. Importance: ★★★★☆

What: remediation task

New or updated resources are handled automatically at request time by modify / DINE. Existing non-compliant resources found in the evaluation cycle are not changed automatically. You must create a remediation task (Microsoft.PolicyInsights/remediations). A remediation task performs a modify operation or a DINE template deployment on the selected resources, using the assignment's managed identity.

ParameterDefault / rangeDescription
policyAssignmentIdRequiredFull ID of the assignment (definition or initiative assignment)
policyDefinitionReferenceIdRequired for initiative assignmentsA remediation task can remediate only one member of an initiative
resourceCountDefault 500, maximum 50,000Maximum number of non-compliant resources to remediate in this run
parallelDeploymentsDefault 10, range 1–30Number of deployments to run at the same time. Up to 100 remediation tasks can run in parallel for the same definition / reference.
failureThreshold.percentageDefault 100% (that is, continue even when failures occur)The task fails if the failure ratio exceeds the threshold
resourceDiscoveryModeExistingNonCompliant (default)ReEvaluateCompliance: rescan this assignment first, then remediate the non-compliant resources found
FilterLocationRemediate only resources in certain regions (for example, fix canadaeast first)

Status values: Running, Canceled, Cancelling, Failed, Complete, Succeeded. The task also has a deploymentSummary (total, succeeded, failed). Parameters cannot be changed after a task is created. Azure Policy deletes the task resource 60 days after it was last modified.

Managed identities and authorization

  • Each assignment can be linked to one managed identity (system-assigned or user-assigned), but that identity can have multiple roles.
  • A system-assigned identity requires a location (it cannot be global, and it cannot be changed later). The location does not affect how it works in Azure Policy.
  • When you create an assignment in the portal, access is granted automatically based on roleDefinitionIds in the definition. With CLI / SDK / IaC, you must create the role assignments yourself. If you change a definition's roleDefinitionIds, you must grant the access manually, even in the portal.
  • A typical case that needs extra access: a DINE deployment targets something outside the assignment scope (for example, a private endpoint in corp must write a DNS record into the private DNS zone in the connectivity subscription). ALZ's Deploy-Private-DNS-Zones therefore needs access granted on the connectivity subscription.
  • Benefits of user-assigned identities: multiple assignments share one identity, roles are managed centrally, and access can be granted in advance (common in large ALZ deployments, and supported by avm-ptn-alz). The cost: the identity has broader permissions and must be strictly protected (the DenyAction approach from Module 4 applies here too).

What: exemption

{
  "properties": {
    "policyAssignmentId": "/providers/Microsoft.Management/managementGroups/landingzones/providers/Microsoft.Authorization/policyAssignments/lab-gov-baseline",
    "policyDefinitionReferenceId": [ "rgNaming" ],
    "exemptionCategory": "Waiver",
    "expiresOn": "2026-12-31T23:59:00.0000000Z",
    "displayName": "Legacy RG naming until migration",
    "metadata": { "requestedBy": "team-myapp", "approvedBy": "platform-ccoe", "ticketRef": "CHG-2026-1182" },
    "assignmentScopeValidation": "Default"
  }
}
PropertyDescription
exemptionCategoryMitigated: the policy's intent is already met in another way (for example, a third-party WAF replaces the App Gateway WAF). Waiver: non-compliance is temporarily accepted (a risk accepted with an expiry).
expiresOnAfter expiry, the exemption is not deleted. The object is kept for the record, but no longer applies.
policyDefinitionReferenceIdExempts only some members of an initiative (an array)
resourceSelectorsNarrows the exemption by location or type. It also supports identity-based exemptions with userPrincipalId / groupPrincipalId.
assignmentScopeValidation(Preview) DoNotValidate allows an exemption to be created outside the assignment scope. This is used to exempt resources in advance before a subscription moves into a new MG, so the move is not blocked by policy.
PermissionsYou need Microsoft.Authorization/policyExemptions/write on the scope being exempted, and exempt/Action on the target assignment. The built-in Resource Policy Contributor and Security Admin roles have read and write access.

Exclusion vs exemption

Exclusion (notScopes)Exemption (exemption)
Where it is configuredOn the assignment itself (owned by the assignment owner)A separate resource attached to the exempted scope
Whether it counts toward complianceNot evaluated, not countedCounted, with status Exempt. It also has complianceSubState, which shows “what the state would be without the exemption.”
GranularityWhole assignmentCan target only some members of an initiative
Expiry and approval informationNoneexpiresOn, metadata
Typical useStructural scope division (this type of workload never applies)Temporary or mitigated exception for individual resources
Common misconceptions ① “Remediation tasks can fix audit / deny non-compliance.” They can only remediate modify and DINE. ② “A Waiver is deleted automatically when it expires.” It is not deleted. It just stops applying, so you must clean it up regularly. ③ “If you own the resource group, you can create an exemption for it.” You also need exempt/Action on the target assignment. This prevents application teams from giving themselves a backdoor. ④ “Using notScopes is simpler for handling exceptions.” It makes exceptions invisible, leaves them out of compliance reporting, and gives them no expiry, so they cannot be explained during an audit.

Sequence diagram: how remediation tasks work

Operator / pipelinePolicyInsightsAssignment's managed identityARM / resources remediation create (refId, count, parallel) Fetch the list of non-compliant resources by discoveryMode Batches of parallelDeployments each modify: PATCH tags / properties DINE: PolicyDeployment_… template deployment Success / failure (403 = identity lacks permissions) deploymentSummary; failure rate > failureThreshold → Failed After the next evaluation, the resource becomes Compliant (or after an on-demand scan)
Figure 5-1: remediation tasks run modify or deployments in batches using the assignment's managed identity

Comparison diagram: exclusion vs exemption

notScopes (exclusion) local MG: not evaluated • Invisible in compliance reports• Changed by the assignment owner• No expiry, no approval record exemption stmyapp…: Exempt (Waiver) • Counted toward compliance, status Exempt + substatus• Requires exempt/Action permission• expiresOn + metadata (ticket, approver)
Figure 5-2: use exclusion for structural scope division, and exemption for individual-resource exceptions

Interactive animation: remediation task execution simulator

Set the parameters and press Play. The simulator processes resourceCount non-compliant resources in batches of parallelDeployments. Checking “managed identity lacks role” makes some deployments fail with 403. Observe how failureThreshold decides the final status of the task.

Set the parameters, then click Run.
$ az policy remediation create --name rem-costcenter --policy-assignment lab-inherit-costcenter --management-group landingzones

Core commands and parameters

CommandPurposeKey parameters / notes
az policy remediation createCreate a remediation task--name --policy-assignment (ID or name), --definition-reference-id, --management-group|--resource-group, --resource-discovery-mode ExistingNonCompliant|ReEvaluateCompliance, --resource-count, --parallel-deployments, --failure-threshold, --location-filters
az policy remediation show / listView status and summary--query "{state:provisioningState, summary:deploymentStatus}"
az policy remediation deployment listDeployment result for each resourceThe failure reason is in the error field
az policy remediation cancelCancel a running taskCompleted deployments are not rolled back
az policy assignment identity assignAdd a managed identity to an existing assignment--system-assigned or --user-assigned <id>, --identity-scope --role
az policy exemption createCreate an exemption--name --policy-assignment --exemption-category Waiver|Mitigated --expires-on --policy-definition-reference-ids --scope|--resource-group --metadata
az policy exemption listList exemptions--disable-scope-strict-match lists inherited exemptions

1) Remediate the existing resources for lab-inherit-costcenter on landingzones

az policy remediation create --name rem-costcenter-$(date +%m%d) --management-group landingzones \
  --policy-assignment /providers/Microsoft.Management/managementGroups/landingzones/providers/Microsoft.Authorization/policyAssignments/lab-inherit-costcenter \
  --resource-discovery-mode ExistingNonCompliant --parallel-deployments 10 --failure-threshold 0.2
az policy remediation show --name rem-costcenter-$(date +%m%d) --management-group landingzones \
  --query "{state:provisioningState, summary:deploymentStatus}" -o json
{
  "state": "Succeeded",
  "summary": { "failedDeployments": 0, "successfulDeployments": 3, "totalDeployments": 3 }
}

When creating a remediation task at the MG scope, use --management-group. You can also create it at the subscription or resource group scope (which remediates only resources in that scope). In the CLI, the failure threshold parameter is expressed as a decimal ratio. Refer to az policy remediation create --help for details.

2) Create a time-limited exemption for the storage account (targeting only lab-deny-st-http)

ASSIGN=/providers/Microsoft.Management/managementGroups/landingzones/providers/Microsoft.Authorization/policyAssignments/lab-deny-st-http
ST_ID=$(az storage account show -n $ST -g rg-lz-myapp-cc --query id -o tsv)
az policy exemption create --name lab-st-http-waiver --scope "$ST_ID" \
  --policy-assignment "$ASSIGN" --exemption-category Waiver \
  --expires-on "$(date -u -d '+7 days' +%Y-%m-%dT%H:%M:%SZ)" \
  --display-name "Legacy client needs HTTP until 2026-11-25" \
  --metadata requestedBy=team-myapp approvedBy=platform-ccoe ticketRef=CHG-2026-1182
{
  "exemptionCategory": "Waiver",
  "expiresOn": "2026-11-25T10:30:00+00:00",
  "name": "lab-st-http-waiver",
  "policyAssignmentId": "/providers/Microsoft.Management/managementGroups/landingzones/providers/Microsoft.Authorization/policyAssignments/lab-deny-st-http"
}

3) List exemptions expiring within 30 days (routine governance check)

az graph query -q "policyresources
| where type == 'microsoft.authorization/policyexemptions'
| extend expires = todatetime(properties.expiresOn), category = tostring(properties.exemptionCategory)
| where isnotnull(expires) and expires < now(30d)
| project name, category, expires, scope = tostring(split(id, '/providers/Microsoft.Authorization/policyExemptions/')[0])" -o table

Lab: fix existing tags + create a time-limited exemption

Goal and setup: deliberately create existing non-compliant resources and fix them with a remediation task. Then create a 7-day Waiver for one storage account and verify that the Deny is exempted. Cost: two empty storage accounts, almost 0. Permissions: Resource Policy Contributor on landingzones. Creating an exemption also requires exempt/Action on the assignment (Owner has it).
1. Create existing non-compliance: temporarily switch the inherited assignment to DoNotEnforce, then create a storage account with no tags.
LZ=/providers/Microsoft.Management/managementGroups/landingzones
az policy assignment update --name lab-inherit-costcenter --scope "$LZ" --enforcement-mode DoNotEnforce
sleep 300   # Wait for the assignment change to take effect (about 5 minutes)
ST2=stmyapplegacy$RANDOM
az storage account create -n $ST2 -g rg-lz-myapp-cc -l canadacentral --sku Standard_LRS
az storage account show -n $ST2 -g rg-lz-myapp-cc --query tags   # Expected: {} (or null)
az policy assignment update --name lab-inherit-costcenter --scope "$LZ" --enforcement-mode Default
2. Trigger an evaluation and confirm non-compliance
az policy state trigger-scan --resource-group rg-lz-myapp-cc
az policy state list --resource-group rg-lz-myapp-cc \
  --filter "policyAssignmentName eq 'lab-inherit-costcenter' and complianceState eq 'NonCompliant'" \
  --query "[].resourceId" -o tsv
/subscriptions/…/resourceGroups/rg-lz-myapp-cc/providers/Microsoft.Storage/storageAccounts/stmyapplegacy23817
3. Run the remediation task (item 1 on the Commands tab. To shorten the wait, you can also create it at the resource group scope: replace --management-group landingzones with --resource-group rg-lz-myapp-cc). When complete:
az storage account show -n $ST2 -g rg-lz-myapp-cc --query tags
{ "costCenter": "CC-1001" }
4. Exemption: run item 2 on the Commands tab. After about 5 minutes:
az storage account update -n $ST -g rg-lz-myapp-cc --https-only false     # This should now succeed
az policy state list --resource-id "$ST_ID" --filter "policyAssignmentName eq 'lab-deny-st-http'" \
  --query "[].{state:complianceState}" -o table
State
------
Exempt
Cleanup (the exemption stops applying after 7 days, but the object still exists, so delete it proactively)
az storage account update -n $ST -g rg-lz-myapp-cc --https-only true
az policy exemption delete --name lab-st-http-waiver --scope "$ST_ID"
az storage account delete -n $ST2 -g rg-lz-myapp-cc --yes

Case 1: all Private DNS zone DINE remediations fail with 403

Problem: Private endpoints in corp should automatically register records in the private DNS zone in the connectivity subscription through Deploy-Private-DNS-Zones, but all remediation tasks failed. Root cause: The assignment is on corp, and the managed identity has permissions only in corp, while the target DNS zone is in the connectivity subscription (outside the assignment scope). Approach: Grant Private DNS Zone Contributor to the assignment's identity on the rg-alz-dns-cc resource group (avm-ptn-alz handles this case through an extra role assignment). Limit: After changing the access, you must rerun the remediation task.

Case 2: an exemption became a “permanent backdoor”

Problem: An audit found 300 exemptions. 200 of them had no expiry and no ticket number. Approach: The policy requires every Waiver to set an expiresOn no more than 90 days out and to record the ticket number in metadata. A weekly Resource Graph report lists exemptions that are expiring or have no expiry. Only the platform team holds exempt/Action. Limit: A Mitigated exemption can have no expiry, but the mitigation still needs to be reviewed regularly for effectiveness.

Case 3: exempt a subscription in advance before moving it into corp

Problem: An acquired subscription has NICs with public IPs. Moving it into corp would inherit Deny-Public-IP-On-NIC, and then any update to those NICs would be rejected. Approach: Create an exemption against the corp assignment at the subscription's current location, and set assignmentScopeValidation: DoNotValidate (preview). Move the subscription, then delete the exemption after the planned remediation. Limit: This is a preview feature. Confirm its support status before using it in production.

Common errors and fixes

Remediation task state Failed — deployment error: The client '…' with object id '…' does not have authorization to perform action '…/write' (AuthorizationFailed)

Cause: The assignment's managed identity lacks a role in roleDefinitionIds, or the target resource is outside the assignment scope.

PID=$(az policy assignment show --name <assignment> --scope "$LZ" --query identity.principalId -o tsv)
az role assignment list --assignee "$PID" --all -o table
az policy remediation deployment list --name <task> --management-group landingzones --query "[?status=='Failed'].error.message" -o tsv

Fix: Grant the required role at the correct scope, wait a few minutes (Entra replication), then rerun the remediation task.

(InvalidCreateRemediationRequest) … policyDefinitionReferenceId is required for initiative assignments

Cause: The remediation task was created for an initiative assignment without specifying a member.

Fix: Add --definition-reference-id <refId>. If an initiative has multiple DINE members, create a separate task for each member.

(AuthorizationFailed) … does not have authorization to perform action 'Microsoft.Authorization/policyAssignments/exempt/action'

Cause: Creating an exemption requires the exempt permission on the target assignment. A resource group Owner does not necessarily have this permission on the MG where the assignment lives.

Fix: Have the platform team create it through the exemption process, or grant a custom role that includes this action to the approving group.

Remediation task Succeeded, but the resource still shows NonCompliant

Cause: Compliance data is updated only at the next evaluation. Or the corrected value still does not meet the condition (for example, the resource group itself has no costCenter, so the inherited value is empty).

az policy state trigger-scan --resource-group rg-lz-myapp-cc
az group show -n rg-lz-myapp-cc --query tags

Fix: Trigger an on-demand scan. Fix the upstream data (resource group tags) first, then remediate.

Command-line exercises
1. For the hypothetical DINE member diagSettings of initiative assignment lab-gov-baseline, create a remediation task that remediates only resources in canadaeast, and rescan first.
az policy remediation create --name rem-diag-ce --management-group landingzones \
  --policy-assignment /providers/Microsoft.Management/managementGroups/landingzones/providers/Microsoft.Authorization/policyAssignments/lab-gov-baseline \
  --definition-reference-id diagSettings --location-filters canadaeast \
  --resource-discovery-mode ReEvaluateCompliance
2. List all Waivers on landingzones that have no expiry date set.
az graph query -q "policyresources | where type == 'microsoft.authorization/policyexemptions'
| where properties.exemptionCategory =~ 'Waiver' and isnull(properties.expiresOn)
| project name, id" --management-groups landingzones -o table
Scenario analysis
An application team protects its web app with a third-party WAF, so it does not comply with ALZ's Audit-AppGW-WAF. They request adding their subscription to the assignment's notScopes. How do you handle this?

Do not change notScopes. This is an exception for one workload, and the policy's intent (WAF protection) is already met in another way. Create a Mitigated-category exemption scoped to that subscription or its relevant resource group. In metadata, record the alternative solution and the approval ticket, and schedule a regular review (for example, every 6 months). This way, the subscription shows as Exempt in the compliance report, and the reason can be traced during an audit. If the third-party WAF is removed later, deleting the exemption restores evaluation.

Verified teaching videos

No verified English video that specifically explains remediation tasks and exemptions was found. The following are the official documentation and a video storyboard.

Official documentation

Video storyboard (about 90 seconds)

Shot 1 · 0–20s
Visual: on the compliance dashboard, a row of red existing resources, with the caption “evaluation only marks, it does not modify.”
Narration: modify and DINE handle only new resources automatically at request time. Existing resources need remediation tasks.
Shot 2 · 20–45s
Visual: the remediation task splits 24 resources into batches of 10. Managed identity badges are stamped one by one and turn green. Two cross-subscription resources turn red with 403.
Narration: Remediation tasks use the assignment's managed identity. When you create assignments from the command line, remember to grant it the roles defined in the definition.
Shot 3 · 45–70s
Visual: an exemption form showing Waiver, the expiry date, and the ticket number. The resource status changes from red to grey Exempt.
Narration: Exemptions have a category, an expiry, and an approval record, and they count toward compliance statistics. When they expire, they are not deleted. They just stop applying.
Shot 4 · 70–90s
Visual: notScopes “cuts out” a whole area, and it disappears from the report. An exemption stays visible in the report.
Narration: Use exclusions for structural scope division and exemptions for individual exceptions. Do not use exclusions to hide exceptions.
Or score ≥ 70% on the quiz

Module 6 · The ALZ policy library and version management

35:00 – 42:00 · ALZ's hundreds of definitions and dozens of default assignments are not handwritten in your repository. They come from a library published with calendar versions. Learn to read it, reference it, change it without forking, and upgrade it at a steady pace.
7 minplatform/alz/2026.11.0Azure/alz 0.22.1 · avm-ptn-alz 0.23.0★★★★☆
Learning objectives
  • Describe the directory structure of platform/alz in Azure-Landing-Zones-Library: policy definitions, initiatives, assignments, role definitions, archetypes, architecture, and the default-values file.
  • Understand how resolution works: “architecture → each MG's archetype → a set of assignments,” and how placeholders (managementGroups/placeholder, ${default_location}) get replaced.
  • Read versions: library tags platform/alz/<year>.<month>.<patch>, the definition's metadata.version, deprecation and supersededBy, and the assignment's definitionVersion.
  • Know the three customization methods: policy_default_values, policy_assignments_to_modify, and archetype overrides in a custom library, and define an upgrade process.
Prerequisites: Modules 3–5; Terraform basics. Importance: ★★★★☆

What: what the ALZ library is

Azure/Azure-Landing-Zones-Library is the “data” of ALZ. It deploys nothing. Instead, it provides a set of JSON assets that a deployment tool reads and then deploys (the Terraform Azure/alz provider with the avm-ptn-alz module, or the Bicep AVM implementation). The same repository contains other libraries: platform/slz (Sovereign Landing Zone) and platform/amba (Azure Monitor Baseline Alerts).

Path (platform/alz/…)ContentsScale in 2026.11.0
policy_definitions/*.alz_policy_definition.jsonALZ custom policy definitionsThe root archetype references 149
policy_set_definitions/*.alz_policy_set_definition.jsonCustom initiatives (such as Enforce-Guardrails-* and Deploy-Private-DNS-Zones)44
policy_assignments/*.alz_policy_assignment.jsonAssignment templates (names ≤ 24 characters, scopes are placeholders)root 17, platform 40, landingzones 53, corp 5…
role_definitions/Custom roles (such as Network-Subnet-Contributor and Application-Owners)5
archetype_definitions/*.alz_archetype_definition.jsonarchetype = a set of definitions + initiatives + assignments + roles12 (root, platform, landing_zones, corp, online, local, sandbox, security, management, connectivity, identity, decommissioned)
architecture_definitions/alz.alz_architecture_definition.jsonMG hierarchy: each MG's id, display name, parent, and archetype12 MGs, plus the intermediate root alz
alz_policy_default_values.jsonDefault names for parameters shared across assignmentslog_analytics_workspace_id, private_dns_zone_subscription_id, ama_user_assigned_managed_identity_id, ddos_protection_plan_id, email_security_contact, and so on

How: from the library to Azure, the resolution process

  1. Download: the provider downloads the library using library_references (path = "platform/alz", ref = "2026.11.0"), and can layer a local custom library on top (custom_url = "${path.root}/lib"). The download cache is stored in the .alzlib directory (add it to .gitignore).
  2. Select the architecture: the module variable architecture_name = "alz" (or your custom alz_custom), and parent_resource_id = the tenant ID (the intermediate root attaches directly under the tenant root group).
  3. Expand archetypes: each MG's archetype lists the definitions, initiatives, assignments, and roles it deploys. Definitions and initiatives are deployed to the intermediate root, and assignments are deployed to their respective MGs.
  4. Replace placeholders: replace /providers/Microsoft.Management/managementGroups/placeholder in assignments with the real MG. Replace ${default_location} with location. Replace {enforcementMode} in non-compliance messages with must / should. Fill the values in policy_default_values into all assignment parameters that reference that default name.
  5. Calculate role assignments: for assignments with managed identities (DINE / Modify), generate role assignments based on roleDefinitionIds in the definition. The provider needs to read built-in definitions (a cache file can speed this up).
  6. Deploy: the module uses the azapi provider to create MGs, definitions, assignments, and role assignments (avm-ptn-alz 0.23.0 depends on azure/alz ~> 0.21 and Azure/azapi ~> 2.12).

Three levels of version management

LevelFormExample
Library versionGit tag platform/alz/YYYY.MM.patch (calendar version)platform/alz/2026.10.0 (2026-10-05) → 2026.11.0 (2026-11-06)
Custom definition versionmetadata.version; when deprecated: deprecated: true, the display name gets [Deprecated], and supersededBy points to the new nameEnforce-Guardrails-Automation (1.1.0-deprecated) is replaced by Enforce-Guardrails-Automation_20260910
Built-in definition versiondefinitionVersion in an assignment (such as 2.*.*)Audit-ResourceRGLocation references built-in definition 0a914e76-… with definitionVersion: "2.*.*"

Changes in 2026.11.0 (official release notes): Deploy-Diag-LogsCat now defaults to allLogs (previously audit), keeping its display name and assignment name. The deletion protection policies for activity logs and resource diagnostic settings changed from Indexed to All mode (diagnostic setting resources are now evaluated too). The Windows VM Hotpatch guardrail moved from the Automation initiative to the Compute initiative, and Enforce-Guardrails-Automation_20260910 was added. The default Automation guardrail assignment now uses the new initiative, and the old initiative is kept but deprecated. Changes like these are why you should read the release notes and run a plan before upgrading.

Why new initiatives have a date suffix: membership changes in an initiative may require different managed identity roles or parameters. Publishing under a new name and deprecating the old one keeps existing assignments unchanged until the upgrade. During the upgrade, the tool switches assignments to the new definition, rather than modifying an object that is already being referenced in place.

When: how to choose among the three customization methods

NeedMethodExample
Fill in shared parameterspolicy_default_valueslog_analytics_workspace_id = the ID of law-alz-mgmt-cc
Change the mode / parameters / message / exclusions of a default assignmentpolicy_assignments_to_modify (by MG → assignment name)Set Deny-Public-Endpoints to DoNotEnforce; change parameters for Enforce-ALZ-Sandbox
Add or remove an archetype's assignments / definitions*.alz_archetype_override.json in the custom library lib/ (base_archetype + policy_assignments_to_add/remove, and so on)Add this hour's lab-gov-baseline to landingzones
Change the hierarchy (add or remove MGs)Custom architecture definitionRemove local if you don't need it (careful: the more it differs from upstream, the harder upgrades become)
Common misconceptions ① “Fork the library and edit the JSON directly, since that's the most flexible.” Then every upstream release requires a manual merge, and you end up stuck on an old version. Prefer default values, modify variables, and archetype overrides. ② “A library upgrade is just a version number change.” It may add or replace initiatives, change modes and default parameters, so you must read the release notes and review the plan. ③ “Point ref at the main branch to get the latest fixes.” Production must be pinned to a tag. ④ “The provider is 0.x, so it's fine to upgrade freely.” 0.x means minor versions can also contain breaking changes, so pin the minor version (for example ~> 0.22.0).

Structure diagram: how library assets combine

policy_definitions (149) policy_set_definitions (44) policy_assignments role_definitions (5) archetype × 12root / landing_zones / corp …+ your archetype overrides architecture “alz”MG id / parent / archetypealz → platform → …12 MGs alz providerReplace placeholdersFill in default valuesCalculate role assignments↓avm-ptn-alz (azapi) Inputlibrary_references = platform/alz@2026.11.0 + ./libpolicy_default_values · policy_assignments_to_modify · subscription_placement
Figure 6-1: definitions / initiatives / assignments / roles → archetype → architecture → provider resolution → module deployment

Flow diagram: library upgrade process

Read the release notesNew / deprecated / mode changes Change the ref on a branch2026.10.0 → 2026.11.0 terraform planReview replacements and role changes Apply in a non-production tenantCheck compliance and denial events Apply in production + remediateNew DINE needs a remediation task
Figure 6-2: it is recommended to follow up on library versions monthly or quarterly, separately from provider / module upgrades

Interactive animation: library resolution and version upgrade comparison

The “Resolve” mode shows step by step how the provider turns platform/alz@2026.11.0 into objects in Azure. The “Upgrade comparison” mode shows the changes that would appear in the plan when upgrading from 2026.10.0 to 2026.11.0 (based on the official release notes).

Choose a mode to start.
$ terraform plan

Core commands and configuration

Command / configurationPurposeNotes
git clone --depth 1 --branch platform/alz/2026.11.0 https://github.com/Azure/Azure-Landing-Zones-Library.gitGet the library at a specific versionTag names contain a slash, so they are passed as the branch argument
jq '.policy_assignments' …archetype_definition.jsonView the assignments for an archetypeUse diff to compare two versions
provider "alz" { library_references = [...] }Library references and custom librariesThe provider is at 0.x, so pin the minor version
module "alz" { source = "Azure/avm-ptn-alz/azurerm" }Deployment architectureversion = "0.23.0"; variables below
alzlibtool cache createGenerate the built-in definition cache file--library platform/alz@2026.11.0 --architecture alz --output alzlib-cache.json.gz
az policy definition list --management-group alz --query "[?metadata.deprecated]"Find deployed deprecated definitionsClean up leftovers after upgrading

1) View the corp archetype in the library and one of its assignments

git clone -q --depth 1 --branch platform/alz/2026.11.0 https://github.com/Azure/Azure-Landing-Zones-Library.git alzlib-2611
cd alzlib-2611/platform/alz
jq -r '.policy_assignments[]' archetype_definitions/corp.alz_archetype_definition.json
jq '{name, def: .properties.policyDefinitionId, mode: .properties.enforcementMode, msg: .properties.nonComplianceMessages}' \
  policy_assignments/Deny-Public-IP-On-NIC.alz_policy_assignment.json
Audit-PeDnsZones
Deny-HybridNetworking
Deny-Public-Endpoints
Deny-Public-IP-On-NIC
Deploy-Private-DNS-Zones
{
  "name": "Deny-Public-IP-On-NIC",
  "def": "/providers/Microsoft.Authorization/policyDefinitions/83a86a26-fd1f-447c-b59d-e51f44264114",
  "mode": "Default",
  "msg": [ { "message": "Network interfaces {enforcementMode} not have a public IP associated." } ]
}

2) Terraform: reference the library, set default values, and change one default assignment

terraform {
  required_providers {
    alz   = { source = "azure/alz",   version = "~> 0.22.0" }
    azapi = { source = "Azure/azapi", version = "~> 2.12" }
  }
}
provider "alz" {
  library_references = [
    { path = "platform/alz", ref = "2026.11.0" },
    { custom_url = "${path.root}/lib" }          # local archetype override
  ]
}
data "azapi_client_config" "current" {}

module "alz" {
  source             = "Azure/avm-ptn-alz/azurerm"
  version            = "0.23.0"
  architecture_name  = "alz_custom"               # custom architecture based on alz in lib/
  parent_resource_id = data.azapi_client_config.current.tenant_id
  location           = "canadacentral"
  policy_default_values = {
    log_analytics_workspace_id = jsonencode({ value = "/subscriptions/<mgmt-sub>/resourceGroups/rg-alz-mgmt-cc/providers/Microsoft.OperationalInsights/workspaces/law-alz-mgmt-cc" })
  }
  policy_assignments_to_modify = {
    corp = {
      policy_assignments = {
        "Deny-Public-Endpoints" = { enforcement_mode = "DoNotEnforce" }   # trial run first
      }
    }
  }
}

This section is a configuration example. For full provider authentication, management and connectivity resource modules, and the pipeline, see Hour 6. The value of policy_default_values must be jsonencode({ value = … }); this is the convention the module uses to work around Terraform type system limits.

3) Archetype override: add one assignment to landing_zones

// lib/landing_zones_custom.alz_archetype_override.json
{
  "name": "landing_zones_custom",
  "base_archetype": "landing_zones",
  "policy_assignments_to_add": [ "lab-gov-baseline" ],
  "policy_assignments_to_remove": [],
  "policy_set_definitions_to_add": [ "lab-gov-baseline" ],
  "policy_definitions_to_add": [ "lab-deny-rg-naming" ]
}

The matching definition, policy set definition, and assignment JSON also go under lib/ (with file name suffixes such as .alz_policy_definition.json). In your custom architecture, make landingzones use landing_zones_custom.

Lab: read the library, compare two versions, and find the changes you need to watch

Goal and environment: work only on your local machine and do not change the tenant. You need git and jq. Cost: 0.
1. Get two versions
mkdir -p ~/alz-lab/lib-compare && cd ~/alz-lab/lib-compare
for v in 2026.10.0 2026.11.0; do
  git clone -q --depth 1 --branch platform/alz/$v https://github.com/Azure/Azure-Landing-Zones-Library.git $v
done
ls 2026.11.0/platform/alz
README.md  alz_library_metadata.json  alz_policy_default_values.json  architecture_definitions
archetype_definitions  policy_assignments  policy_definitions  policy_set_definitions  role_definitions  scripts
2. Count the assignments for each archetype
cd 2026.11.0/platform/alz
for f in archetype_definitions/*.json; do
  printf "%-18s %3s\n" "$(jq -r .name $f)" "$(jq '.policy_assignments|length' $f)"
done
connectivity         1
corp                 5
decommissioned       1
identity             4
landing_zones       53
local                1
management           0
online               0
platform            40
root                17
sandbox              1
security             0
3. Compare the changes between the two versions
cd ~/alz-lab/lib-compare
diff -rq 2026.10.0/platform/alz 2026.11.0/platform/alz | sed 's#.*/platform/alz/##' | head -20
jq '{def: .properties.policyDefinitionId, params: .properties.parameters}' 2026.11.0/platform/alz/policy_assignments/Deploy-Diag-LogsCat.alz_policy_assignment.json
jq '.properties.metadata | {deprecated, supersededBy, version}' \
  2026.11.0/platform/alz/policy_set_definitions/Enforce-Guardrails-Automation.alz_policy_set_definition.json
{
  "deprecated": true,
  "supersededBy": "Enforce-Guardrails-Automation_20260910",
  "version": "1.1.0-deprecated"
}
4. Write an upgrade assessment: based on the diff and release notes, list ① which assignments reference definitions that are being replaced (Enforce-GR-Automation0 moves to the new policy set definition); ② which definitions change their mode (the evaluation scope grows, so new non-compliance may appear); ③ which default parameters change (diagnostic categories change to allLogs, so Log Analytics data volume and cost may rise). Put these three points in the change request.
5. (Optional) Compare a deployed tenant: if you deployed ALZ with the accelerator in hour 1, run az policy set-definition list --management-group alz --query "[?metadata.deprecated].name" to find deployed policy set definitions that are deprecated. Cleanup: rm -rf ~/alz-lab/lib-compare.

Case 1: the library was forked and not upgraded for two years

Problem: The team forked the old Enterprise-Scale policies and edited the JSON directly. Later they wanted the new guardrail policy set, but found hundreds of conflicting files. Approach: go back to the upstream library tag; move the custom changes into policy_default_values, policy_assignments_to_modify, and archetype overrides; use plan to confirm "no changes" before accepting the new version. Limit: the old Terraform module caf-enterprise-scale is archived, so migration must follow the official migration guide (hour 6).

Case 2: log costs doubled after the upgrade

Problem: After upgrading to 2026.11.0, the diagnostic settings changed from the audit category to allLogs, and Log Analytics data volume rose sharply. Approach: read the release notes before upgrading; to keep the original behavior, override the category parameter of that assignment with policy_assignments_to_modify; also review the workspace table plans and retention period (hour 5). Limit: after you change the parameters, the remediation task must also update existing diagnostic settings.

Case 3: phased rollout with DoNotEnforce first

Problem: Enabling Deny-Public-Endpoints on corp all at once would block many configuration updates to existing PaaS resources. Approach: on the first deployment, set it to DoNotEnforce with policy_assignments_to_modify, fix the workloads one by one using the compliance report, then remove the override to return to Default. Limit: during DoNotEnforce, new resources are not blocked either, so pair it with the policy checks in the pipeline (hour 6).

Common errors and fixes

Error: … failed to fetch library … platform/alz@2026.11.0 … (git / go-getter)

Cause: the runtime cannot reach GitHub (proxy or offline pipeline proxy), or the ref is wrong (for example, written as v2026.11.0 or platform/alz/2026.11.0).

Fix: for ref, use only the version number 2026.11.0. In offline environments, download the library in advance and point custom_url to the local directory.

Error: … policy assignment … parameter 'logAnalytics' … value is empty / placeholder

Cause: no value was provided for a policy_default_values default name, so the assignment parameter kept its placeholder value.

jq -r '.defaults[].default_name' ~/alz-lab/lib-compare/2026.11.0/platform/alz/alz_policy_default_values.json

Fix: provide values for the default names you use (workspace ID, private DNS zone subscription and resource group, AMA identity, and so on).

(PolicyDefinitionInUse / PolicySetDefinitionInUse) … cannot be deleted because it is referenced by assignments

Cause: during the upgrade, the tool tried to delete the replaced old definition, but an assignment in the tenant (possibly created by hand) still references it.

az policy assignment list --disable-scope-strict-match --scope /providers/Microsoft.Management/managementGroups/alz \
  --query "[?contains(policyDefinitionId,'Enforce-Guardrails-Automation')].{n:name,s:scope}" -o table

Fix: first point the references to the new definition, then delete the old definition. Do not let manual assignments reference definitions in the library.

terraform plan shows many role assignments as "replace" (destroy / create)

Cause: the roleDefinitionIds of the definition changed, or the module changed how it names role assignments (for example, role_assignment_name_use_random_uuid).

Fix: read the module changelog. Apply in a non-production tenant first. During replacement, remediation tasks may fail briefly, so schedule the change in a maintenance window.

Command-line exercises
1. In the local library, find all deprecated policy set definitions and their replacements.
cd ~/alz-lab/lib-compare/2026.11.0/platform/alz
for f in policy_set_definitions/*.json; do
  jq -r 'select(.properties.metadata.deprecated==true) | "\(.name) -> \(.properties.metadata.supersededBy)"' "$f"
done
2. Find all assignments in the landing_zones archetype that have a system-assigned managed identity (these need to be corrected and authorized).
for a in $(jq -r '.policy_assignments[]' archetype_definitions/landing_zones.alz_archetype_definition.json); do
  jq -r 'select(.identity.type=="SystemAssigned") | .name' policy_assignments/$a.alz_policy_assignment.json
done
Scenario analysis
Your organization does not need a local management group, and you don't want Enable-DDoS-VNET on landingzones (there is no DDoS plan). At the same time, you need to add this hour's lab-gov-baseline to corp. Design the implementation without forking the library.

In lib/: ① a custom architecture alz_custom that copies the official hierarchy but removes local (or keeps it with no subscriptions, to reduce differences from upstream); ② a landing_zones_custom archetype override: base_archetype = landing_zones, policy_assignments_to_remove = ["Enable-DDoS-VNET"]; ③ a corp_custom override that adds the lab-gov-baseline definitions, policy set definitions, and assignments. The provider's library_references references both platform/alz@2026.11.0 and ./lib, and the module uses architecture_name = "alz_custom". When you upgrade, change only the ref; the overrides layer on top of the new version automatically.

Verified video

No verified English video dedicated to the ALZ library and version management was found. The following are official resources and a storyboard script.

Official resources

Video storyboard script (about 90 seconds)

Shot 1 · 0–20s
Visual: the GitHub repository folder expands: policy_definitions, policy_set_definitions, policy_assignments, archetype_definitions, architecture_definitions.
Narration: The ALZ library is data, not a deployment script. The deployment tool reads it, then replaces the placeholders and fills in the default values.
Shot 2 · 20–45s
Visual: each of the 12 MG nodes in the architecture takes in an archetype card, and each card holds a list of assignments.
Narration: Each management group maps to one archetype. The archetype decides which assignments are deployed on that management group.
Shot 3 · 45–70s
Visual: the version tag flips from 2026.10.0 to 2026.11.0, and the plan output shows a "new policy set" and a "[Deprecated]" marker.
Narration: The library is released on a calendar-based version schedule. Before upgrading, read the release notes, review the plan, and watch for replacements, mode changes, and parameter defaults.
Shot 4 · 70–90s
Visual: the local lib folder sits as a transparent layer on top of the upstream library.
Narration: Customize with default values, assignment modification variables, and archetype overrides instead of forking. That way, an upgrade only requires changing one version number.
or score ≥ 70% on the quiz

Module 7 · Compliance reports and Azure Resource Graph queries

42:00 – 50:00 · Assigning a policy does not mean the environment is compliant. Read the compliance states and percentages, know when the data updates, then use Resource Graph to answer governance questions across all subscriptions.
8 minpolicyresources · resourcecontainers · resourcesup to 1,000 rows per request · default about 15 calls / 5 s★★★★★
Learning goals
  • State the compliance states (Compliant, Non-compliant, Exempt, Conflicting, Error, Protected, Unknown, Not started, Not registered), and the aggregation priority and percentage formula.
  • Know the evaluation triggers and their delays: new assignments apply in about 5 minutes, resource changes are visible in about 15 minutes, subscription placement takes about 30 minutes, the standard cycle is 24 hours, and on-demand scans are available.
  • Use az policy state summarize / list to get compliance data, and az graph query to query policyresources, resourcecontainers, and resources across management groups.
  • Write 5 KQL queries commonly used for governance, and know how Resource Graph paging and throttling work.
Prerequisites: Modules 3–5; basic KQL (where, project, summarize, join). Importance: ★★★★★

What: compliance state

StateMeaning
Non-compliantaudit / AINE / modify: new, changed, and existing resources that meet the if condition; append / deny / DINE: existing resources that meet the condition (new requests are already denied or corrected at request time)
CompliantCondition not met (for DINE / AINE, the existence condition is met)
ExemptWithin the exemption scope; the sub-state shows the state with the exemption removed
ConflictingConflicting rules exist within the same scope (for example, two modify rules set different values for the same tag)
ErrorTemplate or evaluation error
ProtectedOverridden by a denyAction assignment
UnknownDefault state for the manual effect; waiting for manual attestation
Not started / Not registeredNot yet evaluated, or Microsoft.PolicyInsights is not registered or you have no permission to read it; not counted in the aggregation

Aggregation priority (when a resource has several states within a policy set, the "strongest" one wins): Non-compliant > Compliant > Error > Conflicting > Protected > Exempted > Unknown. So if a resource is non-compliant with any one rule in the policy set, its overall state is non-compliant. A resource where only one rule is exempted and the rest are compliant shows as compliant overall.

Compliance percentage = (compliant + exempt + unknown + protected)
          / (compliant + exempt + unknown + non-compliant + conflicting + error + protected)

When: when the data updates

TriggerDelay (official description)
New assignment / assignment updateApplies to the scope in about 5 minutes, then evaluation starts. There is no fixed completion time for large scopes.
Resource created or updatedThe effect events and compliance state for that resource become visible in about 15 minutes (this does not trigger evaluation of other resources)
Subscription created or moved to an MG (for subscription-type policies)About 30 minutes
Exemption created / updated / deletedThe assignment is re-evaluated for the exemption scope
Standard evaluation cycleEvery 24 hours
On-demand scanaz policy state trigger-scan (subscription or resource group, asynchronous); GitHub Action azure/policy-compliance-scan

How: Azure Resource Graph (ARG)

ARG is a cross-subscription resource index. It is queried with a subset of KQL, returns results in seconds, and does not consume the read quotas of each resource provider. The tables most used for governance:

TableContentsGovernance use
resourcesMost ARM resourcesTag coverage, inventory by type and region
resourcecontainersSubscriptions, resource groups, management groupsSubscription placement (managementGroupAncestorsChain), resource group tags
policyresourcesmicrosoft.policyinsights/policystates, microsoft.authorization/policyassignments, policydefinitions, policysetdefinitions, policyexemptions, policydefinitions/versions, and so onCompliance reports, exemption expiry, assignment inventory
resourcechanges / resourcecontainerchangesResource change history (recent)Who changed what to cause the non-compliance
advisorresources, healthresources, authorizationresourcesAdvisor recommendations, resource health, role assignments, and so onSupplementary data for governance reviews
  • Scope: az graph query queries, by default, the subscriptions you have permission to read; --management-groups alz queries the whole hierarchy; with more than 10,000 subscriptions, only the first 10,000 are returned.
  • Paging: each response returns up to 1,000 rows (--first max 1000); for more results, continue with --skip-token.
  • Throttling: quotas are allocated per user and per time window (documented example: 15 calls every 5 seconds). The response headers x-ms-user-quota-remaining and x-ms-user-quota-resets-after show the quota state. For bulk reports, combine queries and stagger their timing.
  • Permissions: ARG returns only the data you have read permission for. The reporting identity needs Reader on alz (compliance data also requires Policy Insights read permission, which Reader already includes).
Common misconceptions ① "The compliance page shows 100% right after an assignment, so everything is compliant." It may still be Not started or under evaluation. ② "Exempt resources don't count toward the percentage." They count in both the numerator and the denominator, so many exemptions can make the percentage look good while the risk is unchanged. Report exemption counts separately. ③ "ARG is real-time." Resource changes usually appear quickly, but compliance state depends on the policy evaluation cycle. ④ "az policy state list can query the whole tenant." It queries by subscription, MG, or resource group scope. For cross-hierarchy summary reports, ARG is more efficient.

Data flow: where compliance data comes from

Evaluation triggerOn request / 24-hour cycleOn-demand scan / exemption changes Policy enginePer resource × per assignment→ one policy state record Microsoft.PolicyInsightspolicyStates (latest)policyEvents (events)remediations Portal / az policystate / event Resource Graphpolicyresources Resource indexresourcesresourcecontainers KQL joinCompliance × subscription name× MG × tags Activity log (AzureActivity):deny / audit / modify / DINE eventsCan be connected to Log Analytics for alerts
Figure 7-1: policy state is stored in PolicyInsights and can be joined with resource, subscription, and management group data in the policyresources table of ARG.

Aggregation example: one resource, one policy set

rgNaming: Compliant rgLocations: Exempt rgEnvTag: Compliant Overall: Compliant rgNaming: Compliant rgEnvTag: NonCompliant Overall: Non-compliant
Figure 7-2: aggregation by priority. Any non-compliant result makes the overall result non-compliant. Compliant ranks above Exempt.

Interactive animation: KQL query builder

Choose a governance question. The animation builds the query one operator at a time and explains what each step does to the data, then shows a sample result. You can copy the final query into Resource Graph Explorer or az graph query -q to use it (results are sample data).

Start after choosing a question.
// KQL
// Sample result

Core commands and parameters

CommandPurposeKey parameters / notes
az policy state summarizeSummarize non-compliant resource counts by assignment or definition--management-group, --subscription, --top
az policy state listIndividual compliance records--filter "complianceState eq 'NonCompliant'", --apply (OData aggregation), --select
az policy state trigger-scanOn-demand evaluationSubscription (default) or --resource-group; --no-wait
az policy event listEvaluation events (who, when, what effect)--from, --to
az graph queryResource Graph query-q, --management-groups, --subscriptions, --first (≤1000), --skip-token
az graph shared-query createSave a shared query (available in the portal)Good for sharing governance reports with the team

1) Top 5 non-compliant assignments under landingzones

az policy state summarize --management-group landingzones --top 5 \
  --query "policyAssignments[].{assignment:policyAssignmentId, nonCompliant:results.nonCompliantResources}" -o table
Assignment                                                                                      NonCompliant
----------------------------------------------------------------------------------------------  ------------
/providers/Microsoft.Management/managementGroups/landingzones/…/policyAssignments/lab-gov-baseline        4
/providers/Microsoft.Management/managementGroups/landingzones/…/policyAssignments/Deploy-VM-Monitoring    2
/providers/Microsoft.Management/managementGroups/landingzones/…/policyAssignments/lab-inherit-costcenter  1

2) ARG: compliance percentage by subscription (simplified: only Compliant / NonCompliant / Exempt)

az graph query --management-groups alz -q "
policyresources
| where type == 'microsoft.policyinsights/policystates'
| extend state = tostring(properties.complianceState), subId = tostring(properties.subscriptionId)
| summarize total = count(), ok = countif(state in ('Compliant','Exempt')) by subId
| join kind=leftouter (resourcecontainers | where type == 'microsoft.resources/subscriptions'
    | project subId = subscriptionId, subName = name) on subId
| project subName, total, ok, pct = round(100.0 * ok / total, 1)
| order by pct asc" -o table
SubName               Total    Ok    Pct
--------------------  -------  ----  -----
sub-lz-corp-myapp     212      196   92.5
sub-alz-connectivity  148      145   98.0
sub-alz-management    131      131   100.0

This is a record-level approximate percentage (each resource × assignment record counts as one). It differs from the portal's resource-level percentage, so state the basis in your report.

3) ARG: costCenter tag coverage for resources

az graph query --management-groups landingzones -q "
resources
| extend cc = tostring(tags['costCenter'])
| summarize total = count(), tagged = countif(isnotempty(cc)) by type
| extend coverage = round(100.0 * tagged / total, 1)
| where coverage < 100 | order by total desc" --first 20 -o table

Lab: cross-management-group compliance and tag report

Goal and environment: within the alz scope, generate three reports: the assignment non-compliance ranking, subscription placement by MG, and resource groups missing costCenter. Then save them as shared queries. Cost: 0. Permissions: Reader on alz is enough.
1. Trigger evaluation first (to avoid looking at old data)
for s in sub-lz-corp-myapp sub-alz-connectivity sub-alz-management sub-alz-identity; do
  az policy state trigger-scan --subscription "$s" --no-wait 2>/dev/null && echo "scan started: $s"
done
2. Report A: assignment non-compliance ranking
az graph query --management-groups alz -q "
policyresources
| where type == 'microsoft.policyinsights/policystates'
| where properties.complianceState == 'NonCompliant'
| extend assignment = tostring(properties.policyAssignmentName), ref = tostring(properties.policyDefinitionReferenceId)
| summarize resources = dcount(tostring(properties.resourceId)) by assignment, ref
| order by resources desc" --first 10 -o table
Assignment              Ref          Resources
----------------------  -----------  ---------
lab-gov-baseline        rgEnvTag     3
lab-gov-baseline        rgNaming     1
lab-inherit-costcenter               1
3. Report B: subscription placement
az graph query --management-groups alz -q "
resourcecontainers
| where type == 'microsoft.resources/subscriptions'
| extend chain = properties.managementGroupAncestorsChain
| project subscription = name, parentMg = tostring(chain[0].name), path = strcat_array(chain, ' < ')" -o table

strcat_array concatenates arrays of objects directly, so the output is long. As an exercise, try mv-apply to keep only the name at each level.

4. Report C: resource groups missing costCenter
az graph query --management-groups landingzones -q "
resourcecontainers
| where type == 'microsoft.resources/subscriptions/resourcegroups'
| where isempty(tostring(tags['costCenter']))
| project resourceGroup = name, subscriptionId, location" -o table
ResourceGroup     SubscriptionId                        Location
----------------  ------------------------------------  -------------
NetworkWatcherRG  00000000-0000-0000-0000-00000000c0a1  canadacentral

NetworkWatcherRG is a resource group created automatically by the platform. It existed before the lab-rg-req-costcenter assignment (or was created by a service), so it is a pre-existing non-compliance. Handle it with an exemption (Mitigated), or add the tag in the pipeline.

5. Save shared queries
az group create -n rg-alz-gov-cc -l canadacentral --tags env=prod owner=platform@contoso.example costCenter=CC-0001 workload=governance 2>/dev/null
az graph shared-query create --name "alz-noncompliant-by-assignment" --resource-group rg-alz-gov-cc \
  --description "ALZ governance report A" --graph-query "policyresources | where type == 'microsoft.policyinsights/policystates' | where properties.complianceState == 'NonCompliant' | summarize count() by tostring(properties.policyAssignmentName)"

Tip: if rg-alz-gov-cc is in sub-alz-management, it sits under platform and is not affected by the lab assignment on landingzones. The shared query resources themselves are free. Cleanup: az group delete -n rg-alz-gov-cc --yes (if you don't need to keep the reports).

Case 1: management only sees "98% compliant"

Problem: The monthly report shows 98% compliance, but a security audit found that 40% of storage accounts allow public network access. Root cause: the related policy is Audit, and most resources are covered by a Waiver exemption. Exempt resources count toward the compliance percentage. Approach: show non-compliant counts, exemption counts, exemptions expiring soon, and Deny block counts together in the report; publish separate metrics for critical controls. Limit: the basis of the percentage (resource-level or record-level) must be stated in the report.

Case 2: report script hit throttling

Problem: A nightly script queries 2,000 subscriptions one by one and frequently receives RateLimiting. Approach: switch to a single query with --management-groups alz, and page with skipToken. If grouping is necessary, keep each group to no more than 300 subscriptions, and back off based on the response headers. Limit: quotas are calculated per user, so multiple scripts sharing one service principal affect each other.

Case 3: use resourcechanges to find who made it non-compliant

Problem: An NSG suddenly appeared in the non-compliant list for Deny-MgmtPorts-Internet (the existing resource was modified another way, or the policy was assigned later). Approach: query resourcechanges for that NSG's recent changes and changedBy, then combine with the activity log to identify the operator. Limit: change history is kept for a limited time. For long-term auditing, export the activity log to Log Analytics.

Common errors and fixes

az graph query: 'graph' is misspelled or not recognized by the system

Cause: the resource-graph extension is not installed.

az extension add --name resource-graph --upgrade
(RateLimiting) Client application has been throttled and should not attempt to repeat the request until an amount of time has elapsed.

Cause: too many queries in a short time, exceeding the user's quota.

Fix: combine queries, use an MG scope, and stagger the timing. Read x-ms-user-quota-resets-after before retrying. If the error message says "Number of 'read' requests for subscription … exceeded", that is ARM throttling, not ARG.

Compliance page shows "Not registered"

Cause: the subscription has not registered Microsoft.PolicyInsights, or the current account has no permission to read compliance data.

az provider register --namespace Microsoft.PolicyInsights --subscription sub-lz-corp-myapp
az provider show -n Microsoft.PolicyInsights --query registrationState -o tsv
Query returns only 1,000 rows, or the numbers don't match the portal

Cause: a single response returns at most 1,000 rows, so paging is needed; or the counting basis differs (record-level vs resource-level, whether Exempt is counted, or the portal counts only applicable resources).

Fix: loop with --skip-token; use summarize in KQL before returning results; count resources with dcount(resourceId).

Command-line exercises
1. List all policy assignments in the alz hierarchy and their enforcement modes (from ARG).
az graph query --management-groups alz -q "policyresources
| where type == 'microsoft.authorization/policyassignments'
| project name, scope = tostring(properties.scope), mode = tostring(properties.enforcementMode)
| order by scope asc" --first 200 -o table
2. List the resources that are Protected (protected by denyAction).
az graph query --management-groups alz -q "policyresources
| where type == 'microsoft.policyinsights/policystates' and properties.complianceState == 'Protected'
| project resourceId = tostring(properties.resourceId), assignment = tostring(properties.policyAssignmentName)" -o table
Scenario analysis
At 09:00 you assigned a new Deny policy set to corp. At 09:10 the compliance page shows 100% compliant, and the product manager announces that "all corp resources meet the new standard." Where could the problem be? How would you confirm it?

A new assignment takes about 5 minutes to apply to its scope, and the following evaluation cycle has no fixed completion time for large scopes. The "100%" at 09:10 most likely means evaluation has not finished (Not started is not counted in the aggregation) or only a small part has been evaluated. To confirm: check whether the resource compliance details for the assignment still show Not started; run az policy state trigger-scan on each subscription and wait for it to finish; use ARG to count the policystates records for this assignment and check whether the count is close to the number of applicable resources. Also note that for existing resources, Deny only marks them non-compliant and does not modify them.

Verified video

No verified English video dedicated to policy compliance reports and Resource Graph governance queries was found. The following are official docs and a storyboard script.

Official docs

Video storyboard script (about 90 seconds)

Shot 1 · 0–20s
Visual: the ring on the compliance dashboard fills up gradually from "evaluating", and the timeline marks 5 minutes, 15 minutes, 30 minutes, and 24 hours.
Narration: Compliance data does not appear instantly. A new assignment applies in about 5 minutes, the standard cycle runs every 24 hours, and an on-demand scan is available when you need results urgently.
Shot 2 · 20–45s
Visual: seven state cards are arranged in a column by priority, with Non-compliant at the top.
Narration: If one resource is non-compliant with any single rule in the policy set, its overall state is non-compliant. Exemptions count toward the compliance percentage, so reports must list exemptions separately.
Shot 3 · 45–75s
Visual: three tables, policyresources, resourcecontainers, and resources, are joined to produce a compliance table by subscription.
Narration: Resource Graph uses KQL to query across all subscriptions, linking compliance records, subscription names, and management groups together.
Shot 4 · 75–90s
Visual: the query is split into pages of 1,000 rows, and a metronome shows 15 calls every 5 seconds.
Narration: Watch the paging and throttling. Combining queries and querying by management group is faster and uses less quota than querying subscription by subscription.
or score ≥ 70% on the quiz

Module 8 · Governance review and common errors

50:00 – 60:00 · Turn the first 7 modules into a repeatable governance review: score it with a checklist, gather evidence with queries, and use a troubleshooting tree to find out why something was denied, why it didn't take effect, or why it can't be fixed.
10 min20-item review checklistinteractive troubleshooting tree★★★★☆
Learning goals
  • Complete a governance review across five dimensions (subscriptions and hierarchy, naming and tags, policy design, exception management, compliance and operations), and give an evidence command for each item.
  • Identify the 10 most common errors in ALZ governance and their consequences.
  • Use the troubleshooting decision tree to handle three kinds of problems: requests being denied, policy not taking effect, and remediation failing.
  • Turn the review results into an actionable improvement plan (owner, deadline, verification method).
Prerequisites: Modules 1–7. Importance: ★★★★☆

What: governance review checklist

DimensionCheck itemEvidence method
Subscriptions and hierarchyNo subscriptions sitting directly under the tenant rootARG: subscriptions where managementGroupAncestorsChain[0] equals the tenant ID
The default MG is not the tenant root; creating MGs requires authorizationaz account management-group hierarchy-settings list
Platform functions (management, connectivity, identity, security) use separate subscriptionsSubscription placement report
No separate MGs created for environments (dev / prod)Hierarchy diagram
Naming and tagsNaming convention documented, IaC generates namesConvention document + module code
Resource groups require costCenter / owner / envaz policy assignment list
Resource costCenter coverage ≥ 95%ARG coverage query (Module 7)
Policy designCustom definitions and policy sets centralized in the intermediate root alzaz policy definition list --management-group alz
Effects parameterized; new policies start with DoNotEnforce or AuditHistory of each assignment's enforcementMode
Every assignment has a non-compliance messageARG: assignments where properties.nonComplianceMessages is empty
Assignments use policy sets rather than many individual definitions (well below the 200 limit)Assignment count per scope
ALZ library pinned to a tag and reviewed within the last 3 monthsref in IaC
Exception managementExceptions use exemptions rather than notScopesInventory of notScopes on assignments
Every Waiver has an expiry date (≤ 90 days) and a ticket numberARG: exemption query
Only the platform team has exempt/ActionRole assignment review
Quarterly review of Mitigated exemptionsReview record
Compliance and operationsDINE / Modify assignments have correct managed identity permissions (including cross-subscription)Remediation task failure rate
Weekly compliance report (non-compliant, exempt, and Deny counts)Shared queries / workbooks
Automatic evaluation and remediation triggered after a new subscription is soldSales pipeline
Policy changes go through PRs and are validated in a non-production tenantRepository and pipeline

Why: 10 common errors

#ErrorConsequenceCorrect approach
1New subscription left in the tenant rootCompletely bypasses ALZ policyDefault MG = sandbox; placed by the sales process
2Create MGs for dev / test / prodHierarchy bloat, duplicated policiesSeparate environments by subscription
3Deny tags on all resources from the startManaged service deployments failDeny on resource groups + Modify on resources
4Custom definitions placed in a child MGCannot be reused on other branchesCentralize in alz
5CLI / IaC creates a DINE assignment without authorizationAll remediation tasks return 403Authorize by roleDefinitionIds, including cross-subscription targets
6Assuming the evaluation cycle will fix existing resources automaticallyStays non-compliant long-termRemediation task
7Handle individual exceptions with notScopesExceptions are invisible and have no expiryExemptions (Waiver / Mitigated)
8Enable Deny directly, without a trial run firstDaily updates to existing resources are deniedDoNotEnforce → fix → Default
9Fork the ALZ library, or point ref at a branchCannot upgrade / not reproduciblePin a tag + overrides
10Looking only at the compliance percentageExemptions hide riskReport exemptions and Deny events together

How: review cadence

  • Weekly: compliance report, exemptions expiring soon, failed remediation tasks.
  • Monthly: assess new ALZ library versions (release notes + plan); guardrail needs for new services.
  • Quarterly: score the full review checklist; review Mitigated exemptions; review the subscription and MG structure.

When: what triggers an ad hoc review

New subscriptions from an acquisition or merger; before a large migration to the cloud; after an audit finds problems; when the ALZ library has breaking changes (for example, policy set replacements or mode changes).

Common misconceptions ① "Deploying the ALZ accelerator means governance is done." The accelerator provides a baseline, but the exception process, reports, and upgrade cadence still need the team to run them. ② "A review just means checking the portal's compliance page." You also need to check structure (subscription placement, notScopes, exemptions) and process (who can grant exemptions, who can change assignments). ③ "Delete the assignment when you find a problem." That removes protection from every scope. Adjust parameters, use an override, or grant an exemption instead.

Review radar: five dimensions

Subscriptions and hierarchy Naming and tags Policy design Exception management Compliance and operations Sample score (full score = outer ring) Score each item 0 / 1 / 2:0 = not done1 = partial / manual2 = done and automated
Figure 8-1: scoring the same dimensions on a regular basis makes trends more meaningful than a single score

Troubleshooting overview: three kinds of problems

Request denied (403)1 Read the policyAssignmentName in the error2 Find the assignment's scope and mode3 Read the non-compliance message and definition conditions4 Change the request or request an exemption (denyAction shows Protected) Policy not taking effect1 Wait 5 minutes / run an on-demand scan2 enforcementMode? notScopes?3 mode: Indexed does not evaluate RGs4 Is the subscription under this MG?5 Is it exempted? Check resourceSelectors Remediation failing1 Is the effect modify / DINE?2 Does the managed identity exist and have roles?3 Is the target outside the scope?4 Are the parameters and default values correct?5 Check the deployment error details
Figure 8-2: the interactive decision tree on the Troubleshooting tab covers these three paths

Interactive animation: governance review scorecard

Score each item for your lab tenant (0 = not done, 1 = partial / manual, 2 = done and automated). The scorecard summarizes results by dimension and generates improvement suggestions ordered by highest risk and easiest to fix. Results are kept only on this page; refreshing clears them.

After scoring, click "Calculate".
// Improvement plan

Review evidence commands

CheckCommand
Orphaned subscriptionsaz graph query -q "resourcecontainers | where type=='microsoft.resources/subscriptions' | where tostring(properties.managementGroupAncestorsChain[0].name)=='<tenant-id>' | project name"
Hierarchy settingsaz account management-group hierarchy-settings list --name <tenant-id>
Assignments per scopeaz graph query -q "policyresources | where type=='microsoft.authorization/policyassignments' | summarize count() by tostring(properties.scope)"
Assignments without non-compliance messagesSee query 1 below
Assignments with notScopesSee query 2 below
Failed remediation tasksaz policy remediation list --management-group alz --query "[?provisioningState=='Failed']"
Library versiongrep -R 'ref *=' *.tf

Query 1: Deny-type assignments without non-compliance messages

az graph query --management-groups alz -q "
policyresources
| where type == 'microsoft.authorization/policyassignments'
| where array_length(properties.nonComplianceMessages) == 0 or isnull(properties.nonComplianceMessages)
| project name, scope = tostring(properties.scope), mode = tostring(properties.enforcementMode)" -o table

Query 2: assignments with excluded scopes (are exceptions being hidden?)

az graph query --management-groups alz -q "
policyresources
| where type == 'microsoft.authorization/policyassignments'
| where array_length(properties.notScopes) > 0
| project name, scope = tostring(properties.scope), notScopes = properties.notScopes" -o json
[
  {
    "name": "lab-gov-baseline",
    "notScopes": [ "/providers/Microsoft.Management/managementGroups/local" ],
    "scope": "/providers/Microsoft.Management/managementGroups/landingzones"
  }
]

Query 3: are the roles for an assignment's managed identity complete? (spot-check one assignment)

A=lab-inherit-costcenter; S=/providers/Microsoft.Management/managementGroups/landingzones
PID=$(az policy assignment show -n $A --scope $S --query identity.principalId -o tsv)
DEF=$(az policy assignment show -n $A --scope $S --query policyDefinitionId -o tsv)
echo "Roles required:"; az policy definition show --name "${DEF##*/}" --query "policyRule.then.details.roleDefinitionIds" -o tsv
echo "Roles present:"; az role assignment list --assignee "$PID" --all --query "[].{role:roleDefinitionName,scope:scope}" -o table

Lab: run a governance review on your lab tenant

Goal: use the evidence commands on the Commands tab to score the 20 review checklist items, and fix at least 3 of them. Cost: 0. Permissions: Reader on alz (fixing requires Owner).
1. Gather evidence and score: run each evidence command in turn, score the items in the scorecard on the animation tab, and click "Calculate" to get the improvement list.
2. Fix example A: add the missing non-compliance message
LZ=/providers/Microsoft.Management/managementGroups/landingzones
az policy assignment non-compliance-message create --name lab-rg-req-costcenter --scope "$LZ" \
  --message "Resource groups must have a costCenter tag (e.g., CC-1001). See platform tagging standard v1."
3. Fix example B: turn the NetworkWatcherRG exception from "ignored" into an exemption
SUB=$(az account show --name sub-lz-corp-myapp --query id -o tsv)
az policy exemption create --name lab-nwrg-mitigated --resource-group NetworkWatcherRG --subscription "$SUB" \
  --policy-assignment "$LZ/providers/Microsoft.Authorization/policyAssignments/lab-rg-req-costcenter" \
  --exemption-category Mitigated --display-name "Platform-managed RG; cost allocated via subscription" \
  --metadata approvedBy=platform-ccoe reviewEvery=quarter
4. Fix example C: confirm there are no orphaned subscriptions and the default MG is set (commands from Module 1).
5. Write the improvement plan: for the remaining items scored 0, write down the owner, deadline, and verification command. Save a screenshot or copy the scorecard results to your team docs as the baseline for next quarter's comparison. Cleanup: exemptions and messages can stay until the capstone lab ends.

Case 1: 60 orphaned subscriptions in the merged tenant

Problem: Subscriptions from an acquired subsidiary moved into the tenant and all landed at the tenant root. Approach: first set the default MG to sandbox to stop new subscriptions from landing at the root. Use ARG to list the orphaned subscriptions, and place and evaluate them in batches by workload (pre-exemptions from Module 5 plus placement from Module 1). After each batch, run an on-demand scan and remediation. Limit: before moving them into corp, assess public exposure, or Deny will block later updates to many resources.

Case 2: audit requires "proof that every exception has an approval"

Approach: convert all exceptions to exemptions, with metadata recording the ticket number and approver. Export the ARG report weekly. Keep only structural exclusions in notScopes, and document the reasons in the standard. Effect: audit evidence collection went from two weeks to one day.

Case 3: review found DINE managed identities with excessive permissions

Problem: To save effort, the identity used by all DINE assignments was granted Owner on alz. Approach: narrow it to the minimum roles defined in roleDefinitionIds. For shared user-assigned identities, apply DenyAction against deletion and PIM review (hour 3). Limit: after narrowing the permissions, re-run the remediation task to confirm that no required roles were missed.

Interactive troubleshooting tree: policy-related issues

Select step by step from the symptom. At the end, you get diagnostic commands and fix suggestions.

Extra: three common errors

(RequestDisallowedByPolicy) … Reasons: 'Management port access from the Internet must be blocked.'

Cause: ALZ's Deny-MgmtPorts-Internet (landingzones, identity) denies NSG rules that allow Internet access to ports such as 22 and 3389.

Fix: use Bastion or Just-in-Time access (hour 4). Do not request an exemption for this.

(InvalidPolicyAssignmentScope) The scope '…' of policy assignment is not within the definition location '…'

Cause: the assignment scope is not below the level where the definition is stored (Module 3).

Fix: move the definition to alz.

Remediation task stuck in Running for hours

Cause: a large number of resources with low parallelism, or the resource deployments in the DINE template are themselves slow, or some deployments are waiting on dependencies.

az policy remediation deployment list --name <task> --management-group landingzones --query "[?status=='Running'].{id:remediatedResourceId,start:createdOn}" -o table

Fix: increase parallelDeployments (≤30), and batch by location filters. If needed, cancel and rebuild in batches.

Command-line exercises
1. Count the assignments on each scope, and find the scope closest to the 200 limit.
az graph query --management-groups alz -q "policyresources
| where type == 'microsoft.authorization/policyassignments'
| summarize assignments = count() by scope = tostring(properties.scope) | order by assignments desc" -o table
2. List all failed remediation tasks in the alz hierarchy.
az policy remediation list --management-group alz --query "[?provisioningState=='Failed'].{name:name, assignment:policyAssignmentId}" -o table
Scenario analysis
Review finding: corp has 15 subscriptions. In 6 of them, Deny-Public-Endpoints is excluded by notScopes, and there is no record explaining why. The compliance percentage is 97%. Write the first three steps of the improvement plan.

① Inventory: use ARG to list the PaaS resources with public endpoints in these 6 subscriptions and assess the risk. Contact the subscription owners to confirm the business reasons. ② Convert: remove these subscriptions from the assignment's notScopes. For resources with a valid reason, create exemptions (use Mitigated where another control compensates, and Waiver with an expiry of ≤ 90 days and a ticket number for temporary acceptance). Resources with no valid reason get fixed directly. If needed, first set the assignment to DoNotEnforce for a short transition period using policy_assignments_to_modify. ③ Reporting and process: add exemption counts, upcoming expirations, and the notScopes list to the report. Require that only the platform team can change notScopes and grant exempt/Action, and review this quarterly.

Verified video

▶
Azure Landing Zones Overview — John Savill's Technical Training
English · a good overall review before the assessment (management groups, subscriptions, policy-driven governance). Details follow the current ALZ docs.

Official docs

Video storyboard script (about 90 seconds)

Shot 1 · 0–20s
Visual: a pentagon radar chart takes shape, and the five dimensions light up one by one.
Narration: A governance review looks at five things: subscriptions and hierarchy, naming and tags, policy design, exception management, and compliance and operations.
Shot 2 · 20–50s
Visual: ten error cards flip over, and the back of each shows the correct approach. For example, "subscription left in the tenant root" flips to "default management group = sandbox".
Narration: The most common mistakes are often simple: subscriptions in the wrong place, Deny turned on too early, forgetting to authorize managed identities, and using exclusions to hide exceptions.
Shot 3 · 50–75s
Visual: the troubleshooting tree has three branches: denied, not taking effect, and can't be fixed.
Narration: For a denial, check the assignment name in the error first. For something that isn't taking effect, check the timing, mode, exclusions, and scope. For something that can't be fixed, check the managed identity and the target scope.
Shot 4 · 75–90s
Visual: calendar marks for weekly, monthly, and quarterly reviews.
Narration: Governance is not a one-time deployment. It is a review and improvement process that runs on a fixed rhythm.
or score ≥ 70% on the quiz

Command cheat sheet

Azure CLI, KQL, and library operations used in this hour, grouped by task
After classaz policy · az graph · az account management-group
Subscriptions and hierarchy
az account management-group subscription add --name corp --subscription <sub>
az account management-group entities list -o table
az account management-group hierarchy-settings create --name <tenant-id> \
  --default-management-group /providers/Microsoft.Management/managementGroups/sandbox \
  --require-authorization-for-group-creation true
az vm list-usage --location canadacentral -o table
Tags
az group create -n rg-lz-myapp-cc -l canadacentral \
  --tags env=prod owner=team@contoso.example costCenter=CC-1001 workload=myapp
az tag update --resource-id <id> --operation Merge --tags workload=myapp
az group list --query "[?tags.costCenter==null].name" -o tsv
Definitions and policy sets
az policy definition create --name <n> --management-group alz --mode All|Indexed \
  --rules rules.json --params params.json
az policy set-definition create --name <n> --management-group alz \
  --definitions defs.json --params params.json
az provider show -n Microsoft.Storage --expand "resourceTypes/aliases" -o json
Assignments
az policy assignment create --name <≤24 characters> --scope <mg-scope> \
  --policy|--policy-set-definition <id> --params '{"p":{"value":…}}' \
  --not-scopes <scope> --enforcement-mode DoNotEnforce \
  --mi-system-assigned --location canadacentral
az policy assignment update --name <n> --scope <s> --enforcement-mode Default
az policy assignment non-compliance-message create --name <n> --scope <s> --message "…"
az policy assignment list --disable-scope-strict-match --resource-group <rg>
Remediation and managed identity
az role assignment create --assignee-object-id <principalId> \
  --assignee-principal-type ServicePrincipal --role Contributor --scope <scope>
az policy remediation create --name <n> --management-group landingzones \
  --policy-assignment <assignment-id> [--definition-reference-id <ref>] \
  [--resource-discovery-mode ReEvaluateCompliance] [--parallel-deployments 10]
az policy remediation show|list|cancel|deployment list …
Exemptions
az policy exemption create --name <n> --scope <resource-or-rg-id> \
  --policy-assignment <assignment-id> --exemption-category Waiver|Mitigated \
  --expires-on 2026-12-31T23:59:00Z [--policy-definition-reference-ids a b] \
  --metadata ticketRef=CHG-… approvedBy=…
az policy exemption list --disable-scope-strict-match
Compliance
az policy state trigger-scan [--resource-group <rg>] [--no-wait]
az policy state summarize --management-group landingzones --top 5
az policy state list --resource-group <rg> --filter "complianceState eq 'NonCompliant'"
az policy event list --resource-group <rg> --from 2026-11-18T00:00:00Z
Resource Graph (KQL)
policyresources
| where type == 'microsoft.policyinsights/policystates'
| where properties.complianceState == 'NonCompliant'
| summarize count() by tostring(properties.policyAssignmentName)

resourcecontainers
| where type == 'microsoft.resources/subscriptions'
| project name, parent = tostring(properties.managementGroupAncestorsChain[0].name)
az graph query --management-groups alz -q "<KQL>" --first 1000 [--skip-token <t>]

Key numbers

ItemValueItemValue
Resource groups per subscription980Tags per resource / RG / subscription50 (key 512 / value 256)
MG hierarchy depthRoot + 6 levels (excluding subscriptions)MGs per tenant10,000
Policy definitions / policy sets / assignments per scope500 / 200 / 200Exemptions per scope1,000
Definition parameters / policy set members / policy set parameters20 / 1,000 / 400notScopes400
Length of assignment name at MG scope≤ 24Remediation task resource countDefault 500, max 50,000
Remediation parallel deployments1–30 (default 10)DINE evaluationDelay defaultPT10M
overrides / resourceSelectors per assignment10 / 10ARG rows returned per response1,000 rows
New assignment takes effect≈ 5 minutesStandard evaluation cycle24 hours

Effect evaluation order (memorize)

disabled → append / modify → deny → audit → manual → auditIfNotExists → denyAction → resource provider → after success, auditIfNotExists / deployIfNotExists

Capstone lab + final quiz: deliver a governance baseline for the myapp landing zone

Combine subscription placement, naming and tags, policy sets, effects, remediation, exemptions, the library, and compliance reporting into a deliverable "governance baseline"
About 45 minSandbox tenant12-question final quiz
Reminder: operate only in a dedicated sandbox tenant. Do not experiment in a production tenant. When the capstone lab is finished, clean up all lab- objects using the last step, and revoke any elevated access.

Scenario

The myapp team (Flask, port 5000) will go live in production in sub-lz-corp-myapp. The platform team must deliver within two days: subscription placement is correct; resource groups must carry four tags, and resources automatically inherit costCenter; resource group naming and region are controlled; storage must use HTTPS; critical resources are protected against accidental deletion; one approved temporary exception; and a compliance report that can be sent weekly. If you have only one subscription, complete all the steps on that subscription and corp.

1. Subscription placement and hierarchy settings: confirm that sub-lz-corp-myapp is in corp. Set the default MG to sandbox and turn on "require authorization to create MGs". Acceptance: the ARG subscription placement report.
2. Tag baseline: on landingzones, assign "Require a tag on resource groups" for env, owner, and costCenter. These can be combined into one policy set lab-tag-baseline, with referenceId telling the three apart. For costCenter and workload, assign "Inherit a tag from the resource group if missing" (managed identity + Contributor). Acceptance: creating a resource group without a tag is denied; new resources automatically get costCenter and workload.
3. Naming and regions: reuse lab-gov-baseline (naming + resource group region + env tag). Run it with DoNotEnforce for one day first (in the lab, you can shorten this to 10 minutes). After reviewing the non-compliance list, switch to Default, and add a non-compliance message for each member.
4. Security guardrails: keep lab-deny-st-http (or ALZ's Deny-Storage-http) on Deny. Use lab-protect-delete (denyAction) to protect the myapp production storage account tagged protect=true. Acceptance: deletion is denied, and compliance shows Protected.
5. Fix existing resources: run a remediation task (ReEvaluateCompliance) once each for lab-inherit-costcenter and the workload inheritance assignment, and record the deploymentSummary.
6. Exception: the legacy integration for myapp needs a resource group myapp-legacy-int (region canadacentral) whose name does not follow the naming convention. It needs a 30-day Waiver exemption for the rgNaming member of lab-gov-baseline, with the ticket number in metadata. The tricky part: the exemption must attach to a scope that already exists, but this resource group cannot be created before the exemption is in place. Approach: ① create a temporary exemption for only rgNaming at the subscription scope, expiring in 1 hour; ② create the resource group; ③ delete the subscription-level temporary exemption, and create the formal 30-day exemption at the resource group scope. Acceptance: other resource groups with non-compliant names are still denied, and myapp-legacy-int shows Exempt.
7. Compliance report: save three shared queries: the assignment non-compliance ranking, resource groups missing tags, and exemptions expiring within 30 days. Acceptance: all three queries run in Resource Graph Explorer.
8. Write as IaC (optional): write the definitions, policy sets, and assignments from steps 2–4 as ALZ library assets in lib/ (definition, policy set, and assignment JSON, plus landing_zones_custom / corp_custom archetype overrides). Validate with terraform plan. Do not apply onto objects you created by hand, to avoid conflicts.
Cleanup
LZ=/providers/Microsoft.Management/managementGroups/landingzones
for a in lab-gov-baseline lab-rg-req-costcenter lab-inherit-costcenter lab-deny-st-http lab-protect-delete lab-tag-baseline lab-inherit-workload; do
  PID=$(az policy assignment show -n $a --scope "$LZ" --query identity.principalId -o tsv 2>/dev/null)
  [ -n "$PID" ] && az role assignment delete --assignee "$PID" --scope "$LZ" 2>/dev/null
  az policy assignment delete -n $a --scope "$LZ" 2>/dev/null && echo "deleted assignment $a"
done
az policy exemption list --disable-scope-strict-match --query "[?starts_with(name,'lab-')].id" -o tsv | \
  xargs -r -n1 az rest --method delete --url "https://management.azure.com{}?api-version=2022-07-01-preview"
for s in lab-gov-baseline lab-tag-baseline; do az policy set-definition delete -n $s --management-group alz 2>/dev/null; done
for d in lab-deny-rg-naming lab-protect-delete; do az policy definition delete -n $d --management-group alz 2>/dev/null; done
az group delete -n rg-lz-myapp-cc --yes --no-wait   # delete this if later hours don't need it
# Revoke elevated access: in the Entra portal "Properties", turn off "Access management for Azure resources", and delete the Owner role that was added at the root MG for the lab

Deleting exemptions uses a generic REST call for multiple scopes. Confirm the api-version against the official docs. You can also delete them one at a time with az policy exemption delete --name … --scope ….

Acceptance checklist

  • ☐ Subscription placement and hierarchy settings are correct; there are no orphaned subscriptions in ARG.
  • ☐ Creating resource groups that have no tag, a non-compliant name, or a non-compliant region is denied, with the custom message shown as the error.
  • ☐ New resources automatically get costCenter and workload; after the remediation task, existing resource coverage is 100%.
  • ☐ HTTP storage accounts are denied; deletion of the protected storage account is denied, and its state is Protected.
  • ☐ One Waiver exemption with an expiry date and a ticket number; compliance shows Exempt.
  • ☐ The three shared queries run, and the report lists both non-compliant counts and exemption counts.

Open-ended self-check (6 questions)

1. Why does ALZ recommend the "Deny on resource groups + Modify on resources" tag combination instead of Deny on all resources?

Resource groups are created explicitly by people or pipelines, so requiring the tag there is practical. Resources are created by many tools and managed services (including automatically created NICs, disks, and resources in managed resource groups), so a direct Deny would cause deployment failures. Modify is evaluated before deny, so it can read the value from the resource group and fill in the tag. This keeps coverage high without blocking deployments. Existing resources are fixed with a remediation task.

2. Explain how notScopes and exemptions appear differently in compliance reports, and give one use case for each.

Scopes listed in notScopes are not evaluated and do not appear in the report. They suit structural divisions (for example, a policy set that does not apply to the local MG). Exempted resources are still counted, with the state Exempt and a sub-state. They suit individual exceptions, such as a Mitigated third-party WAF or a Waiver during a migration.

3. A DINE assignment ran fine when created in the portal, but after rebuilding it with Terraform, all remediation tasks fail. What could be the causes?

The portal automatically grants the managed identity the roles listed in roleDefinitionIds. With Terraform, the role assignments must be created explicitly (avm-ptn-alz handles this, but it is easy to miss when you write your own resources). The target resource may be outside the assignment's scope (for example, a private DNS zone in the connectivity subscription), which needs extra authorization. Parameter defaults (such as the workspace ID) may not be filled in. The new identity may not have finished replicating in Entra yet.

4. Describe the steps to upgrade the ALZ library from 2026.10.0 to 2026.11.0, and the changes you would watch closely.

Read the release notes → change the ref in a branch → review the plan → apply in a non-production tenant and watch compliance and denials → apply to production → run remediation tasks for the new DINE and parameter changes. Watch for: Deploy-Diag-LogsCat defaulting to allLogs (data volume and cost); the delete-protection policy's mode changing from Indexed to All (a change in evaluation scope); and the Automation guardrail now using the new policy set Enforce-Guardrails-Automation_20260910 (the old policy set is deprecated).

5. Can DenyAction replace resource locks? Explain the pros and cons of each.

Partly. DenyAction is deployed uniformly at the MG level and can match a batch of resources by type, name, or tag. It is hard for a single subscription Owner to bypass, and it shows Protected in compliance. However, it only supports delete, and it does not prevent subscription deletion or the cascading deletion of parent resources. Resource locks can block deletion or make a resource read-only. They are configured per resource, and anyone with permission can remove a lock. For critical resources, you can combine both.

6. Design the metrics for a weekly governance report, and explain why you should not rely on the compliance percentage alone.

Metrics: non-compliant resource counts per subscription or MG (resource-level), the non-compliance ranking by assignment, Deny blocks this week (from the activity log), total exemptions and the number expiring within 30 days, the number of Waivers without an expiry date, remediation task failure counts, the number of orphaned subscriptions, and costCenter coverage. The compliance percentage counts Exempt in the numerator and is affected by Not started, so using it alone hides risk.

Sources and versions

Sources for all facts, verification dates, and known limitations
Verified 2026-11-18

Sources table

TopicSourcePage date / versionVerified on
Subscription design guidance (including the separate security subscription and tenant transfer limits)CAF: Subscription considerations2025-12-192026-11-18
Subscriptions, resource groups, MGs, Policy limitsAzure subscription and service limitsCurrent version2026-11-18
Naming length and character rules (including ≤24 for MG-scope assignment names)Naming rules and restrictions2026-08-072026-11-18
CAF resource abbreviations (log, afw, mg…)Abbreviation recommendations2026-11-142026-11-18
Built-in tag and region policy IDsAzure/azure-policy built-in Tags · Generalmaster2026-11-18
Effects list and evaluation orderEffect basics2025-12-012026-11-18
denyAction / modify / deployIfNotExistsdenyAction · modify · DINE2025-12-012026-11-18
Assignment structure (definitionVersion, overrides, resourceSelectors, Enroll)Assignment structure2026-09-182026-11-18
Remediation tasks and managed identitiesRemediate resources · Remediation structure2025-122026-11-18
Exemption structureExemption structure2026-08-042026-11-18
Compliance states, aggregation, and percentages; evaluation triggersCompliance states · Get compliance data2026-032026-11-18
Resource Graph tables, throttling, and pagingSupported tables · Throttling guidance2026-08-192026-11-18
ALZ library structure, architecture definitions, archetypes, and assignmentsAzure-Landing-Zones-Library (platform/alz)2026.11.0 (2026-11-06)2026-11-18
2026.11.0 release notesReleases2026-11-062026-11-18
alz provider configuration and cachingterraform-provider-alz (docs/index.md)0.22.1 (2026-11-03)2026-11-18
avm-ptn-alz variables and dependenciesTerraform Registry0.23.0 (2026-11-18)2026-11-18

Video verification notes

The video section lists only English videos whose titles and channels were verified through YouTube oEmbed (https://www.youtube.com/oembed?url=…&format=json):

  • R-5oeguxFpo "Azure Landing Zones - How many subscriptions should I use in Azure?" — Azure Verified Modules (Module 1)
  • mluS8ovuBKg "Azure Landing Zones Overview" — John Savill's Technical Training (Modules 1, 8)

No topic videos that pass verification were found for Modules 2–7. Storyboard scripts are provided for use with a video generation tool.

Voice notes

The Voice tab uses the browser's Web Speech API to read the English narration script aloud, with English terms read in an English voice. The result depends on the voice packs installed on your operating system. Without a voice pack, you can read the script directly or use another TTS tool.

Known limitations

  • None of the cloud commands were run in a real tenant: the commands were written from the official docs and CLI help. Output, IDs, times, and counts are examples. For some CLI parameters (such as the failure threshold format for remediation tasks, or CLI support for overrides), refer to az … --help.
  • The default assignment counts for ALZ (root 17, platform 40, landingzones 53, corp 5, and so on) come from the library platform/alz/2026.11.0. Other versions will differ. You will only see these assignments in your tenant if you deployed the ALZ default policies.
  • The compliance delays (about 5 / 15 / 30 minutes, 24 hours) are typical values from the official description. Large environments may take longer.
  • The Resource Graph throttling quotas are example values from the documentation and can change with conditions. The compliance percentage query is a record-level approximation.
  • Features related to assignmentScopeValidation and the Enroll enforcement mode depend on the current status in the official docs (some are in preview).
  • The "Verified on 2026-11-15" label in the sidebar is the date the page skeleton was generated. This hour's content was verified on 2026-11-18.