<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Azure Policy on Brewed in the Cloud by Chris Hailes</title><link>https://blog.brewedinthecloud.com/tags/azure-policy/</link><description>Recent content in Azure Policy on Brewed in the Cloud by Chris Hailes</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 17 Nov 2026 00:00:00 +1100</lastBuildDate><atom:link href="https://blog.brewedinthecloud.com/tags/azure-policy/rss.xml" rel="self" type="application/rss+xml"/><item><title>Make Remediation Repeatable with Policy, IaC and Expiring Exceptions</title><link>https://blog.brewedinthecloud.com/p/exposure-repeatable-remediation-exceptions/</link><pubDate>Tue, 17 Nov 2026 00:00:00 +1100</pubDate><guid>https://blog.brewedinthecloud.com/p/exposure-repeatable-remediation-exceptions/</guid><description>&lt;p&gt;The fix works. Then the next deployment puts the old setting back.&lt;/p&gt;
&lt;p&gt;Or the exception quietly gets another expiry date. Or a reconciliation job restores connectivity while responders are trying to isolate the workload. In each case, the automation may be doing exactly what it was configured to do. The missing piece is agreement about which state should win.&lt;/p&gt;
&lt;p&gt;The earlier exposure-management automation work establishes why policy and expiry matter. The next step is to make the workflow answer four practical questions: what changes, who can change it, what permits wider rollout, and what happens when the exception expires?&lt;/p&gt;
&lt;p&gt;I would automate against the path-level acceptance test, not just a green compliance result. Before giving the workflow permission to expand, I want to know how it stops and how we recover when the test fails.&lt;/p&gt;
&lt;h2 id="the-mental-model"&gt;The Mental Model
&lt;/h2&gt;&lt;blockquote&gt;
&lt;p&gt;Repeatability means repeating a supported boundary outcome safely, not merely repeating a deployment command.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Policy, IaC and an exception record solve different parts of the change.&lt;/p&gt;
&lt;p&gt;IaC records the desired configuration. Policy evaluates or constrains supported resource conditions according to its effect and mode. An exception records the variance we accept. The service test still has to tell us whether the unwanted operation disappeared. These tools support that answer; they do not replace it.&lt;/p&gt;
&lt;div class="mermaid"&gt;flowchart LR
P[Named path and expected outcome] --&gt; D[Reviewed configuration diff]
D --&gt; C[Scoped canary change]
C --&gt; T[Operation and dependency tests]
T --&gt;|Pass| E[Controlled expansion]
T --&gt;|Fail or unknown| S[Stop and rollback decision]
X[Exception owner and expiry] --&gt; T
I[Incident override] --&gt; S
E --&gt; R[Versioned evidence and retest]
&lt;/div&gt;
&lt;p&gt;The &lt;a class="link" href="https://blog.brewedinthecloud.com/azure-exposure-reduction-toolkit/#5-change-and-exception-workflow" &gt;draft toolkit&amp;rsquo;s change/exception module&lt;/a&gt; turns that sequence into a workflow. It is not a general-purpose auto-remediation service.&lt;/p&gt;
&lt;h2 id="how-it-really-works"&gt;How It Really Works
&lt;/h2&gt;&lt;h3 id="match-the-effect-to-the-intended-change"&gt;Match the effect to the intended change
&lt;/h3&gt;&lt;p&gt;Azure Policy effects are not interchangeable labels. Microsoft&amp;rsquo;s documentation distinguishes evaluation of new/updated resources from existing state. An &lt;code&gt;audit&lt;/code&gt; observation does not block a request; a &lt;code&gt;deny&lt;/code&gt; on resource configuration is not automatically a packet filter.&lt;/p&gt;
&lt;p&gt;In the Blob scenario, decide which configuration the workflow should maintain: a public-access setting, a diagnostic dependency or another permitted pattern. Then check the exact resource alias and supported effect. Starting with &amp;ldquo;we will use deny&amp;rdquo; reverses the decision; the effect has to fit the condition.&lt;/p&gt;
&lt;p&gt;Existing resources may need a separately authorized remediation task for effects such as &lt;code&gt;modify&lt;/code&gt; or &lt;code&gt;deployIfNotExists&lt;/code&gt;. Inspect its managed identity and roles. Broad rights can make the task easier to run while giving the automation a larger control-plane reach than the workload we set out to constrain. That trade-off needs its own review.&lt;/p&gt;
&lt;h3 id="keep-exception-semantics-precise"&gt;Keep exception semantics precise
&lt;/h3&gt;&lt;p&gt;Azure Policy supports waiver and mitigated exemption categories. A waiver accepts temporary noncompliance. A mitigated exemption says another method meets the intent. I would ask for the compensating test before accepting that second description; a reassuring label is not a compensating control.&lt;/p&gt;
&lt;p&gt;Microsoft documents that &lt;code&gt;expiresOn&lt;/code&gt; ends honoring the exemption while preserving the object for record-keeping. It does not mean the object is deleted, nor that every deployed configuration or existing network path is immediately undone.&lt;/p&gt;
&lt;p&gt;The toolkit&amp;rsquo;s record below is a practitioner workflow object, &lt;strong&gt;not an ARM policy exemption payload&lt;/strong&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1
&lt;/span&gt;&lt;span class="lnt"&gt; 2
&lt;/span&gt;&lt;span class="lnt"&gt; 3
&lt;/span&gt;&lt;span class="lnt"&gt; 4
&lt;/span&gt;&lt;span class="lnt"&gt; 5
&lt;/span&gt;&lt;span class="lnt"&gt; 6
&lt;/span&gt;&lt;span class="lnt"&gt; 7
&lt;/span&gt;&lt;span class="lnt"&gt; 8
&lt;/span&gt;&lt;span class="lnt"&gt; 9
&lt;/span&gt;&lt;span class="lnt"&gt;10
&lt;/span&gt;&lt;span class="lnt"&gt;11
&lt;/span&gt;&lt;span class="lnt"&gt;12
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;recordType&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;illustrative-path-exception&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;pathId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;lab-app-to-controlled-blob-write&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;owner&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;lt;accountable-service-owner&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;approver&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;lt;independent-risk-approver&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;scope&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;lt;single-lab-resource-scope&amp;gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;reason&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Time-bounded validation of a compensating boundary&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;expiresAtUtc&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2026-11-18T00:00:00Z&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;compensatingTestId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;controlled-destination-write-rejected&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;renewalRequires&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;New evidence and explicit approval&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;onExpiry&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Stop expansion, evaluate policy, retest path and escalate&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The date is an illustrative fixture, not an approved operational exception. Map it to a real policy assignment, exemption category and supported API only in an authorized implementation.&lt;/p&gt;
&lt;h3 id="make-the-workflow-stop-visibly"&gt;Make the workflow stop visibly
&lt;/h3&gt;&lt;p&gt;Before changing resources, verify target subscription/scope, pinned template version, policy definition/assignment, required permissions and an allowed lab cost/time budget. Save the prior state and assign a rollback owner.&lt;/p&gt;
&lt;p&gt;Apply the canary change, then run the prohibited operation and the approved dependency/recovery probes. Expand only when the unwanted operation is rejected at the intended boundary, positive controls work and evidence is complete.&lt;/p&gt;
&lt;p&gt;Run the change again against the same disposable scope to check idempotence. Then rerun the operations. A second successful deployment tells you something about repeatability of configuration, not repeatability of the boundary outcome.&lt;/p&gt;
&lt;p&gt;Exercise a short-lived lab exemption through expiry. Preserve the object, verify evaluation state, then test what the configured effect actually does. A compliance transition without a corresponding path change should be reported as exactly that.&lt;/p&gt;
&lt;h2 id="real-world-impact"&gt;Real-World Impact
&lt;/h2&gt;&lt;p&gt;The platform team should inherit more than a template and a service connection. It needs to understand why the workflow may act, when it must stop and who owns the result after rollback.&lt;/p&gt;
&lt;h3 id="avoid-automation-that-fights-responders"&gt;Avoid automation that fights responders
&lt;/h3&gt;&lt;p&gt;An incident commander may intentionally restrict a path more tightly than routine desired state. A blind reconciliation job can restore access and undermine containment.&lt;/p&gt;
&lt;p&gt;Decide in advance which state wins during containment. An explicit incident override needs an accountable owner, scope, expiry and reconciliation rules. Test that routine automation stops or follows the approved incident state. Then test the way back; an emergency override left indefinitely is another unreviewed exception.&lt;/p&gt;
&lt;h3 id="prefer-gated-execution-when-authority-is-concentrated"&gt;Prefer gated execution when authority is concentrated
&lt;/h3&gt;&lt;p&gt;Automation can reduce repeated manual work, but it also concentrates write permissions and scales mistakes. For a rare high-consequence change, a human-gated pipeline with narrow credentials may be safer and cheaper to maintain than continuous remediation.&lt;/p&gt;
&lt;p&gt;I would rather keep a rare, high-consequence change human-gated than build continuous remediation nobody can safely maintain. That is a choice about risk and operating effort, not a failure to automate. Report the actual burden when measured, not a productivity percentage added to justify the design.&lt;/p&gt;
&lt;h2 id="gotchas-and-edge-cases"&gt;Gotchas and Edge Cases
&lt;/h2&gt;&lt;p&gt;The workflow can succeed as a deployment and fail as a remediation. Evaluation, authority and ownership are the places to look when the green result does not match the intended outcome.&lt;/p&gt;
&lt;h3 id="expiry-does-not-create-a-rollback-plan"&gt;Expiry does not create a rollback plan
&lt;/h3&gt;&lt;p&gt;Removing the exemption&amp;rsquo;s effect on evaluation does not necessarily alter existing resources. The resulting action depends on the policy effect and lifecycle. Require an expiry-triggered review and operation retest.&lt;/p&gt;
&lt;h3 id="conflicting-assignments-accumulate"&gt;Conflicting assignments accumulate
&lt;/h3&gt;&lt;p&gt;Policy assignments can overlap. A local waiver or allowed configuration may not remove another assignment&amp;rsquo;s restriction. Inspect actual applicability rather than assume one exemption covers every policy affecting the resource.&lt;/p&gt;
&lt;h3 id="template-drift-can-erase-the-fix"&gt;Template drift can erase the fix
&lt;/h3&gt;&lt;p&gt;A team may remediate manually while its pipeline still declares the old state. Reconcile the versioned source and deployed configuration before closing the finding.&lt;/p&gt;
&lt;h3 id="privilege-failures-should-not-disappear"&gt;Privilege failures should not disappear
&lt;/h3&gt;&lt;p&gt;A failed remediation identity, denied read or missing diagnostic table is a blocked workflow step. Do not catch it and return a &amp;ldquo;compliant&amp;rdquo; report based on the last successful snapshot.&lt;/p&gt;
&lt;h2 id="best-practices"&gt;Best Practices
&lt;/h2&gt;&lt;p&gt;Use one reviewed change identifier and link it to path/test IDs, template version, assignment/exemption references and evidence. Keep permissions for proposal, approval, execution and data testing distinct where practical.&lt;/p&gt;
&lt;h3 id="assumptions-and-evidence-boundary"&gt;Assumptions and evidence boundary
&lt;/h3&gt;&lt;p&gt;This is a proposed workflow, not a report of live remediation or exception expiry. Record the resource provider and API version; supported policy aliases/effect/mode; assignment scope and enforcement settings; exemption schema/category/expiry; remediation identity and required roles; pipeline authentication; region support and diagnostic schemas. An old policy sample compiling is not enough to establish those assumptions.&lt;/p&gt;
&lt;p&gt;For local validation, check the workflow object&amp;rsquo;s shape and expiry parsing. For Azure validation, separately inspect policy evaluation, actual deployment behavior and service operations. These are different tests with different authority requirements.&lt;/p&gt;
&lt;p&gt;Renewal needs fresh compensating-control evidence and an accountable decision. I would reject a workflow that simply extends the date: it makes permanent risk acceptance look temporary.&lt;/p&gt;
&lt;p&gt;Before rollout, rehearse a failed positive control, denied execution permission and active incident override. If the workflow cannot stop visibly and preserve the previous state, keep it at the canary. Automation earns permission to expand by handling failure, not just by completing the happy path.&lt;/p&gt;
&lt;div class="insight"&gt;
&lt;div class="insight-icon"&gt;🍺&lt;/div&gt;
&lt;div class="insight-content"&gt;
&lt;strong&gt;Brewed Insight:&lt;/strong&gt; Repeatability means repeating the boundary outcome safely, not repeating the deployment command. Exception expiry is a trigger to verify the path again, not evidence that the path has already disappeared.
&lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
.insight {
display: flex;
align-items: center;
background-color: #0089e41c;
border-left: 10px solid #D69A2D;
padding: 10px;
margin: 20px 0;
border-radius: 4px;
}
.insight-icon {
font-size: 24px;
margin-right: 10px;
}
.insight-content {
flex: 1;
}
&lt;/style&gt;&lt;h2 id="learn-more"&gt;Learn More
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/governance/policy/concepts/effect-basics" target="_blank" rel="noopener"
&gt;Azure Policy effect basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/governance/policy/concepts/exemption-structure" target="_blank" rel="noopener"
&gt;Azure Policy exemption structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/governance/policy/how-to/remediate-resources" target="_blank" rel="noopener"
&gt;Remediate noncompliant resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/azure/templates/" target="_blank" rel="noopener"
&gt;Azure Resource Manager template reference&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>