← All articles
Azure8 min read

Azure Policy Guardrails Without Freezing Delivery

Initiative design, deny vs audit, exemptions, and how to roll policies out without creating a ticket storm.

Azure Policy can enforce almost any configuration rule across an entire tenant—which is exactly why it can also stop delivery cold. Teams that enable a long list of built-in initiatives in Deny mode on day one usually spend the following month handling failed deployments and exemption requests. Guardrails work when they are introduced deliberately: measured first, remediated where possible, enforced where it matters, and exempted transparently.

Policy lifecycle

  1. AuditAssign with enforcement off; measure impact
  2. Fix forwardModify / deployIfNotExists auto-remediation
  3. CommunicateOwners, docs, and the deny date
  4. DenyEnforce where the risk justifies blocking
  5. Exempt & reviewTime-limited, ticketed exceptions
Every guardrail moves through the same stages before it can block a deployment.

Understand the effects

EffectWhat it doesUse it for
Audit / AuditIfNotExistsReports non-compliance; changes nothingMeasuring impact and visibility-only rules
ModifyAdds or changes properties such as tags during create/updateInheriting cost-centre tags, enforcing settings safely
DeployIfNotExistsDeploys a related resource if missingDiagnostic settings, Defender plans, backup configuration
DenyBlocks non-compliant create or update requestsHigh-risk issues: public exposure, disallowed regions, insecure protocols
DenyActionBlocks specific actions such as deleteProtecting critical resources from deletion

1. Assign with enforcement off first

Every assignment has an enforcement mode. Setting it to DoNotEnforce evaluates resources and reports compliance without blocking anything or triggering remediation. Use it to see how many existing resources would fail and which teams own them before changing anything.

Measure first: enforcement disabledhcl
resource "azurerm_management_group_policy_assignment" "deny_public_ip" {
  name                 = "deny-public-ip"
  display_name         = "Corp landing zones: no public IP addresses"
  management_group_id  = azurerm_management_group.corp.id
  policy_definition_id = azurerm_policy_definition.deny_public_ip.id

  enforce = false # DoNotEnforce: report only, while teams remediate

  non_compliance_message {
    content = "Public IPs are not allowed in Corp landing zones. Use Private Link or the hub firewall. See https://wiki.example.com/azure/public-ip"
  }
}

2. Prefer remediation over blocking

Many requirements are better met by fixing resources automatically than by rejecting them. Modify policies can inherit tags from the resource group; DeployIfNotExists policies can attach diagnostic settings, enable Defender plans, or configure backups. Developers get compliant resources without extra work, and you avoid the friction of a failed deployment for something the platform could fix itself. Remediation tasks also fix existing resources, which is how you clean up the estate before enforcing Deny.

Remediate existing resources for a DeployIfNotExists assignmentbash
az policy remediation create \
  --name diag-settings-remediation \
  --management-group contoso-landingzones \
  --policy-assignment "/providers/Microsoft.Management/managementGroups/contoso-landingzones/providers/Microsoft.Authorization/policyAssignments/deploy-diag-settings"

How does your cloud measure up?

Score your setup across foundation, delivery, reliability, security, and cost in 3 minutes—instant results, no email needed.

Take the free scorecard

3. Reserve Deny for what truly needs blocking

Deny is the right effect for rules where a single non-compliant resource is a real risk: public network access to data services in private landing zones, storage accounts allowing anonymous access, resources in disallowed regions, or outdated TLS versions. For everything else—naming conventions, optional tags, recommended SKUs—audit and report instead. A short, well-understood list of Deny policies earns trust; a long one trains teams to request exemptions by default.

4. Write messages that unblock people

When a deployment fails because of a policy, the error should tell the engineer what was blocked, why, and what to do instead. Non-compliance messages on assignments appear in deployment errors; link them to a short internal page with the approved pattern and the exemption process. This single habit removes a large share of support requests.

5. Exemptions that expire

There will always be legitimate exceptions—a vendor appliance that needs a public IP, or a migration that needs a temporary waiver. Azure Policy exemptions support a category (Waiver or Mitigated), a description, metadata, and an expiry date. Require all three, link the exemption to a ticket, and review active exemptions monthly.

Time-limited exemptionhcl
resource "azurerm_resource_group_policy_exemption" "vendor_appliance" {
  name                 = "vendor-firewall-public-ip"
  resource_group_id    = azurerm_resource_group.vendor_appliance.id
  policy_assignment_id = azurerm_management_group_policy_assignment.deny_public_ip.id
  exemption_category   = "Waiver"
  expires_on           = "2026-12-31T00:00:00Z"
  description          = "Vendor NVA requires public IP until migration to Azure Firewall (CHG-2231)"

  metadata = jsonencode({
    owner     = "network-team"
    ticket    = "CHG-2231"
    approvedBy = "security-lead"
  })
}

6. Shift left: test templates against policy in CI

Engineers should learn about a policy violation in their pull request, not in a failed production deployment. Run infrastructure-as-code scanners such as Checkov or PSRule for Azure in CI, and use what-if deployments against a test subscription that carries the same assignments as production. Aligning CI checks with the policies that will be enforced at deploy time keeps both in sync.

7. Manage policy as code with a release process

Keep custom definitions, initiatives, assignments, and exemptions in a repository. Changes go through pull requests and are deployed first to a test management group with representative subscriptions, then to production groups. Enterprise Policy as Code (EPAC) and the Azure landing zone Terraform and Bicep modules provide frameworks for this. Track compliance per assignment over time so you can see whether a new guardrail is improving the estate or just generating exemptions.

A rollout plan for a new guardrail

  1. Write or select the definition and add a clear non-compliance message.
  2. Assign with enforcement disabled at the target management group.
  3. Review non-compliant resources with owners; remediate automatically where possible.
  4. Add the matching rule to CI scanning so new code is checked before deployment.
  5. Announce the enforcement date and the approved alternative pattern.
  6. Enable enforcement; handle exceptions through time-limited, ticketed exemptions.
  7. Review compliance and active exemptions monthly.

Initiatives: group policies by outcome

Individual policy assignments become hard to manage beyond a few dozen. Initiatives (policy set definitions) group related policies—for example, everything required for the Corp landing zone or for a specific compliance framework—so they can be assigned, versioned, and reported on together. Built-in regulatory initiatives such as the Microsoft cloud security benchmark, ISO 27001, PCI DSS, and HIPAA/HITRUST map policies to framework controls and show compliance per control in Defender for Cloud, which is useful evidence. Assign them in audit mode for visibility, and build your own smaller initiative for the policies you actually enforce.

Common mistakes

  • Enabling large built-in initiatives in Deny mode across the whole tenant on day one.
  • Assignments without non-compliance messages, so engineers see only a generic RequestDisallowedByPolicy error.
  • Managed identities for DeployIfNotExists assignments that lack the roles needed to remediate, so nothing is fixed.
  • Exemptions created in the portal with no expiry, owner, or ticket.
  • Policies tested only in production because no test management group exists.

What to measure

Track three numbers per enforced policy: the compliance percentage over time, the number of deployments it blocked, and the number of active exemptions. A guardrail that blocks many deployments and accumulates exemptions is probably too strict or poorly communicated; one with rising compliance and few exemptions is working as intended. Review these monthly with platform and application leads.

Remember that policy evaluates Azure Resource Manager requests, so data-plane settings inside a service may need other controls.

Pair policy with Defender for Cloud recommendations for those data-plane checks, and review both together.

Checklist

  1. Every new assignment starts in DoNotEnforce mode with impact measured.
  2. Modify and DeployIfNotExists used to fix forward wherever possible.
  3. Deny reserved for high-risk configurations, with a short, documented list.
  4. Helpful non-compliance messages linking to approved patterns.
  5. Exemptions with category, owner, ticket, and expiry, reviewed monthly.
  6. CI checks aligned with enforced policies.
  7. Policy managed as code with a test management group and release process.

Good guardrails feel like paved roads, not roadblocks. Our Azure landing zone and posture hardening work introduces policy this way so security improves without freezing delivery.

Key takeaways

  • Start with deny/audit on the few risks that matter; expand with evidence.
  • Exemptions must expire and name an owner.
  • Pair Policy with Landing Zone templates so compliant paths are the easy paths.

FAQ

Why do teams hate Azure Policy?

Because initiatives are dumped without golden paths. Guardrails without self-service create tickets and shadow IT.

Audit vs deny—when?

Audit to measure and educate; deny when the risk is clear and a compliant alternative exists.

Need help putting this into practice?

Our engineers do this every week. Get a fixed-scope plan for cloud landing zone module—free scoping call, written price before you commit.

Get a free scoping call