Skip to content
Cloud Governance Tools

Azure Policy blocks only when the effect is deny, so effect, enforcement mode and scope decide what a guardrail does

Azure Policy evaluates resources against definitions and acts through an effect: deny, audit, modify or deployIfNotExists. Enforcement mode, assignment scope at management groups and exemptions then decide where and when the effect applies. This guide covers each, with the documented behavior and the traps.

See the ranking ยท All guides

Each definition has one effect, and only some effects block

Each Azure Policy definition has a single effect in its policy rule, and the effect decides what happens on a match. The deny effect prevents a resource request that does not match standards: for a Resource Manager mode, the request is returned as a 403 Forbidden before it reaches the resource provider. For existing resources, a match is marked non-compliant.

The audit effect creates a warning event in the activity log and marks the resource non-compliant, but it does not stop the request. Library entries such as Allowed locations for new resources take the effect as a parameter, so the same definition can audit first and deny later. Switching a definition from audit to deny is then a parameter change at assignment, with no rewrite of the rule.

Modify and deployIfNotExists fix a resource instead of refusing it

The modify effect adds, updates or removes properties or tags on a resource during creation or update, and a remediation task can fix existing resources. A deployIfNotExists definition runs a template deployment after the resource provider returns success, when the related resource is missing. Assignments with either effect require a managed identity to remediate. Microsoft also notes that PATCH requests that only modify tags limit evaluation to policies whose conditions inspect tags.

Evaluation order matters. Azure checks disabled first, then append and modify, then deny, then audit. Because modify runs before deny, a change it makes can prevent a deny or audit from triggering. Deploy diagnostic settings for Key Vault to Event Hub is a library example of the deploy pattern. Grant that managed identity the permissions the template or the change requires before you assign the policy, not after the first failed remediation.

Enforcement mode lets you assign a policy without enforcing it

The enforcementMode property controls the outcome on resources without initiating the effect or writing activity log entries. The default value is Default, which enforces on create and update. DoNotEnforce evaluates the assignment and reports compliance but does not enforce the effect. The mode applies to the assignment, not the definition, so one definition can be enforced in production and unenforced in a test subscription at the same time.

Microsoft documents DoNotEnforce as useful for testing a new assignment, reviewing compliance impact or validating logic before enforcement. Remediation tasks for deployIfNotExists can still be started in DoNotEnforce. A third value, Enroll, enforces only on resources enrolled in the assignment, which suits adding subscopes in batches. When no enrollment resource exists for a scope, evaluation behaves as if the assignment were DoNotEnforce by default, though Microsoft says that behavior is configurable.

Assign at a management group and let it inherit

Management groups are a governance scope above subscriptions, and conditions applied to a management group cascade by inheritance to all of its subscriptions. A single directory supports 10,000 management groups and a tree up to six levels deep. See the management groups mechanism and the library example Allowed locations assigned at a management group. That inheritance is the point of the mechanism: one assignment replaces many. Set the assignment at the lowest group that covers your pilot subscriptions first.

Effects layer by most restrictive. Microsoft gives an example of a deny at subscription level and an audit at resource group level: each assignment is evaluated on its own, and a resource cannot slip through a gap between scopes. Several assignments with a deny can block a resource that no single one of them seems to cover. Review every assignment that touches a scope before you conclude that a deny is missing.

Exclusions and exemptions are different tools

An exclusion, set with notScopes on the assignment, removes a scope from evaluation and from the compliance count. Microsoft suggests exclusions for broad, permanent bypass such as a test environment. An exemption exempts a resource hierarchy or one resource and keeps it tracked. The two are not interchangeable, and the choice changes what compliance reports show. Record the reason for each exclusion in the assignment description.

An exemption has a category, Mitigated or Waiver, and an optional expiresOn date. When the date passes, the exemption object is kept for records but is no longer honored. For production, prefer a dated Waiver with a description. The policy exemption and enforcement mode glossary entries have the exact terms. The waiver example in Microsoft's documentation describes a resource planned for deletion by the end of the quarter.

Sources

  1. Azure Policy: Definition effects basics, read 10 Nov 2026
  2. Azure Policy: Deny effect, read 10 Nov 2026
  3. Azure Policy: Audit effect, read 10 Nov 2026
  4. Azure Policy: Modify effect, read 10 Nov 2026
  5. Azure Policy: deployIfNotExists effect, read 10 Nov 2026
  6. Azure Policy: Assignment structure, read 10 Nov 2026
  7. Azure Policy: Exemption structure, read 10 Nov 2026
  8. Azure management groups overview, read 10 Nov 2026

Last reviewed 16 Nov 2026.