Azure Policy
definitions · initiatives · assignments · effects · remediation · exemptions
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
Building blocks
| Object | What it is |
|---|---|
| Policy definition | JSON business rules. Each definition has a single effect. |
| Initiative (policySet) | A group of definitions. The CLI and PowerShell call it PolicySet. |
| Assignment | Applies a definition or initiative at a scope: management group, subscription, resource group or resource. |
- Child resources inherit an assignment. Exclude a subscope with notScopes (up to 400 exclusions per assignment).
- Assignments always use the latest definition. Editing a definition changes all of its assignments.
- A policy can be assigned at a management group, but only resources at subscription or resource group level are evaluated.
- Policy vs RBAC: Policy checks the state of a resource regardless of who made the change. RBAC controls who can act. Even with RBAC permission, a non-compliant create or update is blocked by Policy.
- Azure Policy is an explicit-deny system. A more permissive child assignment can't override a management group deny. Exclude the child and assign the permissive policy there.
- Layering is cumulative, and the most restrictive result wins. Each assignment is evaluated independently.
- Microsoft recommends: start with audit or auditIfNotExists before enforcement effects; create definitions high (management group or subscription) and assign lower; use initiatives even for one policy.
- Built-in examples: Allowed locations, Allowed resource types, Not allowed resource types, Allowed storage account SKUs and Allowed VM SKUs (all Deny); Add a tag to resources (Modify).
Effects
| Effect | What it does | Remediation task? |
|---|---|---|
| deny | Blocks the create or update | No |
| audit | Allows the change and logs it. Assesses the resource's own properties | No |
| auditIfNotExists | Assesses a related, child or extension resource | No |
| append | Alters the request | No |
| modify | Alters the request. Can fix existing resources | Yes |
| deployIfNotExists | Deploys a related resource after the create or update | Yes |
- Other effects listed on Microsoft's page: addToNetworkGroup, denyAction, disabled, manual and mutate.
- Order of evaluation: disabled, then append and modify, then deny, then audit, then manual, then auditIfNotExists, then denyAction. After the resource provider succeeds, auditIfNotExists and deployIfNotExists evaluate.
When evaluation happens
- A resource is created or updated in a scope that has an assignment.
- A policy or initiative is newly assigned to a scope.
- An assigned policy or initiative is updated.
- The standard compliance cycle, every 24 hours.
- Effects primarily affect a resource when it is created or updated. Existing non-compliant resources can be brought into compliance through remediation, which applies to deployIfNotExists and modify policies.
Remediation
- Remediation tasks apply only to deployIfNotExists and modify, on existing resources.
- A task runs as the assignment's managed identity (system-assigned or user-assigned). Each assignment can have only one managed identity, which can hold several roles. The existence condition is evaluated with the caller's identity.
- The portal grants the identity the roles in
roleDefinitionIdsautomatically. With the SDK, CLI or PowerShell you grant them yourself. If roleDefinitionIds change later, grant the roles manually even in the portal. - Custom definitions need
roleDefinitionIdsindetails. - Create a task from Policy › Remediation, from a non-compliant assignment in Compliance (Create Remediation Task), or on the assignment's Remediation tab. Track tasks on Remediation › Remediation tasks.
| Setting | Range | Default |
|---|---|---|
| FailureThreshold | 0-100 | 100% |
| ResourceCount | Up to 50,000 | 500 |
| ParallelDeploymentCount | 1-30 | 10 |
Exemptions and exclusions
| Exclusion (notScopes) | Exemption | |
|---|---|---|
| What it does | Removes a subscope from the assignment | Exempts a resource hierarchy or resource; resources stay tracked and show state Exempt |
| Time limit | Not described as time-bound | Optional expiresOn. The exemption isn't deleted at expiry, it is just no longer honored |
| Categories | Not applicable: categories are an exemption property | Waiver (temporary acceptance) or Mitigated (intent met another way) |
- Creating an exemption needs
Microsoft.Authorization/policyExemptions/writeplus theexempt/Actionverb on the assignment. Resource Policy Contributor and Security Admin have read and write. policyAssignmentIdis a string.policyDefinitionReferenceIdis an array that exempts specific policies inside an initiative.
Roles
| Role | Policy access |
|---|---|
| Owner | Full |
| Resource Policy Contributor | Most Policy operations |
| Contributor | Read. Can trigger remediation. Can't create or update definitions and assignments |
| Reader | Read |
| User Access Administrator | Needed to grant a deployIfNotExists or modify assignment's managed identity its roles |
Policy definitions, initiatives and assignments are readable by all roles over the scope.
Limits
| Item | Value |
|---|---|
| Policy definitions per scope | 500 |
| Initiative definitions per scope / tenant | 200 / 2,500 |
| Assignments per scope | 200 |
| Exemptions per scope | 1,000 |
| Exclusions (notScopes) per assignment | 400 |
| Policies per initiative | 1,000 |
| Parameters per policy definition | 20 |
| Compliance evaluation cycle | Every 24 hours |
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Assign with a managed identity | az policy assignment create ... --mi-system-assigned --location <loc> | New-AzPolicyAssignment ... -IdentityType SystemAssigned -Location <loc> |
| Create a remediation task | az policy remediation create --name myRemediation --policy-assignment <id> | Start-AzPolicyRemediation -Name myRemediation -PolicyAssignmentId <id> |
| Get a definition | az policy definition show | Get-AzPolicyDefinition |
Manual role grant: copy the assignment's managed identity name from the Assignment ID, then add the role in IAM.
Exam Tips
Tick each tip once you can answer it without looking.
“Only allow deployments in West Europe and North Europe” → Assign the built-in Allowed locations (Deny) at the subscription or management group. Trap: an RBAC role can't restrict regions; Policy checks the resource's state.
“Existing resources need a required tag” → Modify policy plus a remediation task. Trap: Deny is an enforcement effect; remediation applies only to deployIfNotExists and modify.
“Roll out a new policy safely” → Start with audit or auditIfNotExists, enforce later. Trap: deny is an enforcement effect, and Microsoft recommends audit or auditIfNotExists first to track the impact.
“Remediation task fails with an authorization error” → Grant the assignment's managed identity the roleDefinitionIds roles. Trap: giving the user more rights doesn't help; the task runs as the managed identity.
“Assignment created with the CLI or PowerShell: who gets the identity roles?” → You grant them manually; the portal grants them automatically. Trap: assuming the CLI does it for you.
“Which effects can be remediated?” → deployIfNotExists and modify. Trap: remediation applies only to deployIfNotExists and modify, so deny and audit aren't remediated.
“User needs to create policy assignments, but Contributor can't” → Resource Policy Contributor (or Owner). Trap: Contributor can trigger remediation but can't create or update definitions and assignments.
“Grant the identity of a deployIfNotExists assignment its roles” → User Access Administrator or similar role-assignment rights. Trap: Microsoft names User Access Administrator for granting the identity its roles.
“Exclude one resource group from a subscription-wide assignment” → Exclusion (notScopes) on the assignment. Trap: an exemption is for cases where the resource should still be tracked, and can be time-bound.
“Time-limited relief for one VM, still shown as Exempt” → Exemption with category Waiver and expiresOn. Trap: an exclusion removes a subscope from the assignment; Microsoft recommends exemptions for time-bound scenarios where the resource should still be tracked.
“Exempt a resource from only two policies inside an initiative” → Use the policyDefinitionReferenceId array on the exemption.
“A child assignment is more permissive than the management group deny” → It doesn't override: exclude the child at the parent and assign the permissive policy there. Trap: the lowest scope doesn't win; Policy is an explicit-deny system.
“One assignment says Deny, another says Audit, same condition” → Deny wins: layering is cumulative and most restrictive. Trap: the nearest scope doesn't decide the result.
“Policy assigned at a management group: what is evaluated?” → Resources at subscription or resource group level under it.
“Compliance data looks out of date” → The full cycle runs every 24 hours, and also runs on create, update and new assignments. Trap: results aren't instant.
“Remediate 20,000 resources in one task” → Raise ResourceCount (default 500, up to 50,000).
“You edit a policy definition: what happens to existing assignments?” → They use the updated definition automatically. Trap: they don't need to be reassigned.
“audit vs auditIfNotExists” → audit assesses the resource's own properties; auditIfNotExists assesses a related, child or extension resource.
Sources
Checked against Microsoft Learn on November 13, 2026.