<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jonny Diamond on Medium]]></title>
        <description><![CDATA[Stories by Jonny Diamond on Medium]]></description>
        <link>https://medium.com/@jonny_11585?source=rss-94de0d5f8beb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Jonny Diamond on Medium</title>
            <link>https://medium.com/@jonny_11585?source=rss-94de0d5f8beb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:28:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jonny_11585/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Azure archetypes at scale to simplify governance: Why the CAF works, part 2]]></title>
            <link>https://medium.com/@jonny_11585/using-azure-archetypes-at-scale-to-simplify-governance-why-the-caf-works-part-2-ff9f6f0f39ed?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff9f6f0f39ed</guid>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-cloud-adoption]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[microsoft-azure]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 20:21:16 GMT</pubDate>
            <atom:updated>2026-10-23T19:47:48.463Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Using Azure archetypes at scale to simplify governance: Why the CAF works, part 2</em><br>In part 1 we looked at how DDoS protection works in the CAF. In this post I want to look at the part of it that I think does the most for governance at scale: landing zone archetypes. What are they, and why does governing two hundred subscriptions with them take about the same effort as governing ten?</p><h4>Start with what you’re hosting</h4><p>Let’s start by emphasising that archetypes work best when you know the compliance and security requirements of your cloud workloads ahead of time. A good time to learn that lesson is early in adoption, ideally in the Strategy phase <a href="https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/strategy/">https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/strategy/</a>. It sounds something like this: we are Company X, and we need to host workloads that are PCI DSS compliant, or ISO 27001 compliant, or that meet our very rigorous internal security benchmark. Or maybe it’s the Microsoft cloud security benchmark (MCSB), which is a collection of excellent security best practices.</p><p>If you don’t know the security requirements of what you’re hosting, that’s the place to start. It’s the cornerstone of everything that follows. What you’re hosting drives your requirements, and your security and information risk should decide what those requirements look like. You don’t need a list of every workload you’ll ever host, but you do need to know the kinds of risk you’ll carry, like the regulations that apply to you and how you classify your data.</p><p>Yes, you could just assume the highest standard for everything, but for most organisations I think that’s the wrong default. It comes with an operational toll and added cost that most workloads don’t need. If we’re adopting Azure, it’s because we want to host things there and get the benefits, like lower operational effort and more agility. Locking everything down to PCI level gives a lot of that back. One security posture for the whole estate is either too weak for your regulated workloads or too costly for everything else, and archetypes mean you can host both and have them coexist.</p><h4>What it looks like without them</h4><p>You may have seen a tenant where this went wrong. The management groups mirror the org chart, with one per business unit or region, and sometimes Dev, Test and Prod under each of those. Policy gets assigned wherever someone needed it at the time, the same assignments get repeated at different levels, and anything that doesn’t fit gets an exemption. Before long the exemption list is longer than the assignment list, and nobody can tell you what posture a subscription actually has without going and looking.</p><p>Microsoft’s management group guidance calls this out directly <a href="https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/tailoring-alz">https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/tailoring-alz</a>:</p><blockquote>Don’t duplicate your organisational structure into a deeply nested management group hierarchy. Use management groups for policy assignment versus billing and RBAC purposes.</blockquote><p>It also says not to create management groups for production, testing and development. Those should be separate subscriptions in the same management group.</p><h4>Platform landing zones</h4><p>Before we get to archetypes properly, I need to explain platform landing zones, commonly referred to as the shared services. These are the connectivity, identity and management landing zones. They exist to provide network services, identity services, platform automation and so on, which the application landing zones (our workloads) consume.</p><p>Depending on the operating model, the hub would be centrally managed. It hosts either a standard hub VNet or an Azure Virtual WAN hub. Not every workload uses it, though. Some sit in isolated networks with their own VNet and firewall, sometimes called islands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZBb7y_MHF8IHssVU7C97Rw.png" /></figure><p>Each workload on the right is peered to the hub and consumes its central services. Keep this picture in mind, because the network is one of the things that defines an archetype.</p><h4>So what is an archetype?</h4><p>In the CAF we use landing zone archetypes to group subscriptions with the same policy requirements, and therefore the same compliance requirements. This is how Microsoft defines one <a href="https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/tailoring-alz">https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/landing-zone/tailoring-alz</a>:</p><blockquote>A landing zone archetype describes what needs to be true to ensure a landing zone (Azure subscription) meets the expected environment and compliance requirements at a specific scope.</blockquote><p>The examples it gives are Azure Policy assignments, RBAC assignments and “centrally managed resources such as networking”. So an archetype isn’t just a management group. The management group is how you implement it. Because policy is inherited down the tree, everything assigned above it counts too. A subscription in a PCI archetype gets the intermediate root’s policies, plus the Landing Zones policies, plus the PCI ones.</p><p>The question we must ask first is: can I categorise the types of workloads I’ll host? Do they have different compliance or security requirements? Should security be more strictly enforced in some than in others? It’s these requirements that drive the archetypes. Whatever types of workload you need to host, that’s the right answer for your archetypes, and Microsoft’s guidance says much the same:</p><blockquote>Create management groups under your landing zone management group to represent the types of workloads that you host. These groups are based on the security, compliance, connectivity, and feature needs of the workloads.</blockquote><p>Notice connectivity in that list. Out of the box, ALZ gives us Corp and Online (plus Local, for workloads on Azure Local), and the difference between Corp and Online is the hub-and-spoke picture from earlier. Corp is for workloads that connect to the corporate network through the hub. Online is for workloads that need direct internet access, or that don’t need a virtual network at all.</p><p>If you look at the ALZ library, every policy assignment Corp adds is about the network: deny public endpoints, deny public IPs on NICs, deny hybrid networking (that’s the hub’s job), and point private endpoints at the central private DNS zones. Online doesn’t add any of its own. It just inherits from Landing Zones. The islands have a different connectivity requirement again, so they don’t belong in Corp. They go in Online or in an archetype of their own.</p><p>The platform landing zones work the same way. Identity has its own assignment to deny public IPs. Connectivity can’t have that one, because the hub needs public IPs for its firewall and gateways, so the two get different policy.</p><h4>Audit or enforce?</h4><p>Now policy has a target, and we can enforce a posture on an archetype because the workload type requires it. This is where the catch with MCSB comes in: out of the box, it audits. If we look at the initiative definition, none of its effect parameters default to Deny. Assign it as-is and you get a very good report of where you’re falling short, but on its own it won’t stop anyone deploying something non-compliant. The PCI DSS v4.0.1 initiative is the same.</p><h4>There are ways to enforce it, though:</h4><p>Set the effect parameters to Deny in your assignment (or DeployIfNotExists or Modify, where the policy supports them). Dozens of the MCSB effect parameters accept Deny.<br>Use the Deny and Enforce options in Defender for Cloud, which work on a subset of MCSB recommendations.<br>Assign deny policies directly to the archetype, which is exactly what ALZ does for Corp.<br>Don’t flip everything to Deny on day one. Run it in audit first, look at what would break, then move it to Deny. And keep in mind that policy only covers the Azure side. PCI DSS also covers people and process, and no initiative does that part for you.</p><h4>Okay, so how does this let governance scale?</h4><p>Once we vend a subscription, we place it in an archetype and policy enforces the requirements. That’s pretty much it. The ALZ FAQ uses this as its example of policy-driven governance: a new subscription is created and placed into a management group, and Azure Policy makes sure Defender for Cloud is enabled on it.</p><p>Nobody configures controls subscription by subscription, and nobody has to remember that this particular workload needs private endpoints. Policy becomes the guardrail for the archetype, and the archetype is the workload type. Whether we have ten subscriptions or two hundred, the effort is about the same.</p><p>It also means subscription vending is where the important decision gets made. When a new workload comes in, the intake asks what it is, what data it handles and what it needs to connect to, and this informs the archetype. This is why knowing roughly what types of workloads you need to host is beneficial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfVLg3BiytbfuKy1odKA_Q.png" /><figcaption>Some tailored archetypes</figcaption></figure><p>The boxes in green are the safest place to change the CAF management group structure. That’s Microsoft’s wording too: it calls the area under Landing Zones “<em>the most common and safest place in the hierarchy to add more archetypes</em>”. Anything assigned at the intermediate root applies to every subscription below it, so that’s where you want to change the least. The example here includes PCI, which is also the example Microsoft uses, so any subscription with that requirement goes in there.</p><h4>Summary</h4><p>Archetypes simplify landing zone (workload) governance by letting us group workloads with the same requirements together. Work out your requirements early and let security and information risk shape them. Turn them into archetypes, make sure the policies enforce and don’t only audit, and pick the archetype when you vend each subscription. So why use them? Because once they’re in place, governing a new workload comes down to one decision at vending time, and policy does the rest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff9f6f0f39ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enabling DDoS Protection at Scale with Policy-Driven Governance: Why the CAF works, part 1]]></title>
            <link>https://medium.com/@jonny_11585/enabling-azure-ddos-protection-at-scale-with-policy-driven-governance-264b6337d23c?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/264b6337d23c</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[cloud-adoption-framework]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[azure-policies]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Sun, 04 Oct 2026 14:04:41 GMT</pubDate>
            <atom:updated>2026-10-23T19:46:19.067Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Part 1 of Why the CAF works: how the Cloud Adoption Framework (CAF) solves governance and scale problems. This one: DDoS protection.</em></p><p>To mitigate the threat from DDoS attacks we can use Azure DDoS Protection. In October 2025 Azure mitigated a 15.72 Tbps DDoS attack from more than 500,000 source IPs, the largest ever seen in the cloud (CPO Magazine). Cloudflare’s 2025 Q4 report shows network-layer DDoS attacks more than tripled in 2025, with attacks reaching 31.4 Tbps.</p><p>So the question becomes: how can we use Azure DDoS Protection to automatically protect our Azure estate? The solution needs to work reliably, at scale, under full automation.</p><h3>A few caveats</h3><p>When we talk about protecting our Azure estate with DDoS protection, we really mean protecting public IP addresses in Online landing zones in a hub-and-spoke topology. That’s where our network is exposed to the internet. These PIPs might be attached to VMs, Application Gateways, API Management, Bastion, Azure Firewall and so on.</p><p>DDoS Protection works at the network layer (L3 and L4). For application-layer protection we need Azure WAF or a similar solution.</p><p>PaaS services with public endpoints (for example a storage account) are out of scope. They sit behind Microsoft’s own edge protection, not your VNet.</p><p>Azure DDoS Protection is a resource like any other. It lives in the Microsoft.Network/ddosProtectionPlans resource provider.</p><h3>Which tier do we need?</h3><p>Every public IP in Azure gets infrastructure protection for free. It’s tuned to protect Azure itself, not your specific workload. Above that there are two paid tiers:</p><p><strong>DDoS IP Protection</strong>: per-IP pricing, suited to small deployments with a handful of public IPs. You get core DDoS mitigation, but no DDoS Rapid Response, no cost protection and no WAF discount.</p><p><strong>DDoS Network Protection</strong>: a plan that covers every public IP in any VNet enrolled in it. You also get DRR (access to the DDoS response team during an active attack), cost protection and a discount on Azure WAF.</p><p>The key design decision is scale. Once an estate has more than a handful of public IPs, IP Protection’s per-IP pricing quickly approaches the cost of a plan, and the plan covers 100 PIPs. Protect the VNet, not individual IPs. For an enterprise-scale estate, Network Protection is the correct default.</p><h3>The problem this solves</h3><p>In the CAF architecture, Online landing zones may be added frequently. Each one gets a spoke VNet, and each spoke VNet might get a PIP. If DDoS enrollment is a manual step, it might be missed or done incorrectly. Either way you end up with unprotected public endpoints. So we treat DDoS protection, along with other aspects of core networking, as a Platform concern. Also DDOS IP protection is less cost effective per resource than a DDoS plan (assuming you deploy more than about 15 PIPs).</p><p>This is exactly the class of problem CAF solves: a platform team that owns shared network services, and policy-driven governance that enforces the desired state instead of relying on a documented manual process.</p><h3>Who owns the spoke VNet?</h3><p>This is the question the whole design depends on, and it’s easy to skip past.</p><p>In the CAF reference model, the spoke VNet isn’t built by the workload team. It arrives with the landing zone through subscription vending. The platform team’s vending pipeline creates the subscription, places it in the Online Management Group, creates the spoke VNet and peers it to the hub. The workload team gets a subscription with its network already connected, and builds inside it.</p><p>That vending principal already has rights in the Connectivity subscription, because it has to create the hub side of the peering. That’s also important to note.</p><h3>The CAF pattern</h3><ol><li>One plan. Create a single Microsoft.Network/ddosProtectionPlans resource in the Connectivity subscription alongside the hub. One plan can be shared across subscriptions in the same tenant.</li><li>Vend VNets already protected. Subscription vending creates each spoke VNet with enableDdosProtection: true and ddosProtectionPlan.id set to the central plan. New landing zones are protected from the moment the VNet exists.</li><li>Policy as the guardrail. Assign the built-in <em>Virtual networks should be protected by Azure DDoS Protection</em> (94de2ad3-e0c1-4caf-ad78-5d47bbc83d3d) at the Online landing zones Management Group. Don&#39;t assign it at the intermediate root, or it will also catch Platform and Corp VNets (or do, it depends on a few factors). It uses the Modify effect: any VNet created or updated without the plan gets it added in flight, and a remediation task fixes existing VNets.</li></ol><p>Vending is the primary mechanism. The policy catches drift and anything created outside vending.</p><p>Modify is the right effect here. We’re only setting two properties on the resource being evaluated, there’s no nested deployment, and the VNet is protected at creation rather than minutes afterwards.</p><h3>Why it works: the join check</h3><p>Associating a VNet with a DDoS plan is an operation with two scopes. On every VNet create or update that references the DDoS protection plan, ARM checks that the caller has Microsoft.Network/ddosProtectionPlans/join/action on the plan.</p><p>Modify alters the caller’s request, so that check runs against whoever made the request. In the CAF model, that’s the platform vending principal, which already has rights in Connectivity. The check passes and everything works.</p><p>Remediation tasks for existing VNets run as the policy assignment’s managed identity instead, so that identity needs join rights on the plan too. The portal only grants the roles in roleDefinitionIds at the assignment scope (the Online MG). It doesn&#39;t grant anything on a plan in another subscription. Add that grant yourself: a custom role with just ddosProtectionPlans/join/action, or Network Contributor on the plan&#39;s resource group.</p><h3>When the model breaks</h3><p>The pattern is simple as long as the platform owns the VNet. It breaks when workload teams deploy VNets themselves, for example because:</p><ul><li>application teams own their networking end to end,</li><li>a workload team takes over the vended VNet in its own IaC and redeploys the whole resource, or</li><li>landing zones are built by hand or per team instead of vended.</li></ul><p>Now the VNet PUT runs as the workload team’s service principal. Modify adds the plan reference, ARM runs the join check against a principal with no rights in Connectivity (and it shouldn’t have any), and the deployment fails:</p><pre>LinkedAuthorizationFailed: The client &#39;blahblahblah&#39; has permission to perform action<br>&#39;Microsoft.Network/virtualNetworks/write&#39; on scope &#39;vnet-spoke-01&#39;; however, it does not have<br>permission to perform action &#39;Microsoft.Network/ddosProtectionPlans/join/action&#39; on the<br>linked scope(s) &#39;ddos-central&#39;</pre><p>The policy that was meant to protect the landing zone now blocks the landing zone team from deploying its own network.</p><h3>Three ways out</h3><p>1. Put the ownership boundary back. The platform owns the VNet resource, and workload teams manage subnets, NSGs and route tables inside it. Subnets are child resources with their own PUT, so adding one doesn’t redeploy the VNet. This is the CAF answer, and it keeps the simple Modify pattern.</p><p>2. Grant join rights to workload deployers. Give each landing zone’s deploying principal a custom role with only ddosProtectionPlans/join/action on the plan (most network built in roles will be too broad). The downside here is it adds permission on a platform resource across every landing zone, and it has to be granted again for each new one. Vending could automate this.</p><p>3. Switch to DeployIfNotExists. DINE doesn’t touch the caller’s request. The VNet is created as normal, the policy evaluates it afterwards, and a deployment runs as the policy assignment’s managed identity to enroll it. Only one identity ever holds join rights. The trade-offs:</p><ul><li>The gap: a new VNet is briefly unprotected (typically minutes).</li><li>Complexity: a VNet PUT replaces the whole resource, so the template must carry across the existing address space, subnets, peerings and tags.</li><li>Flapping: if the workload’s IaC redeploys the VNet without the DDoS properties, the enrollment is removed and DINE adds it back afterwards. Each redeploy opens a short unprotected window.</li><li>A policy denying resources without DDoS protection won’t be happy</li></ul><h3>What the cloud operating model tells you</h3><p>This is the real lesson, and it’s why the series is called <em>Why the CAF works</em>. The protecting from DDoS is simple (one plan, one built-in policy, one assignment) because the operating model puts VNet ownership with the platform team. The policy effect, the permissions and the failure modes all follow from that one decision.</p><p>Move VNet ownership to workload teams and the same control needs extra permissions, a different policy effect, or both. That’s not a flaw in the built-in policy. It’s the cost of changing the operating model. Decide who owns the network first, then pick the mechanism.</p><h3>Cost notes</h3><p>A Network Protection plan is a flat monthly charge covering up to 100 public IPs, with a per-IP charge above that. A single plan can be shared across subscriptions in the same tenant. For any estate with more than a few Online landing zones, one shared plan plus policy enrollment is both cheaper and safer than per-IP protection or a manual process. Check current pricing for your region: Azure DDoS Protection pricing.</p><h3>Summary</h3><p>DDoS attacks at multi-terabit scale are now commonplace. Azure DDoS Network Protection mitigates L3/L4 attacks against public IPs in enrolled VNets. In the CAF model, the platform vends each spoke VNet already attached to a central plan in Connectivity, and the built-in Modify policy at the Online Management Group catches anything that drifts.</p><p>It works because the platform owns the VNet. When workload teams deploy VNets themselves, Modify runs as their principal and fails the join check on the plan. You can restore the ownership boundary, grant workload deployers join rights, or switch to a DINE policy running as a single managed identity. Pick based on who owns the network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=264b6337d23c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Least privilege as a service for Azure deployments — part 1]]></title>
            <link>https://medium.com/@jonny_11585/least-privilege-as-a-service-for-azure-deployments-part-1-4374f70c75bd?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/4374f70c75bd</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[identity]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[az]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 20:55:04 GMT</pubDate>
            <atom:updated>2026-03-26T20:55:04.820Z</atom:updated>
            <content:encoded><![CDATA[<p>Least privilege is a concept that garners a lot of attention from Azure practitioners. It means using the exact required permissions to perform a task, and no more. This sounds great, but in practice it is difficult to achieve and is often added to security assurances as a tick box: “we will follow least privilege.” But when it comes to Azure IaC or template deployments, how can we ever know if a deploying security principal is using the least amount of privilege?</p><p>Let’s take an example of an Azure DevOps service connection, created using workload identity federation, which is the recommended approach for creating service connections with ARM roles at scopes such as subscriptions or resource groups. By default, the service principal automatically created at the scope of a subscription has the Contributor role, which in terms of ARM roles is second only to Owner (which can create role assignments). If the IaC template deployed by the service connection only has a storage account and an app service (and only ever will), then it is not following a least-privilege approach. It only needs to deploy an app service and a storage account, no more than this.</p><p>Another example might be a Cloud Adoption Framework landing zone scenario. This is where a workload team has a landing zone subscription assigned to it. Then, through proper controls and governance, the workload team can deploy the Azure services they require into this landing zone. What role should the deploying principal get in this scenario? Contributor? Or Owner? Or should it be exactly what it needs to be?</p><p>Tracking down the precise permissions a template requires would be fairly arduous, and maybe through a mix of guesswork and trial and error, a lesser amount of privileges could be found. Or we could use a tool that can do this for us.</p><p>Azure Minimum Permission Finder (MPF) is a tool we can use to find exactly what permissions IaC templates need to deploy resources. It works by creating a test deployment at the resource group scope. This deployment is used to find the exact permissions ARM needs.</p><p>To install azmpf, follow the instructions here: <a href="https://github.com/Azure/mpf/blob/main/docs/installation-and-quickstart.md#quickstart--usage">https://github.com/Azure/mpf/blob/main/docs/installation-and-quickstart.md#quickstart--usage</a></p><p>Installation requires downloading and installing the azmpf utility and creating a dedicated MPF service principal.</p><p>Let’s create a main.bicep template and parameter file (MPF doesn’t support bicepparam files) which we can point MPF at.</p><pre>param parStorageAccountName string<br>param parLocation string = &#39;uksouth&#39;<br><br>resource storageAccount &#39;Microsoft.Storage/storageAccounts@2023-05-01&#39; = {<br>  name: parStorageAccountName<br>  location: parLocation<br>  sku: {<br>    name: &#39;Standard_LRS&#39;<br>  }<br>  kind: &#39;StorageV2&#39;<br>}</pre><pre>{<br>  &quot;$schema&quot;: &quot;https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#&quot;,<br>  &quot;contentVersion&quot;: &quot;1.0.0.0&quot;,<br>  &quot;parameters&quot;: {<br>    &quot;parStorageAccountName&quot;: {<br>      &quot;value&quot;: &quot;sa5crtvuybghkujk&quot;<br>    }<br>  }<br>}</pre><p>Once we have created these files we can invoke MPF using the following command</p><pre>./azmpf bicep --bicepFilePath main.bicep --parametersFilePath params.parameters.json --verbose</pre><p>More details on how MPF works can be found here: <a href="https://github.com/Azure/mpf/tree/main#how-it-works">https://github.com/Azure/mpf/tree/main#how-it-works</a>. The long and short of it is that MPF will perform dummy deployments of a template until it gets no authorisation errors, at which point it displays the exact permissions required. Below we can see the output.</p><pre>------------------------------------------------------------------------------------------------------------------------------------------<br>Permissions Required:<br>------------------------------------------------------------------------------------------------------------------------------------------<br>Microsoft.Resources/deployments/read<br>Microsoft.Resources/deployments/write<br>Microsoft.Storage/storageAccounts/read<br>Microsoft.Storage/storageAccounts/write<br>------------------------------------------------------------------------------------------------------------------------------------------</pre><p>So what now? Now that we know the permissions required, we can create a role containing these permissions and assign a service principal this role. Then, using that service principal for the Bicep deployment, we will actually be using least privilege.</p><p>But there’s an important distinction to make here. MPF tells us the permissions the template needs, but the template isn’t deploying itself.</p><p>Deployment tooling such as the Azure CLI has its own permission requirements on top of what the template needs. MPF works by calling the ARM deployment API directly (PUT on the deployments endpoint). But when you run <em>az deployment group create</em>, the command performs a pre-flight validation (POST on /validate) and checks deployment status (GET on /operationStatuses). These additional API calls require additional permissions that MPF never triggers. This may vary for Azure DevOps built-in tasks, GitHub Actions, or Terraform deployments.</p><p>In practice, for our <em>az deployment group create</em> command, this means we need to add these permissions to the MPF output:</p><pre>Microsoft.Resources/deployments/validate/action<br>Microsoft.Resources/deployments/operationStatuses/read</pre><p>Without these, the deployment will fail with AuthorizationFailed errors even though the template permissions are correct.</p><p>So the full set of permissions we actually need is the MPF output plus the deployment tooling permissions. This is like two layers: the template permissions (what MPF finds) and the deployment permissions (what the tooling needs to orchestrate the deployment). Both are required for a successful deployment.</p><p>So let’s create the role with the complete set of permissions:</p><pre>​az role definition create --role-definition &#39;{<br> &quot;Name&quot;: &quot;Storage deployer&quot;,<br> &quot;Description&quot;: &quot;Deploy a storage account.&quot;,<br> &quot;Actions&quot;: [<br>     &quot;Microsoft.Resources/deployments/read&quot;,<br>     &quot;Microsoft.Resources/deployments/write&quot;,<br>     &quot;Microsoft.Resources/deployments/validate/action&quot;,<br>     &quot;Microsoft.Resources/deployments/operationStatuses/read&quot;,<br>     &quot;Microsoft.Storage/storageAccounts/read&quot;,<br>     &quot;Microsoft.Storage/storageAccounts/write&quot;<br> ],<br> &quot;DataActions&quot;: [],<br> &quot;NotDataActions&quot;: [],<br> &quot;AssignableScopes&quot;: [&quot;/subscriptions/SUB_ID&quot;] <br>}&#39;</pre><p>Then let’s create a service principal (take note of the app id, password, and tenant id).</p><pre>az ad sp create-for-rbac -n app-storage-deployer</pre><p>And finally, assign the role to the app using the role’s GUID as the role:</p><pre>az role assignment create --assignee APP_ID --role 53f635da-1c50-4f76-8ad2-ba4ba2ac21e9 --scope /subscriptions/SUB_ID</pre><p>Now sign in as the service principal and perform the deployment.</p><pre>az login --service-principal --username APP_ID --password SP_PSWD --tenant TENANT_ID<br>az deployment group create -n storage-deployer -g rg -f main.bicep -p param.parameter.json</pre><pre>{<br>  &quot;id&quot;: &quot;/subscriptions/SUB_ID/resourceGroups/rg/providers/Microsoft.Resources/deployments/storage-deployer&quot;,<br>  &quot;location&quot;: null,<br>  &quot;name&quot;: &quot;storage-deployer&quot;,<br>  &quot;properties&quot;: {<br>    &quot;correlationId&quot;: &quot;e32d27b5-0d6b-4c40-9103-1ccdf29d896f&quot;,<br>    &quot;debugSetting&quot;: null,<br>    &quot;dependencies&quot;: [],<br>    &quot;duration&quot;: &quot;PT2.0994047S&quot;,<br>    &quot;error&quot;: null,<br>    &quot;mode&quot;: &quot;Incremental&quot;,<br>    &quot;onErrorDeployment&quot;: null,<br>    &quot;outputResources&quot;: [<br>      {<br>        &quot;id&quot;: &quot;/subscriptions/SUB_ID/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/sa5crtvuybghkujk&quot;,<br>        &quot;resourceGroup&quot;: &quot;rg&quot;<br>      }<br>    ],<br>    &quot;outputs&quot;: null,<br>    &quot;parameters&quot;: {<br>      &quot;parLocation&quot;: {<br>        &quot;type&quot;: &quot;String&quot;,<br>        &quot;value&quot;: &quot;uksouth&quot;<br>      },<br>      &quot;parStorageAccountName&quot;: {<br>        &quot;type&quot;: &quot;String&quot;,<br>        &quot;value&quot;: &quot;sa5crtvuybghkujk&quot;<br>      }<br>    },<br>    &quot;parametersLink&quot;: null,<br>    &quot;providers&quot;: [<br>      {<br>        &quot;id&quot;: null,<br>        &quot;namespace&quot;: &quot;Microsoft.Storage&quot;,<br>        &quot;providerAuthorizationConsentState&quot;: null,<br>        &quot;registrationPolicy&quot;: null,<br>        &quot;registrationState&quot;: null,<br>        &quot;resourceTypes&quot;: [<br>          {<br>            &quot;aliases&quot;: null,<br>            &quot;apiProfiles&quot;: null,<br>            &quot;apiVersions&quot;: null,<br>            &quot;capabilities&quot;: null,<br>            &quot;defaultApiVersion&quot;: null,<br>            &quot;locationMappings&quot;: null,<br>            &quot;locations&quot;: [<br>              &quot;uksouth&quot;<br>            ],<br>            &quot;properties&quot;: null,<br>            &quot;resourceType&quot;: &quot;storageAccounts&quot;,<br>            &quot;zoneMappings&quot;: null<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;provisioningState&quot;: &quot;Succeeded&quot;,<br>    &quot;templateHash&quot;: &quot;3036883372851194424&quot;,<br>    &quot;templateLink&quot;: null,<br>    &quot;timestamp&quot;: &quot;2026-03-26T20:09:01.653200+00:00&quot;,<br>    &quot;validatedResources&quot;: null<br>  },<br>  &quot;resourceGroup&quot;: &quot;rg&quot;,<br>  &quot;tags&quot;: null,<br>  &quot;type&quot;: &quot;Microsoft.Resources/deployments&quot;<br>}</pre><p>Excellent: we’ve deployed our IaC using a service principal that has our custom role. The custom role, “Storage deployer,” has only the permissions required by the template for ARM and the Microsoft.Resources/deployments permissions required for the az deployment command (to validate our template and poll its status).</p><p>This is great. We have achieved least privilege. But running azmpf manually every time we want to deploy anything can be pretty time-consuming. Could we automate this, or provide it as a service in a landing zone context?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4374f70c75bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to validate an Azure deployment]]></title>
            <link>https://medium.com/@jonny_11585/how-to-validate-an-azure-deployment-889850152228?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/889850152228</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[azure-bicep]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 16:57:46 GMT</pubDate>
            <atom:updated>2026-10-23T19:40:20.769Z</atom:updated>
            <content:encoded><![CDATA[<p>In my previous blog <em>What is an Azure deployment?</em> we talked about what a deployment was and concluded that a deployment is a container or wrapper around requests to ARM to for resources. One of the key advantages of using a deployment to deploy resources is validation or the ability to understand before a request is made whether it is valid.</p><h4>Why should we validate a deployment?</h4><p>Just like the practice of defence in depth with security writing IaC should have a quality in depth approach, and just like applying security in a shift left way (doing security earlier rather than later in the process) we should catch quality issues in Bicep as far ‘left’ as possible because these same issues are more problematic when caught later.</p><p>So what are the layers of quality check we use to make sure Bicep code is high quality, error free and secure?</p><h4>Lint</h4><p>Linting is the process of checking code for potential errors and best practice violations. The Bicep CLI has a built-in linter which can lint files we pass to it to find syntax errors and enforce coding standards.</p><pre>az bicep lint -f main.bicep</pre><p>So let’s try this out on a Bicep file to see what it comes up with:</p><pre>param name string<br>param name string<br>param anotherParam string = &#39;usefulString&#39;<br><br>resource sa &#39;Microsoft.Storage/storageAccounts@2032-06-01&#39; = { <br>  name: name<br>  location: &#39;uksmouth&#39;<br>  kind: &#39;BlobStorage&#39;<br>  sku: {<br>    name: &#39;ReallyGood&#39;<br>  }<br>  properties: {<br>    accessTier: &#39;Hot&#39;<br>    allowBlobPublicAccess: false<br>    defaultToOAuthAuthentication: true<br><br>    minimumTlsVersion: &#39;TLS1_8&#39; <br>    networkAcls: {<br>      bypass: &#39;AzureServices&#39;<br>      defaultAction: &#39;Deny&#39;<br>      ipRules: []<br>      virtualNetworkRules: []<br>    }<br>    supportsHttpsTrafficOnly: true<br>  }<br>}</pre><p>Bearing in mind VS Code has the Bicep linter built in, the az bicep lint command is useful because it means that linting can be performed in a pipeline task for example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*N5Q7ecjpci04YHAUiNjCMw.png" /></figure><p>The output shows two errors and two warnings: I’ve declared the ‘name’ param twice and declared ‘anotherParam’ but not used it in the code. So through linting I’ve caught code quality errors, and importantly I can also define what linting checks are performed.</p><p>We can also run the build command, compiling Bicep into ARM JSON. This uses the same linting that the lint command uses but also produces an ARM template built from the Bicep passed to the command:</p><pre>az bicep build -f main.bicep</pre><h4><strong>Custom linter rules</strong></h4><p>The VS Code extension and the Bicep CLI use default linter rules based on the arm-ttk test cases (https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/linter). Custom linter rules can be added using a bicepconfig.json file placed in your project root:</p><pre>{<br>  &quot;analyzers&quot;: {<br>    &quot;core&quot;: {<br>      &quot;enabled&quot;: true,<br>      &quot;rules&quot;: {<br>        &quot;adminusername-should-not-be-literal&quot;: {<br>          &quot;level&quot;: &quot;warning&quot;<br>        },<br>        &quot;no-unused-params&quot;: {<br>          &quot;level&quot;: &quot;off&quot;<br>        },<br>        &quot;what-if-short-circuiting&quot;: {<br>          &quot;level&quot;: &quot;off&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>So in the above config we are specifying that the rule ‘no-unused-params’ is off, and now our linter ignores the unused param.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*IfRl7KgGqLh7fQCh9ppqIg.png" /></figure><p>and the lint command has no output either</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*CbfpijXoN9oH8Uo9ph4vpA.png" /></figure><h4><strong>Validate</strong></h4><p>From the example above it’s clear that linting can check our Bicep to ensure we’re following best practice and there are no syntactical errors. If we look at the Bicep above we can see the linter is happy with all the properties we have passed — for example the linter expects the minimumTlsVersion value to be a string and as long as a string is passed it’s happy. But we’ve passed ‘TLS1_8’ and TLS 1.8 does not exist. The Bicep is syntactically correct, but it isn’t valid.</p><p>In a previous post we talked about what a deployment is (https://medium.com/@jonny_11585/what-is-an-azure-deployment-e327e4ebc120) — it’s a wrapper around a request to ARM. The az deployment group command has several subcommands such as validate.</p><p>Let’s run the validate command on our template.</p><pre>az deployment group validate -g rg -f main.bicep -p name=name</pre><p>The output of this command shows us our location is invalid:</p><pre>{&quot;code&quot;: &quot;LocationNotAvailableForResourceType&quot;, &quot;message&quot;: &quot;The provided location &#39;uksmouth&#39; is not available for resource type &#39;Microsoft.Storage/storageAccounts&#39;. <br>List of available regions for the resource type is &#39;eastus,eastus2,westus,westeurope,eastasia,southeastasia,japaneast,japanwest,northcentralus,southcentralus,centralus,northeurope,brazilsouth,australiaeast,australiasoutheast,southindia,centralindia,westindia,canadaeast,canadacentral,westus2,westcentralus,uksouth,ukwest,koreacentral,koreasouth,francecentral,australiacentral,southafricanorth,uaenorth,switzerlandnorth,germanywestcentral,norwayeast,westus3,jioindiawest,swedencentral,qatarcentral,polandcentral,italynorth,israelcentral,mexicocentral,spaincentral,newzealandnorth,indonesiacentral,malaysiawest,chilecentral,austriaeast,belgiumcentral&#39;.&quot;}</pre><p>So lint and build missed the invalid location but validate has picked up on it. If we change the location to ‘uksouth’ our Bicep passes validation:</p><pre>{<br>  &quot;error&quot;: null,<br>  &quot;id&quot;: &quot;/subscriptions/sub_id/resourceGroups/rg/providers/Microsoft.Resources/deployments/main&quot;,<br>  &quot;name&quot;: &quot;main&quot;,<br>  &quot;properties&quot;: {<br>    &quot;correlationId&quot;: &quot;6d51362d-0ed0-479c-9e00-6d0a04c7df48&quot;,<br>    &quot;debugSetting&quot;: null,<br>    &quot;dependencies&quot;: [],<br>    &quot;duration&quot;: &quot;PT0S&quot;,<br>    &quot;error&quot;: null,<br>    &quot;mode&quot;: &quot;Incremental&quot;,<br>    &quot;onErrorDeployment&quot;: null,<br>    &quot;outputResources&quot;: null,<br>    &quot;outputs&quot;: null,<br>    &quot;parameters&quot;: {<br>      &quot;anotherParam&quot;: {<br>        &quot;type&quot;: &quot;String&quot;,<br>        &quot;value&quot;: &quot;usefulString&quot;<br>      },<br>      &quot;name&quot;: {<br>        &quot;type&quot;: &quot;String&quot;,<br>        &quot;value&quot;: &quot;name&quot;<br>      }<br>    },<br>    &quot;parametersLink&quot;: null,<br>    &quot;providers&quot;: [<br>      {<br>        &quot;id&quot;: null,<br>        &quot;namespace&quot;: &quot;Microsoft.Storage&quot;,<br>        &quot;providerAuthorizationConsentState&quot;: null,<br>        &quot;registrationPolicy&quot;: null,<br>        &quot;registrationState&quot;: null,<br>        &quot;resourceTypes&quot;: [<br>          {<br>            &quot;aliases&quot;: null,<br>            &quot;apiProfiles&quot;: null,<br>            &quot;apiVersions&quot;: null,<br>            &quot;capabilities&quot;: null,<br>            &quot;defaultApiVersion&quot;: null,<br>            &quot;locationMappings&quot;: null,<br>            &quot;locations&quot;: [<br>              &quot;uksouth&quot;<br>            ],<br>            &quot;properties&quot;: null,<br>            &quot;resourceType&quot;: &quot;storageAccounts&quot;,<br>            &quot;zoneMappings&quot;: null<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;provisioningState&quot;: &quot;Succeeded&quot;,<br>    &quot;templateHash&quot;: &quot;12093554567674034375&quot;,<br>    &quot;templateLink&quot;: null,<br>    &quot;timestamp&quot;: &quot;2026-03-08T06:52:44.305259+00:00&quot;,<br>    &quot;validatedResources&quot;: [<br>      {<br>        &quot;id&quot;: &quot;/subscriptions/sub_id/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/name&quot;,<br>        &quot;resourceGroup&quot;: &quot;rg&quot;<br>      }<br>    ]<br>  },<br>  &quot;resourceGroup&quot;: &quot;rg&quot;,<br>  &quot;type&quot;: &quot;Microsoft.Resources/deployments&quot;<br>}</pre><p>But even the validate command has missed many issues with the template: a resource provider API version that doesn’t exist (2032–06–01), the SKU ‘ReallyGood’, minimum TLS version ‘TLS1_8’, and the string ‘car’ in the ipRules array.</p><pre>param name string<br>param anotherParam string = &#39;usefulString&#39;<br><br>resource sa &#39;Microsoft.Storage/storageAccounts@2032-06-01&#39; = {<br>  name: name<br>  location: &#39;uksouth&#39;<br>  kind: &#39;BlobStorage&#39;<br>  sku: {<br>    name: &#39;ReallyGood&#39;<br>  }<br>  properties: {<br>    accessTier: &#39;Hot&#39;<br>    allowBlobPublicAccess:  false<br>    defaultToOAuthAuthentication: true<br><br>    minimumTlsVersion: &#39;TLS1_8&#39;<br>    networkAcls: {<br>      bypass: &#39;AzureServices&#39;<br>      defaultAction: &#39;Deny&#39;<br>      ipRules: [&#39;car&#39;]<br>      virtualNetworkRules: []<br>    }<br>    supportsHttpsTrafficOnly: true<br>  }<br>}</pre><p>By using — debug we can see the validate command reaches out to a validate endpoint</p><pre>az deployment group validate -g rg -f main.bicep -p name=name --debug</pre><blockquote>cli.azure.cli.core.sdk.policies: Request URL: ‘<a href="https://management.azure.com/subscriptions/65098b6b-b71c-4374-bf9c-8a56f7d1acc4/resourcegroups/rg/providers/Microsoft.Resources/deployments/main/validate?api-version=2022-09-01&#39;">https://management.azure.com/subscriptions/my_sub_id/resourcegroups/rg/providers/Microsoft.Resources/deployments/main/<strong>validate?api-version=2022-09-01</strong>&#39;</a></blockquote><p>The REST API docs (https://learn.microsoft.com/en-us/rest/api/resources/deployments/validate) describe this endpoint as: “Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.” The key word here is “Azure Resource Manager” — not the resource provider. So the validate command dosen’t actually check validity with the resource provider.</p><h4><strong>What-If</strong></h4><p>Even the what-if command doesn’t catch these issues. What-if is fundamentally a diff tool, not a validation tool — it compares your template against the current state and tells you what would change, but it doesn’t validate whether those changes would actually succeed:</p><pre>  + Microsoft.Storage/storageAccounts/name [2032-06-01]<br><br>      apiVersion:                              &quot;2032-06-01&quot;<br>      id:                                      &quot;/subscriptions/sub_id/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/name&quot;<br>      kind:                                    &quot;BlobStorage&quot;<br>      location:                                &quot;uksouth&quot;<br>      name:                                    &quot;name&quot;<br>      properties.accessTier:                   &quot;Hot&quot;<br>      properties.allowBlobPublicAccess:        false<br>      properties.defaultToOAuthAuthentication: true<br>      properties.minimumTlsVersion:            &quot;TLS1_8&quot;<br>      properties.networkAcls.bypass:           &quot;AzureServices&quot;<br>      properties.networkAcls.defaultAction:    &quot;Deny&quot;<br>      properties.networkAcls.ipRules: [<br>        0: &quot;car&quot;<br>      ]<br>      properties.supportsHttpsTrafficOnly:     true<br>      sku.name:                                &quot;ReallyGood&quot;<br>      type:                                    &quot;Microsoft.Storage/storageAccounts&quot;<br><br>  * Microsoft.Storage/storageAccounts/3d65fr67tvbiu<br><br>Resource changes: 1 to create, 1 to ignore.</pre><p>The what-if happily echoes back all the invalid values — ‘ReallyGood’, ‘TLS1_8’, ‘car’ — without flagging any of them. It simply says “looks good to me”.</p><h4>Validation gap</h4><p>So we have a significant gap: lint/build checks code quality and type structure, validate checks whether ARM will accept the template structure, and what-if shows what would change — but none of them validate whether the resource provider will accept the property values. The only thing that truly validates resource property values is the actual deployment itself.</p><p>There are few Azure-native options to fully validate deployments before they run, but there are strategies to make sure our IaC is valid.</p><p>Use Azure Verified Modules</p><p>Azure Verified Modules (https://azure.github.io/Azure-Verified-Modules/) are Microsoft’s official Bicep modules that bake in best practices. They use typed parameters with constraints, so many invalid values are visible immediately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_dfHU4THi4XRZNepEIGpw.png" /></figure><p>Because the AVM module defines typed parameters with allowed values, passing ‘reallygood’ as a SKU name or ‘TLS1_8’ as a TLS version would be caught at build time — the Bicep compiler knows these aren’t valid values for the module’s parameters. You could also write your own modules that perform similar type validation using @allowed() decorators or user-defined types.</p><h4>Use PSRule</h4><p>PSRule for Azure (https://azure.github.io/PSRule.Rules.Azure/) is an open-source tool that validates ARM/Bicep templates against hundreds of rules covering Azure best practices. It runs offline and will catch all the issues in the above template.</p><p>PSRule runs on PowerShell and it’s a good candidate to be integrated into CI pipelines via GitHub Actions or Azure DevOps tasks without needing a local install.</p><h4>Summary</h4><p>Validating Bicep deployments requires a layered approach because no single tool catches everything. Lint and build catch code quality issues and type errors. ARM validate catches structural problems and invalid regions. What-if shows what would change but doesn’t validate values. And the resource provider only validates property values at actual deployment time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=889850152228" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure DevOps Build Agents: Microsoft-Hosted vs. Self-Hosted vs. Managed Pools]]></title>
            <link>https://medium.com/@jonny_11585/azure-devops-build-agents-microsoft-hosted-vs-self-hosted-vs-managed-pools-8c1ded34a28c?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c1ded34a28c</guid>
            <category><![CDATA[devops-tool]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[computes]]></category>
            <category><![CDATA[azure-devops]]></category>
            <category><![CDATA[pipeline]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Thu, 19 Feb 2026 06:54:18 GMT</pubDate>
            <atom:updated>2026-10-23T19:42:44.231Z</atom:updated>
            <content:encoded><![CDATA[<h4>What’s the difference between these options and how do they work?</h4><h3>Hosting options</h3><p>When we want to build code, run code or even deploy some IaC in an automated way, we need somewhere for these commands to run. This is usually just some compute to run CLI commands, and the best choice is to use pipelines. With pipelines we can integrate source control, event triggers and security scanning.</p><p>With Azure DevOps we have a few options to host our pipelines, basically we have:</p><blockquote>1. Microsoft hosted Agents</blockquote><blockquote>2. Self-Hosted Agents</blockquote><p>These models represent the compute that runs our jobs and tasks.</p><p>An Azure DevOps pipeline is broken down into tasks, jobs and stages — each job requires an agent to run tasks, which can be inline scripts or prebuilt tasks we can consume like <strong>AzureCLI@2</strong> which can run az cli commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bU3lTumt66N5YKOjcUtapQ.png" /></figure><p>Jobs are an extremely important concept for agent hosting. Microsoft provides a free job with up to 1,800 minutes a month, but the catch is only one job can be run simultaneously. If you want to run different jobs at the same time you need to purchase this — so you purchase concurrency. This is also the case for self-hosted agents, which we will go into more detail on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*IzmPsljGZJKm757rFNxL-w.png" /></figure><p>This is similar to GitHub repositories which provide free GitHub runners, but only if your project is a public one where people can browse to the repo from the internet. Microsoft have recently removed the option to have public Azure DevOps projects, so the table above only really applies if you already have publicly visible ADO projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*Pppvyqq6g14F-p2pg1qOOg.png" /></figure><h3>Microsoft hosted build agents</h3><p>How do I set this up? — Create a pipeline and specify a well-known image in the pipeline, then run.</p><pre>trigger: none<br><br>pool:<br>  vmImage: ubuntu-latest</pre><p>The first type of agent hosting is the Microsoft-hosted agent, where Microsoft manages the infrastructure, networking and agent provisioning, and you pass the agent your job. The Microsoft documentation states that each time you run a pipeline you get a fresh virtual machine for each job in a pipeline. This is probably achieved by pre-warmed virtual machine scale set instances. The instances are waiting for job allocation, after an instance runs the job it’s then destroyed and replaced by a new instance.</p><p>We can do some exploring of a Microsoft hosted image by creating a new pipeline in an azure devops project and running some commands to see what it tells us.</p><pre>trigger: none<br><br>pool:<br>  vmImage: ubuntu-latest<br><br>jobs:<br>- job: forensicInspection<br>  displayName: &quot;inspecting microsoft hosted agents&quot;<br>  steps:<br><br>  - bash: |<br>      echo &quot;env with grep&quot;<br>      env | sort | grep -E &#39;SYSTEM_|BUILD_|AGENT_|GITHUB_&#39; || true<br>    displayName: &quot;environment variables filtered with grep&quot;<br><br>  - bash: |<br>      echo &quot;env no grep&quot;<br>      env <br>    displayName: &quot;environment variables&quot;</pre><p>The output will give some additional insight into the agent</p><pre>AGENT_ACCEPTTEEEULA=True<br>AGENT_BUILDDIRECTORY=/home/vsts/work/1<br>AGENT_ID=8<br>AGENT_ISSELFHOSTED=0<br>SYSTEM_ISAZUREVM=1<br>SYSTEM_ISDOCKERCONTAINER=0<br>SYSTEM_TASKINSTANCENAME=Bash1<br>VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT=true<br>VSTSAGENT_DOCKER_ACTION_RETRIES=true<br>BUILD_ADVANCEDSECURITYENABLED=false<br>BUILD_QUEUEDBY=Jonny Diamond<br>BUILD_REPOSITORY_PROVIDER=TfsGit<br>BUILD_SOURCEBRANCH=refs/heads/main<br>BUILD_SOURCEBRANCHNAME=main</pre><p>The different environment variables have prefixes which give insight into what they are for. For example, <strong>BUILD_xx</strong> supplies information like the repository, who queued the job and whether Advanced Security is enabled (that’s probably GitHub Advanced Security). <strong>SYSTEM_TASKINSTANCENAME</strong> tells the agent you are running bash tasks, so expect bash commands. We can also see <strong>AGENT_ISSELFHOSTED</strong>, <strong>SYSTEM_ISAZUREVM</strong> and <strong>SYSTEM_ISDOCKERCONTAINER</strong> — these tell us that we aren’t using a self-hosted agent, it’s an Azure virtual machine, and that it’s not a Docker container. These variables are provided to an agent at execution runtime; it’s a bit like saying “here is the repo, here is the code and this is what you’re doing.”</p><h3>Managed DevOps Pools</h3><p>How do I set this up? — Deploy network resources, Dev Center, Dev Center project, then the <strong>Microsoft.DevOpsInfrastructure/pools</strong> resource. Add the pool in ADO.</p><p>The other flavour of Microsoft-managed agents is Managed DevOps Pools. These are agents which are managed on behalf of the customer by Microsoft. The compute is actually hosted in a Microsoft subscription, with the option to VNet-inject into a subnet of your choice by delegating the subnet to the Microsoft.DevOpsInfrastructure/pools service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RadAoh7fYXlcbynMiu9h6w.png" /></figure><p>When a pipeline is triggered and Azure DevOps requests an agent, a virtual machine agent is provisioned in a Microsoft-managed subscription. The VM’s NIC is injected into your delegated subnet as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Khqp6P4fUsocL2GKF2NdQ.png" /></figure><p>We can see this in our lab by viewing the connected devices in our delegated subnet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QBuvzppi81SWBVfriJnewA.png" /></figure><p>The subnet is delegated to the resource provider <strong>Microsoft.DevOpsInfrastructure/pools</strong>. This allows virtual machine agents in Microsoft’s managed subscription to have their NICs injected into this subnet, effectively surfacing the Managed DevOps Pool resource inside our virtual network.</p><p>In fact, if we click on the virtual machine in the portal under connected devices, we can see some more interesting information. We can see the Microsoft subscription it lives in and the tenant too. I am unable to list the resource as the issuer of the access token is not the correct tenant:</p><blockquote>{<br> “code”: “InvalidAuthenticationTokenTenant”,<br> “message”: “The access token is from the wrong issuer ‘<a href="https://sts.windows.net/my_tenant_id/&#39;">https://sts.windows.net/my_tenant_id/&#39;</a>. It must match the tenant ‘<a href="https://sts.windows.net/microsoft_tenant_id/&#39;">https://sts.windows.net/microsoft_tenant_id/&#39;</a> associated with this subscription. Please use the authority (URL) ‘<a href="https://login.windows.net/microsoft_tenant_id&#39;">https://login.windows.net/microsoft_tenant_id&#39;</a> to get the token. Note, if the subscription is transferred to another tenant there is no impact to the services, but information about new tenant could take time to propagate (up to an hour). If you just transferred your subscription and see this error message, please try back later.”<br>}</blockquote><p>This demonstrates the VM exists in Microsoft’s subscription, but its network interface is injected into our subnet. All traffic flows through our network infrastructure, giving us full control over routing, NSGs and firewall rules. It also demonstrates that Managed DevOps Pools run on virtual machine scale sets.</p><h3>Self-Hosted agents</h3><p>How do I set this up? — In ADO &gt; Project Settings &gt; Add Agent Pool &gt; Self-Hosted. Generate the zip and put it on your compute of choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*d8tt2kYxTjJg19kbiHMi5g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*lIpQnxm-zk0pK14hm3zhtQ.png" /></figure><p>The third option is self-hosted agents. In this scenario you host the agent yourself on your compute of choice: virtual machines, VMSS, Azure Container Apps or even AKS. The key difference between Microsoft-hosted or Managed DevOps Pools and self-hosted is that, as opposed to job sessions being provisioned on demand, self-hosted agents are instead long-running processes which poll Azure DevOps for jobs — they are always running and always listening for jobs.</p><h3>Azure Virtual Machine Scale Sets</h3><p>How do I set this up? — Deploy a VMSS, navigate to “Add Pool” in ADO, select the VMSS.</p><p>The final option is self-hosted on VMSS. This was Microsoft’s preferred choice for self-hosted agents, which allowed agents to be provisioned on an existing VMSS service to simplify deployment — no manual deploying of the agent. It’s also the inspiration behind Managed DevOps Pools. In this model, ADO manages the scaling when there are no agents waiting to pick up jobs or there are fewer agents than there should be. Like other self-hosted options, you can decide on the size and image you are running too, unlike the Microsoft-hosted agents which probably use Dasv5-size VMs.</p><h3>Summary</h3><p>So to host our ADO pipeline agents we have two main options: Microsoft-hosted and self-hosted. Managed DevOps Pools provide managed-on-behalf-of infrastructure injected into your network. Microsoft-hosted agents are fast to provision and useful in most cases, but they don’t have line of sight to private resources. Self-hosted agents maximise customisability but come with obvious management overhead, and you will still need to pay to run more than two jobs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*rgAdQbjJ_vW76_u9w6ntxg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c1ded34a28c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is an Azure deployment?]]></title>
            <link>https://medium.com/@jonny_11585/what-is-an-azure-deployment-e327e4ebc120?source=rss-94de0d5f8beb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e327e4ebc120</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[azure-bicep]]></category>
            <category><![CDATA[azure-resource-manager]]></category>
            <category><![CDATA[az-cli]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Jonny Diamond]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 06:10:07 GMT</pubDate>
            <atom:updated>2026-10-23T19:36:13.691Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been thinking recently about what a deployment actually is. When you deploy a resource via the portal, ARM, or with IaC, you’ll notice under the scope that there’s this thing called a deployment. It’s the same when using IaC modules and CLI deployments. Navigate to any recently deployed resource group or subscription and look under Settings &gt; Deployments and you’ll see what I mean. But what is it and what does it do?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*UZfXXXhBZjmr7w2k8yJu0w.png" /><figcaption>What are these?</figcaption></figure><p>For example, nesting Bicep modules like this — with a main.bicep file calling modules that call other modules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*1boz5YcTMzLlPZsq4B87XQ.png" /><figcaption>Many nested modules and a main.bicep</figcaption></figure><p>When deployed using the az deployment CLI command:</p><pre>az deployment group create -n my-deployment -g rg  -f main.bicep</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0c_u07ftz6zCQFtyxVg2Ew.png" /><figcaption>A deployment for every module and another for the command?</figcaption></figure><p>will result in five separate deployments you can view in the portal.</p><p>As we can see in the command, before we’ve even passed the Bicep template, we’re creating a deployment — but what is it? First we’ll need to talk about what Azure Resource manager is.</p><h4>What is ARM?</h4><p>Let’s talk about what Azure Resource Manager (ARM) is. It’s the management layer that takes requests for provisioning resources and actions them. When we use the portal, CLI, Bicep, or any IaC, we’re ultimately interacting with ARM. It acts as the management layer, checking the validity of requests and ensuring sufficient permissions (using its own permissions system). All requests for control plane activities and updates are sent to ARM at <a href="https://management.azure.com/">https://management.azure.com</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*cUquY1VPO4M19YrjLOoKSw.png" /><figcaption>ARM</figcaption></figure><p>The diagram demonstrates this nicely — no matter how the request for resources is made, it’s ARM that acts as the management layer for requests, the gateway to the resource providers.</p><p>Resource providers are another important component of provisioning Azure services. They’re the way ARM distributes requests to the relevant APIs that know how to provision the required resources. For example, a request for a virtual machine:</p><pre>// We pass the RP API version we want to use below <br>resource vm &#39;Microsoft.Compute/virtualMachines@2024-03-01&#39; = {<br>  name: &#39;myExampleVM&#39;<br>  location: &#39;uksouth&#39;<br>  properties: {<br>    hardwareProfile: {<br>      vmSize: &#39;Standard_B2s&#39;<br>    }<br>    osProfile: {<br>      computerName: &#39;myvm&#39;<br>      adminUsername: &#39;azureuser&#39;<br>      adminPassword: &#39;P@ssw0rd123!&#39;  // dont pass passwords like this<br>    }<br>    storageProfile: {<br>      imageReference: {<br>        publisher: &#39;Canonical&#39;<br>        offer: &#39;Ubuntu2204&#39;<br>        sku: &#39;22_04-lts-gen2&#39;<br>        version: &#39;latest&#39;<br>      }<br>      osDisk: {<br>        createOption: &#39;FromImage&#39;<br>        managedDisk: {<br>          storageAccountType: &#39;Standard_LRS&#39;<br>        }<br>      }<br>    }<br>    networkProfile: {<br>      networkInterfaces: [<br>        {<br>          id: networkInterface.id  <br>        }<br>      ]<br>    }<br>  }<br>}</pre><p>Pretty much every resource has a resource provider, which is accessed via ARM.</p><p><strong>Microsoft.Compute/virtualMachines</strong></p><p><strong>Microsoft.ContainerInstance</strong></p><p><strong>Microsoft.ContainerRegistry</strong></p><p><strong>Microsoft.AzureStack</strong></p><p>These resource providers know how to handle requests for provisioning the resources they control. The resource providers define the operations for managing the resource and its config (they are also the mechanism for auth).</p><p>So ARM takes requests for resources, and resource providers are APIs used to control and manage types of resources. Authorisation is accomplished using permissions over exposed RP APIs. But what is a deployment?</p><p>Even the Resource Manager documentation doesn’t explicitly call out what a deployment is.</p><blockquote>resource — A manageable item that’s available through Azure.</blockquote><blockquote>resource group — A container that holds related resources for an Azure solution.</blockquote><blockquote>resource provider — A service that supplies Azure resources.</blockquote><blockquote>ARM template — A JavaScript Object Notation (JSON) file that defines one or more resources to deploy to a resource group, subscription, management group, or tenant.</blockquote><blockquote>Bicep file — A file for declaratively deploying Azure resources.</blockquote><p>So a resource is a manageable item, a resource group is a logical container for resources and a resource provider is a service that supplies resources — but still no mention of a deployment.</p><p>If we check a subscription’s resource providers, we can see a resource provider called Microsoft.Resources, which is “registration free.” This means its status — whether registered or unregistered — doesn’t matter. You also can’t unregister it.</p><p>More clues can be found in the output of our nested deployment.</p><pre>{<br>  &quot;id&quot;: &quot;/subscriptions/sub_id/resourceGroups/rg/providers/Microsoft.Resources/deployments/my-deployment&quot;,<br>  &quot;location&quot;: null,<br>  &quot;name&quot;: &quot;my-deployment&quot;,<br>  &quot;properties&quot;: {<br>    &quot;correlationId&quot;: &quot;51e7f54e-9367-49bb-8a6e-613c00de3884&quot;,<br>    &quot;outputs&quot;: {<br>      &quot;greeting&quot;: {<br>        &quot;type&quot;: &quot;String&quot;,<br>        &quot;value&quot;: &quot;Help Im stuck!&quot;<br>      }<br>    },<br>    &quot;parameters&quot;: null,<br>    &quot;parametersLink&quot;: null,<br>    &quot;providers&quot;: [<br>      {<br>        &quot;id&quot;: null,<br>        &quot;namespace&quot;: &quot;Microsoft.Resources&quot;,<br>            &quot;properties&quot;: null,<br>            &quot;resourceType&quot;: &quot;deployments&quot;,<br>            &quot;zoneMappings&quot;: null<br>          }<br>        ]<br>      }<br>    ],<br>    &quot;provisioningState&quot;: &quot;Succeeded&quot;,<br>    &quot;templateHash&quot;: &quot;439532930182033670&quot;,<br>    &quot;templateLink&quot;: null,<br>    &quot;timestamp&quot;: &quot;2025-11-23T11:49:51.148630+00:00&quot;,<br>    &quot;validatedResources&quot;: null<br>  },<br>  &quot;resourceGroup&quot;: &quot;rg&quot;,<br>  &quot;tags&quot;: null,<br>  &quot;type&quot;: &quot;Microsoft.Resources/deployments&quot;<br>}</pre><p>We can see for the fields ‘type’ and ‘id’ the provider is ‘providers/Microsoft.Resources’ and ‘Microsoft.Resources/deployments’ we can also see in the API reference documentation that a deployment is a resource.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M2CSgAgmWTMagsFyqASX3A.png" /></figure><p>Okay so what happens when we use Microsoft.Resources to deploy our main.bicep? So the first step is to convert our bicep main.bicep into json</p><pre>az bicep build --file main.bicep</pre><p>Next step we create a new file deployment.bicep using the Microsoft.Resources/deployments resource type</p><pre>resource nested &#39;Microsoft.Resources/deployments@2021-04-01&#39; = {<br>  name: &#39;nestedDeployment&#39;<br>  properties: {<br>    mode: &#39;Incremental&#39;<br>    template: loadJsonContent(&#39;main.json&#39;)<br>  }<br>}</pre><p>and we can now deploy this again using az cli</p><pre>az deployment group create -n my-deployment -g rg  -f deployment.bicep --debug</pre><p>The result is we have another deployment in the portal, but this one contains all our previously nested deployments nestedDeployment, my-deployment then level 1 — level 4. So using Bicep we created a deployment to deploy our deployment which contains 4 other nested deployments. It seems that deployments are how we package requests to ARM for the provisioning of resources and this is automatically done for us by az cli.</p><p>The az deployments documentation confirms this, when we use the command az deployment group create — the az cli wraps our bicep in an ARM deployment resource. This is also the case for modules, hence why when we use a az deployment command, we get five deployments — one from the command and four from the modules.</p><pre>PUT https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version=2025-04-01</pre><h3>Validation and safety nets</h3><p>So now we know, a deployment is created as a resource itself — specifically a Microsoft.Resources/deployments resource — whose sole job is to orchestrate the creation of other resources defined in a template. It is the ‘container’ for the instructions we send to ARM, and because it is a resource, it can be nested inside other deployments just like any other Azure resource.</p><p>We can provision resources which aren’t wrapped in a deployment by using rest calls for example using the az rest command, try it out below.</p><pre>sub_Id=&quot;your-subscription-id&quot;<br>saName=&quot;yourstorageaccountname&quot;<br><br>az rest --method put \<br>  --url &quot;https://management.azure.com/subscriptions/${sub_Id}/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/${saName}?api-version=2023-01-01&quot; \<br>  --body &#39;{<br>    &quot;location&quot;: &quot;uksouth&quot;,<br>    &quot;sku&quot;: {<br>      &quot;name&quot;: &quot;Standard_LRS&quot;<br>    },<br>    &quot;kind&quot;: &quot;StorageV2&quot;,<br>    &quot;properties&quot;: {<br>      &quot;minimumTlsVersion&quot;: &quot;TLS1_2&quot;<br>    }<br>  }&#39;</pre><p>​We can bypass the deployment resource and ask the <a href="http://microsoft.storage/storageAccounts">Microsoft.Storage/storageAccounts</a> resource provider to provision a storage account for us, no need to get the deployments resource involved, and we can check this in the portal too — There is no deployment listed, but our storage account was deployed.</p><h4>Summary</h4><p>An Azure deployment (Microsoft.Resources/deployments) is a special type of resource which acts as a wrapper for requests to ARM, essentially orchestrating the deployment of resources — a broker between the requestor and ARM.</p><p>Deployment provides validation, auditability and progress monitoring. We can’t know if our template will fail or succeed until we ask the resource provider. A deployment does this for us.</p><p>So why use them? For validation that the deployment will (probably) work, to easily audit who deployed the resources and to make our life easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e327e4ebc120" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>