<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Key Vault on The DevOps Quest</title>
    <link>https://thedevops.quest/tags/key-vault/</link>
    <description>Recent content in Key Vault on The DevOps Quest</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-gb</language>
    <copyright>© Adam</copyright>
    <lastBuildDate>Fri, 24 Jan 2025 14:53:36 +0000</lastBuildDate><atom:link href="https://thedevops.quest/tags/key-vault/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Understanding Azure Policy Modes: All vs. Indexed</title>
      <link>https://thedevops.quest/posts/azurepolicymodes/</link>
      <pubDate>Fri, 24 Jan 2025 14:53:36 +0000</pubDate>
      
      <guid>https://thedevops.quest/posts/azurepolicymodes/</guid>
      <description>&lt;p&gt;Recently, I encountered a challenge with Azure Policy while implementing an &amp;ldquo;Allowed Locations&amp;rdquo; policy to ensure resources deployed in the correct regions. Similar to the one listed here but it&amp;rsquo;s our own custom one to allow us to make our own modifications - &lt;a href=&#34;https://www.azadvertizer.net/azpolicyadvertizer/e56962a6-4747-49cd-b67b-bf8b01975c4c.html&#34;&gt;AzAdvertizer.net&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;the-problem&#34;&gt;The Problem:&lt;/h1&gt;
&lt;p&gt;Our custom policy, configured with &amp;ldquo;All&amp;rdquo; mode, was unexpectedly interfering with the creation of new Key Vault access policies.&lt;/p&gt;
&lt;h2 id=&#34;the-aha-moment&#34;&gt;The &amp;ldquo;Aha!&amp;rdquo; Moment:&lt;/h2&gt;
&lt;p&gt;After careful investigation, we compared our custom policy with the built-in Azure Policy for &amp;ldquo;Allowed Locations.&amp;rdquo; This built-in policy, designed specifically for this purpose, leverages the &lt;strong&gt;&amp;ldquo;Indexed&amp;rdquo;&lt;/strong&gt; mode. This key difference was the root cause of the issue.&lt;/p&gt;</description>
      <content>&lt;p&gt;Recently, I encountered a challenge with Azure Policy while implementing an &amp;ldquo;Allowed Locations&amp;rdquo; policy to ensure resources deployed in the correct regions. Similar to the one listed here but it&amp;rsquo;s our own custom one to allow us to make our own modifications - &lt;a href=&#34;https://www.azadvertizer.net/azpolicyadvertizer/e56962a6-4747-49cd-b67b-bf8b01975c4c.html&#34;&gt;AzAdvertizer.net&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;the-problem&#34;&gt;The Problem:&lt;/h1&gt;
&lt;p&gt;Our custom policy, configured with &amp;ldquo;All&amp;rdquo; mode, was unexpectedly interfering with the creation of new Key Vault access policies.&lt;/p&gt;
&lt;h2 id=&#34;the-aha-moment&#34;&gt;The &amp;ldquo;Aha!&amp;rdquo; Moment:&lt;/h2&gt;
&lt;p&gt;After careful investigation, we compared our custom policy with the built-in Azure Policy for &amp;ldquo;Allowed Locations.&amp;rdquo; This built-in policy, designed specifically for this purpose, leverages the &lt;strong&gt;&amp;ldquo;Indexed&amp;rdquo;&lt;/strong&gt; mode. This key difference was the root cause of the issue.&lt;/p&gt;
&lt;p&gt;Since these KeyVault access policies don&amp;rsquo;t have a direct location property, the &amp;ldquo;All&amp;rdquo; mode triggered policy evaluation for them, causing unintended consequences. We were unable to create new access policies for our Key Vaults.&lt;/p&gt;
&lt;h2 id=&#34;indexed-mode-to-the-rescue&#34;&gt;Indexed Mode to the Rescue:&lt;/h2&gt;
&lt;p&gt;We promptly updated our custom policy to use &amp;ldquo;Indexed&amp;rdquo; mode. This change immediately resolved the problem with Key Vault access policy creation.&lt;/p&gt;
&lt;h2 id=&#34;lessons-learned&#34;&gt;Lessons Learned:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mode Matters:&lt;/strong&gt; Choosing the right mode is crucial for Azure Policy effectiveness. &amp;ldquo;All&amp;rdquo; mode is not always the best choice, especially for resources without direct location properties. Refer to the official Microsoft documentation for detailed guidance.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Learn from Built-in Policies:&lt;/strong&gt; The built-in Azure Policies serve as valuable resources and learning tools. They showcase best practices and optimal configurations for common policy scenarios.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion:&lt;/h2&gt;
&lt;p&gt;Azure Policy is a powerful tool, but a thorough understanding of its features is essential. A bit of extra research and careful planning can save you from significant challenges down the line.&lt;/p&gt;
&lt;p&gt;I hope this blog post resonates with you!&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
