<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Incredible Technology, Incredibly Simple</title><link>https://damianflynn.com/</link><description>Incredible Technology, Incredibly Simple</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Mon, 16 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://damianflynn.com/index.xml" rel="self" type="application/rss+xml"/><item><title>bicep-deploy vs bicep-action: A Tool or a Workflow?</title><link>https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 16 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/hero.png" referrerpolicy="no-referrer">
            </div>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/bicep-deploy-vs-bicep-action/hero.png" alt="A tool versus a workflow" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>I maintain <a href="https://github.com/innofactororg/bicep-action" target="_blank" rel="noopener noreferrer">innofactororg/bicep-action</a>, so I should say up front that I am not a neutral party. I am also the person who most needs this comparison to be honest, because every time someone evaluates bicep-action for a new estate, the first question is the obvious one: why not just use Microsoft&rsquo;s?</p>
<p>Microsoft&rsquo;s answer to &ldquo;how do I deploy Bicep from a pipeline&rdquo; is <a href="https://github.com/Azure/bicep-deploy" target="_blank" rel="noopener noreferrer">Azure/bicep-deploy</a>, published as the <code>azure/bicep-deploy@v2</code> GitHub Action, with the same engine shipped to Azure DevOps as the <code>BicepDeploy@0</code> task. It is official, MIT-licensed, actively developed, and its latest release, v2.5.0 at the end of October 2026, added what-if support for deployment stacks. If you need to deploy a Bicep file to Azure from CI, it does that, cleanly and with Microsoft behind it.</p>
<p>bicep-action answers a different question. It is not a deploy step; it is a deployment workflow. It plans every change in the pull request, posts the plan as a comment for people to review, runs quality gates, and deploys only the plan that was approved, on GitHub and Azure DevOps alike.</p>
<p>That distinction, a tool versus a workflow, explains almost every row in the grids below. Most of the time the right choice is obvious once you know which one you need. This post sets out what each does, where each is stronger, and where each falls short, using the current releases of both: <code>azure/bicep-deploy</code> v2.5.0 and <code>BicepDeploy@0</code>, and bicep-action <code>v2026.11.13</code>.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="two-different-shapes" class="absolute -top-28"></div>
  Two different shapes
</h2>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/bicep-deploy-vs-bicep-action/layers.png" alt="The workflow sits on the primitive" class="w-full rounded-lg"  />
  
</figure>
</p>
<p><strong>Azure/bicep-deploy is a primitive.</strong> One step, one operation. You give it a <code>type</code> (<code>deployment</code> or <code>deploymentStack</code>), an <code>operation</code> (<code>create</code>, <code>validate</code>, <code>whatIf</code>, and for stacks <code>delete</code>), a <code>scope</code>, and your template and parameters. It compiles the Bicep, calls Azure Resource Manager through the Azure SDK for JavaScript, and writes the result to the log. Everything else about your pipeline, when it runs, who approves it, what happens to the what-if output, is yours to build around it.</p>
<p>Under the hood it is a TypeScript Node 24 action. The engine lives in a shared package, <code>@azure/bicep-deploy-common</code>, which the Azure Pipelines <code>BicepDeploy@0</code> task also consumes, so both platforms get the same behaviour and the same input set. Authentication is separate: on GitHub you run <code>azure/login</code> first, and the action picks up the credential through a chained Azure credential; on Azure DevOps you pass a service connection.</p>
<p><strong>bicep-action is a workflow.</strong> A plan action and a deploy action on GitHub, and a pipeline plus reusable stage templates on Azure DevOps, all running the same Bash scripts over the Azure CLI. The plan job builds, validates, runs the what-if, the delete gate, PSRule, a cost estimate and a snapshot check, then posts one comment on the pull request. The deploy job waits for an environment approval, deploys with the Bicep version and stack settings the plan used, and comments the result. Sign-in, provider registration and auto merge are part of it.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="at-a-glance" class="absolute -top-28"></div>
  At a glance
</h2>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Azure/bicep-deploy</th>
          <th>bicep-action</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>What it is</td>
          <td>A deploy/validate/what-if step</td>
          <td>A plan, review and deploy workflow</td>
      </tr>
      <tr>
          <td>Maintainer</td>
          <td>Microsoft</td>
          <td>Innofactor (open source)</td>
      </tr>
      <tr>
          <td>Licence</td>
          <td>MIT</td>
          <td>BSD 3-Clause</td>
      </tr>
      <tr>
          <td>GitHub</td>
          <td><code>azure/bicep-deploy@v2</code> action</td>
          <td><code>plan</code> and <code>deploy</code> composite actions</td>
      </tr>
      <tr>
          <td>Azure DevOps</td>
          <td><code>BicepDeploy@0</code> task (same engine)</td>
          <td>Full pipeline and stage templates (same scripts)</td>
      </tr>
      <tr>
          <td>Implementation</td>
          <td>TypeScript, Node 24, Azure SDK for JS</td>
          <td>Bash scripts over Azure CLI, Bicep CLI, jq</td>
      </tr>
      <tr>
          <td>Runner OS</td>
          <td>Any runner that runs Node actions</td>
          <td>Linux (Bash) runners</td>
      </tr>
      <tr>
          <td>Authentication</td>
          <td><code>azure/login</code> (GitHub), service connection (Azure DevOps)</td>
          <td>Built in: OpenID Connect or secret (GitHub), service connection (Azure DevOps)</td>
      </tr>
      <tr>
          <td>Where the what-if goes</td>
          <td>Job log, colour-formatted</td>
          <td>Pull request comment, logs artifact, and <code>whatif-summary.json</code></td>
      </tr>
      <tr>
          <td>Release model</td>
          <td>Semantic versions, <code>v2</code> major tag</td>
          <td>Dated releases, <code>v1</code> tag</td>
      </tr>
  </tbody>
</table>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="feature-coverage" class="absolute -top-28"></div>
  Feature coverage
</h2>
<p>This is the grid most people want. &ldquo;Build it yourself&rdquo; means the capability is not in the tool but you can assemble it from the platform and your own scripts.</p>
<table>
  <thead>
      <tr>
          <th>Capability</th>
          <th>Azure/bicep-deploy</th>
          <th>bicep-action</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Standard deployments: resource group, subscription, management group, tenant</td>
          <td>Yes</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>Deployment stacks: resource group, subscription, management group</td>
          <td>Yes</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>What-if for standard deployments</td>
          <td>Yes</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>What-if for stacks</td>
          <td>Yes (since v2.5.0)</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>Validate</td>
          <td>Yes, with <code>validation-level</code> (<code>provider</code>, <code>template</code>, <code>providerNoRbac</code>)</td>
          <td>Yes (validate step)</td>
      </tr>
      <tr>
          <td><code>.bicepparam</code> and JSON parameter files</td>
          <td>Yes</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>Inline parameters</td>
          <td>Yes (<code>parameters</code> input)</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Exclude change types from what-if</td>
          <td>Yes (<code>what-if-exclude-change-types</code>)</td>
          <td>No input; ignore and no-change results are left out of the comment</td>
      </tr>
      <tr>
          <td>Pin the Bicep version</td>
          <td>Yes (<code>bicep-version</code> input)</td>
          <td>Automatic: the deploy uses the version the plan recorded</td>
      </tr>
      <tr>
          <td>Template outputs as step outputs</td>
          <td>Yes, with <code>masked-outputs</code></td>
          <td>No; the deploy action has no outputs</td>
      </tr>
      <tr>
          <td>Sovereign clouds</td>
          <td>Yes (<code>environment</code> input)</td>
          <td>No input</td>
      </tr>
      <tr>
          <td>Delete a stack</td>
          <td>Yes (<code>operation: delete</code>)</td>
          <td>No</td>
      </tr>
      <tr>
          <td>What-if posted to the pull request</td>
          <td>Build it yourself</td>
          <td>Yes, one comment per plan</td>
      </tr>
      <tr>
          <td>Deploy result posted to the pull request</td>
          <td>Build it yourself</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>Approval before deploy</td>
          <td>Build it yourself with environments</td>
          <td>Built in, through environments</td>
      </tr>
      <tr>
          <td>Deploy exactly what was planned</td>
          <td>Build it yourself (pass the same version and settings)</td>
          <td>Yes: Bicep version, mode and stack settings enforced</td>
      </tr>
      <tr>
          <td>Approval list for stack deletes</td>
          <td>No</td>
          <td>Yes, delete gate with approved resource IDs</td>
      </tr>
      <tr>
          <td>Fail on non-deterministic deletes</td>
          <td>No</td>
          <td>Yes, in delete modes</td>
      </tr>
      <tr>
          <td>Policy and best-practice checks</td>
          <td>Build it yourself</td>
          <td>PSRule for Azure, optional</td>
      </tr>
      <tr>
          <td>Cost estimate and budget gate</td>
          <td>Build it yourself</td>
          <td>Azure Cost Estimator, optional failing threshold</td>
      </tr>
      <tr>
          <td>Snapshot drift check</td>
          <td>Build it yourself</td>
          <td>Automatic when a snapshot file is committed</td>
      </tr>
      <tr>
          <td>Machine-readable what-if summary</td>
          <td>No</td>
          <td><code>whatif-summary.json</code> (counts, IDs, deterministic, blocked)</td>
      </tr>
      <tr>
          <td>Wait for a new subscription to become visible</td>
          <td>No</td>
          <td>Yes, retries that one error up to 30 minutes</td>
      </tr>
      <tr>
          <td>Register resource providers before deploy</td>
          <td>No</td>
          <td>Yes, from the providers the plan found</td>
      </tr>
      <tr>
          <td>Keep existing tag values (such as <code>createdOn</code>)</td>
          <td>No</td>
          <td>Yes, scoped to resource groups you name</td>
      </tr>
      <tr>
          <td>Auto merge after deploy</td>
          <td>Build it yourself</td>
          <td>Yes (GitHub)</td>
      </tr>
      <tr>
          <td>One run at a time per target</td>
          <td>Build it yourself</td>
          <td>Documented concurrency pattern in every example</td>
      </tr>
      <tr>
          <td>Multi-environment examples</td>
          <td>Single-environment examples</td>
          <td>Test → production examples for both platforms</td>
      </tr>
  </tbody>
</table>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="deployment-stacks-side-by-side" class="absolute -top-28"></div>
  Deployment stacks, side by side
</h2>
<p>Stacks are where both projects have invested most, and where they differ in philosophy rather than coverage.</p>
<table>
  <thead>
      <tr>
          <th>Stack option</th>
          <th>Azure/bicep-deploy</th>
          <th>bicep-action</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Action on unmanaged resources</td>
          <td>Separate settings for resources, resource groups and management groups (<code>delete</code> or <code>detach</code>)</td>
          <td>One setting: <code>detachAll</code> (default), <code>deleteResources</code>, <code>deleteAll</code></td>
      </tr>
      <tr>
          <td>Deny settings mode</td>
          <td><code>none</code>, <code>denyDelete</code>, <code>denyWriteAndDelete</code></td>
          <td><code>none</code>, <code>denyDelete</code>, <code>denyWriteAndDelete</code></td>
      </tr>
      <tr>
          <td>Deny settings excluded actions and principals</td>
          <td>Yes</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Deny settings on child scopes</td>
          <td>Yes</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Bypass the stack out-of-sync error</td>
          <td>Yes</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Stack description and tags</td>
          <td>Yes</td>
          <td>No</td>
      </tr>
      <tr>
          <td>Deletes require an approval list</td>
          <td>No</td>
          <td>Yes</td>
      </tr>
      <tr>
          <td>Re-check deletes immediately before deploy</td>
          <td>No</td>
          <td>Yes, in delete modes</td>
      </tr>
      <tr>
          <td>Stack settings must match the plan</td>
          <td>No</td>
          <td>Yes</td>
      </tr>
  </tbody>
</table>
<p>Microsoft exposes more of the stack API, and if you need deny-setting exclusions for a break-glass principal, or per-scope control of what gets deleted, bicep-action cannot express that today.</p>
<p>bicep-action, on the other hand, treats deletion as something that needs a reviewed commit. With <code>action-on-unmanage-resources: delete</code> in Microsoft&rsquo;s action, removing a resource from the template deletes it on the next <code>create</code>. That is the documented, intended behaviour of a stack. Whether a human saw the what-if first depends entirely on how you built the pipeline around it. In bicep-action, a delete mode fails the plan unless every resource the stack would delete is listed by ID in an approved-deletes file, and fails it outright if Azure cannot determine every resource that might be deleted. The deploy job then runs that check again against the current state, because the plan may be hours old.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="strengths-and-weaknesses-honestly" class="absolute -top-28"></div>
  Strengths and weaknesses, honestly
</h2>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/bicep-deploy-vs-bicep-action/choose.png" alt="Choosing between composing and adopting" class="w-full rounded-lg"  />
  
</figure>
</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="azurebicep-deploy"><a href="#azurebicep-deploy" class="header-mark" aria-label="Header mark for 'Azure/bicep-deploy'"></a>
    Azure/bicep-deploy
</h3>

<p><strong>Where it is stronger</strong></p>
<ul>
<li><strong>It is Microsoft&rsquo;s.</strong> Official support, the Bicep team&rsquo;s own contributors, a Contributor Licence Agreement process, CodeQL and dependency automation. For organisations that only adopt vendor-supported tooling, that ends the discussion.</li>
<li><strong>It is light and portable.</strong> A single Node step with no Azure CLI dependency, running on Linux, Windows or macOS runners, with the Bicep binary kept in the runner&rsquo;s tool cache, so a self-hosted runner downloads each version once.</li>
<li><strong>It exposes more of the API.</strong> Validation levels, what-if change-type filters, inline parameters, sovereign clouds, stack delete, and the full set of stack and deny-setting options.</li>
<li><strong>Outputs flow on.</strong> Template outputs become step outputs, with masking for sensitive ones, so a later step can use the endpoint or resource ID the deployment produced.</li>
<li><strong>Same engine on both platforms.</strong> The GitHub Action and the <code>BicepDeploy@0</code> task share one package, so behaviour matches.</li>
<li><strong>It composes.</strong> Because it does one thing, it fits into whatever pipeline design you already have.</li>
</ul>
<p><strong>Where it falls short</strong></p>
<ul>
<li><strong>It is not a review workflow.</strong> The what-if goes to the job log. Getting it in front of a reviewer, gating the deploy on that review, and posting the result back are all left to you.</li>
<li><strong>Plan and deploy are separate, unrelated runs.</strong> The examples validate on pull requests and create on push to main. Nothing records what the what-if run used, so nothing guarantees the deployment matches what anyone looked at, unless you pin the Bicep version and settings yourself in both places.</li>
<li><strong>Deletes are not gated.</strong> Stacks will delete what you tell them to, with no approval list and no check for hidden deletes.</li>
<li><strong>No quality gates.</strong> Policy checks, cost estimates and drift checks are outside its scope.</li>
<li><strong>Young in places.</strong> Stack what-if arrived in v2.5.0 in October 2026, and the Azure DevOps task is still on major version 0.</li>
</ul>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="bicep-action"><a href="#bicep-action" class="header-mark" aria-label="Header mark for 'bicep-action'"></a>
    bicep-action
</h3>

<p><strong>Where it is stronger</strong></p>
<ul>
<li><strong>The workflow is the product.</strong> Plan in the pull request, one comment with everything a reviewer needs, approval through the platform&rsquo;s own environments, deployment of the approved plan, result posted back. Nothing to assemble.</li>
<li><strong>Deploy matches plan as closely as ARM allows.</strong> The deploy installs the plan&rsquo;s Bicep version, refuses different stack settings, and re-runs the delete gate. ARM has no saved plan file, so this is not a guarantee in the way Terraform&rsquo;s is, but it closes the gaps a pipeline can close.</li>
<li><strong>Safety by default.</strong> Deletes need a reviewed list of IDs, non-deterministic deletes fail, PSRule and a cost budget can fail the plan, and a committed snapshot catches template drift, including drift caused by a Bicep release.</li>
<li><strong>Built for the details that break real pipelines.</strong> New subscriptions that are not visible yet, providers that are not registered, <code>createdOn</code> tags that should not be overwritten, masked values that garble a comment. Each feature exists because a production pipeline hit it.</li>
<li><strong>Automation-ready.</strong> <code>whatif-summary.json</code> lets you auto-approve plans that are provably safe and route the rest to a person.</li>
<li><strong>Same comments on GitHub and Azure DevOps,</strong> including multi-environment stage templates for Azure DevOps.</li>
</ul>
<p><strong>Where it falls short</strong></p>
<ul>
<li><strong>It is not Microsoft&rsquo;s.</strong> It is maintained by a partner team, and its priorities follow the production estates it runs in.</li>
<li><strong>Linux and Bash only.</strong> It shells out to the Azure CLI, Bicep CLI, jq and Perl, so it needs a Linux runner and is slower to start than a single Node step.</li>
<li><strong>Narrower API surface.</strong> No sovereign-cloud input, no inline parameters, no validation-level or what-if filters, no stack delete operation, and fewer stack and deny-setting options.</li>
<li><strong>No deployment outputs.</strong> If a later step needs a value the template produced, you query Azure for it.</li>
<li><strong>Opinionated.</strong> It assumes pull requests, environments and approvals. If your process deploys on push without review, most of what it does is in the way.</li>
<li><strong>Azure DevOps downloads the scripts at run time</strong> from GitHub at the pinned release, so agents need to reach GitHub, and the template repository is referenced through a GitHub service connection.</li>
</ul>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="which-one-should-you-use" class="absolute -top-28"></div>
  Which one should you use?
</h2>
<p>Use <strong>Azure/bicep-deploy</strong> when you need a deployment step inside a pipeline you already own: a release pipeline with its own gates, a tool that consumes deployment outputs, a sovereign cloud, Windows runners, stack options bicep-action does not expose, or a policy that only vendor-supported tooling is allowed. It is also the right building block if you want to design your own review workflow from scratch.</p>
<p>Use <strong>bicep-action</strong> when what you want is the workflow: changes reviewed as plans in pull requests, deletes approved in commits, cost and policy checked before anyone deploys, and the same experience on GitHub and Azure DevOps. It is the one to pick when the question is not &ldquo;how do I deploy this file&rdquo; but &ldquo;how do I stop anyone deploying something nobody looked at&rdquo;.</p>
<p>They are not really competitors. bicep-deploy is a good primitive, and bicep-action is a workflow that today happens to be built on the Azure CLI rather than on that primitive. The gaps in the grids above run in opposite directions, which is usually a sign that two tools are solving different problems well. If you are standing at that fork, start from the question you are actually trying to answer, and the grid will tell you the rest.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="sources" class="absolute -top-28"></div>
  Sources
</h2>
<ul>
<li><a href="https://github.com/Azure/bicep-deploy" target="_blank" rel="noopener noreferrer">Azure/bicep-deploy</a>: README, <code>action.yml</code>, examples and release notes for v2.4.0 and v2.5.0</li>
<li><a href="https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/BicepDeployV0" target="_blank" rel="noopener noreferrer"><code>BicepDeployV0</code> task</a> in microsoft/azure-pipelines-tasks</li>
<li><a href="https://github.com/innofactororg/bicep-action" target="_blank" rel="noopener noreferrer">innofactororg/bicep-action</a>: README, how it works, configuration reference and examples at <code>v2026.11.13</code></li>
</ul>
<p><a href="https://damianflynn.com/posts/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/bicep-deploy-vs-bicep-action-a-tool-or-a-workflow.gif" width="1" height="1" alt="" />]]></description></item><item><title>Agents need an identity, and your IT department will say no</title><link>https://damianflynn.com/talks/agents-need-an-identity-innofactor-briefing/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Fri, 13 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/talks/agents-need-an-identity-innofactor-briefing/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/talks/agents-need-an-identity-innofactor-briefing/01-title.jpg" referrerpolicy="no-referrer">
            </div><h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="abstract" class="absolute -top-28"></div>
  Abstract
</h2>
<p>Everyone agrees AI agents should be treated like employees: their own identity, scoped permissions, an owner, monitoring and offboarding. Then you try to do it.</p>
<p>The agent on your laptop runs as you, because your machine is the security context. Your IT team rejects the application identity you ask for, because it doesn&rsquo;t do MFA. Half your backends never see Entra ID at all, because they authenticate with personal access tokens. And the moment an agent can act on behalf of a user, &ldquo;who owns this agent&rdquo; quietly turns into &ldquo;whose permissions does it have&rdquo;.</p>
<p>This session is a practitioner&rsquo;s account of doing this for real, using our own company as customer zero. We&rsquo;ll cover where the identity breaks down, how an AI gateway can translate between Entra and legacy backends, and a simple governance model that holds up: an organisational ruleset for every agent, a versioned authorisation contract for each one, and runtime enforcement that stops an agent exceeding its contract even when it&rsquo;s prompted to. Moving from &ldquo;draft a message&rdquo; to &ldquo;send a message&rdquo; is a permission change, not a new feature.</p>
<p>What attendees will learn:</p>
<ul>
<li>Why agents default to the human&rsquo;s identity, and what it takes to change that</li>
<li>Getting agent identities approved by security teams that currently say no</li>
<li>Using an AI gateway to bring non-Entra backends under the same control</li>
<li>A three-layer governance model: organisational rules, per-agent contracts, runtime enforcement</li>
<li>Why every change in an agent&rsquo;s authority needs a version, an approver and evidence</li>
</ul>
<p>Level: Intermediate–Advanced (300–400)</p>
<p>Audience: Security architects, identity and platform teams, AI and governance leads</p>
<p><a href="https://damianflynn.com/talks/agents-need-an-identity-innofactor-briefing/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/agents-need-an-identity-innofactor-briefing.gif" width="1" height="1" alt="" />]]></description></item><item><title>Agents need an identity, and your IT department will say no</title><link>https://damianflynn.com/talks/agents-need-an-identity/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Tue, 10 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/talks/agents-need-an-identity/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/talks/agents-need-an-identity/01-title.jpg" referrerpolicy="no-referrer">
            </div><h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="abstract" class="absolute -top-28"></div>
  Abstract
</h2>
<p>Everyone agrees AI agents should be treated like employees: their own identity, scoped permissions, an owner, monitoring and offboarding. Then you try to do it.</p>
<p>The agent on your laptop runs as you, because your machine is the security context. Your IT team rejects the application identity you ask for, because it doesn&rsquo;t do MFA. Half your backends never see Entra ID at all, because they authenticate with personal access tokens. And the moment an agent can act on behalf of a user, &ldquo;who owns this agent&rdquo; quietly turns into &ldquo;whose permissions does it have&rdquo;.</p>
<p>This session is a practitioner&rsquo;s account of doing this for real, using our own company as customer zero. We&rsquo;ll cover where the identity breaks down, how an AI gateway can translate between Entra and legacy backends, and a simple governance model that holds up: an organisational ruleset for every agent, a versioned authorisation contract for each one, and runtime enforcement that stops an agent exceeding its contract even when it&rsquo;s prompted to. Moving from &ldquo;draft a message&rdquo; to &ldquo;send a message&rdquo; is a permission change, not a new feature.</p>
<p>What attendees will learn:</p>
<ul>
<li>Why agents default to the human&rsquo;s identity, and what it takes to change that</li>
<li>Getting agent identities approved by security teams that currently say no</li>
<li>Using an AI gateway to bring non-Entra backends under the same control</li>
<li>A three-layer governance model: organisational rules, per-agent contracts, runtime enforcement</li>
<li>Why every change in an agent&rsquo;s authority needs a version, an approver and evidence</li>
</ul>
<p>Level: Intermediate–Advanced (300–400)</p>
<p>Audience: Security architects, identity and platform teams, AI and governance leads</p>
<p><a href="https://damianflynn.com/talks/agents-need-an-identity/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/agents-need-an-identity.gif" width="1" height="1" alt="" />]]></description></item><item><title>Letting AI operate production Azure — what it gets wrong</title><link>https://damianflynn.com/talks/ai-operating-production/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Tue, 10 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/talks/ai-operating-production/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/talks/ai-operating-production/00-title.jpg" referrerpolicy="no-referrer">
            </div><h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="abstract" class="absolute -top-28"></div>
  Abstract
</h2>
<p>Real failure stories from AI-assisted operations, each with the guardrail that fixed it:</p>
<ul>
<li>an Azure GET can&rsquo;t prove a property is settable (recommended four times off an empty read);</li>
<li>advising a change from a stale read in the middle of a cutover;</li>
<li>restating a verified fact until it&rsquo;s wrong;</li>
<li>a disk caching change that hot-detached a production disk;</li>
<li>&ldquo;a freeze is not a control&rdquo;.</li>
</ul>
<p>Plus the patterns that worked: subagents, cross-model review with gh copilot, and grep-verifying every HIGH finding. It&rsquo;s honest, funny, and very MVP.</p>
<p><a href="https://damianflynn.com/talks/ai-operating-production/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/ai-operating-production.gif" width="1" height="1" alt="" />]]></description></item><item><title>bicep-action: Plan, Review and Deploy Bicep from Pull Requests</title><link>https://damianflynn.com/posts/bicep-action-plan-review-and-deploy-bicep-from-pull-requests/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 09 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/bicep-action-plan-review-and-deploy-bicep-from-pull-requests/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/bicep-action-plan-review-and-deploy-bicep-from-pull-requests/hero.png" referrerpolicy="no-referrer">
            </div><p>






<figure class="my-8">
  <img src="https://raw.githubusercontent.com/innofactororg/bicep-action/v1/docs/images/hero.png" alt="Plan, review, deploy" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>Terraform teams stopped deploying blind years ago. They open a pull request, a bot runs <code>terraform plan</code> and posts the result as a comment, a colleague reads exactly what will be created, changed and destroyed, and only then does anyone type <code>atlantis apply</code>. Most Bicep teams still merge and find out. The pipeline runs, the deployment succeeds or fails, and the first time anyone sees what Azure actually did is in the activity log afterwards.</p>
<p>That gap is why we built <strong>bicep-action</strong>. It is a pair of GitHub actions and an Azure DevOps pipeline that run Bicep the way Atlantis runs Terraform. Every change is planned in the pull request, the plan is reviewed by people, and only the approved plan is deployed. GitHub and Azure DevOps run the same shell scripts and post the same pull request comments, so a team can move between the two platforms without relearning anything.</p>
<p>It is free. The code and documentation are published under the BSD 3-Clause licence in a public repository, <a href="https://github.com/innofactororg/bicep-action" target="_blank" rel="noopener noreferrer">innofactororg/bicep-action</a>, and you can pin it, fork it or read every line of it. It is also not a weekend project. The first commit was in November 2023, it has shipped fifteen releases since, and it is the mandated pipeline for every Bicep workload repository in one of the larger managed Azure estates we run, on Azure DevOps, as well as the pipeline behind the workloads our subscription-vending engine creates. Every fix in this week&rsquo;s release, <code>v2026.11.13</code>, came from something a production pipeline hit.</p>
<p>This post walks through what it does, how it compares with Atlantis, and how to run it for one environment or for several.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="what-happens-when-you-open-a-pull-request" class="absolute -top-28"></div>
  What happens when you open a pull request
</h2>
<p>The flow has two jobs and a person in between.</p>

<figure class="mermaid-diagram my-8">
<pre class="mermaid pele" hidden>sequenceDiagram
    autonumber
    actor Dev as Engineer
    participant PR as Pull request
    participant Plan as Plan job
    participant Rev as Reviewer
    participant Dep as Deploy job
    participant Az as Azure
    Dev-&gt;&gt;PR: Push a branch, open a pull request
    PR-&gt;&gt;Plan: Trigger the workflow or pipeline
    Plan-&gt;&gt;Az: Build, validate, what-if (read only)
    Plan-&gt;&gt;PR: One comment: what-if, rules, cost, snapshot
    Rev-&gt;&gt;PR: Read the plan
    Rev-&gt;&gt;Dep: Approve the environment
    Dep-&gt;&gt;Az: Deploy with the plan&#39;s Bicep version and settings
    Dep-&gt;&gt;PR: Comment the result (and auto merge on GitHub)</pre>
<details class="mermaid-source"><summary>Diagram source</summary><pre>sequenceDiagram
    autonumber
    actor Dev as Engineer
    participant PR as Pull request
    participant Plan as Plan job
    participant Rev as Reviewer
    participant Dep as Deploy job
    participant Az as Azure
    Dev-&gt;&gt;PR: Push a branch, open a pull request
    PR-&gt;&gt;Plan: Trigger the workflow or pipeline
    Plan-&gt;&gt;Az: Build, validate, what-if (read only)
    Plan-&gt;&gt;PR: One comment: what-if, rules, cost, snapshot
    Rev-&gt;&gt;PR: Read the plan
    Rev-&gt;&gt;Dep: Approve the environment
    Dep-&gt;&gt;Az: Deploy with the plan&#39;s Bicep version and settings
    Dep-&gt;&gt;PR: Comment the result (and auto merge on GitHub)</pre></details>
<figcaption data-mermaid-auto-caption>Figure 4</figcaption>
</figure>
<p>The <strong>plan job</strong> only reads from Azure. It compiles the template, validates it, asks Azure what the deployment would change, runs the quality checks, and posts everything as <strong>one comment</strong> on the pull request. Any failed check fails the plan, and the deployment never starts.</p>
<p>The approval step uses what each platform already has. On GitHub it is an environment with required reviewers; on Azure DevOps it is an environment with an approval check. There is no bespoke approval mechanism to learn or secure.</p>
<p>The <strong>deploy job</strong> runs only after a successful plan and an approval. It deploys, comments the result on the same pull request, and on GitHub can turn on auto merge, so the branch is merged the moment the deployment succeeds. Main stays a record of what is actually deployed, which is the same property Atlantis users rely on.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="what-the-plan-checks" class="absolute -top-28"></div>
  What the plan checks
</h2>
<p>






<figure class="my-8">
  <img src="https://raw.githubusercontent.com/innofactororg/bicep-action/v1/docs/images/plan-gates.png" alt="The checks in the plan job" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>A plan is more than a what-if. The plan job runs a sequence of gates, each of which can fail the plan:</p>
<table>
  <thead>
      <tr>
          <th>Step</th>
          <th>What it checks</th>
          <th>Fails the plan when</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Bicep build</td>
          <td>The template and <code>.bicepparam</code> compile with the latest Bicep release</td>
          <td>It does not compile</td>
      </tr>
      <tr>
          <td>Validate</td>
          <td><code>az deployment &lt;scope&gt; validate</code>, and which resource providers the template needs</td>
          <td>Azure rejects the template</td>
      </tr>
      <tr>
          <td>What-if</td>
          <td>What Azure would create, modify or delete; with stacks, what it would detach or delete</td>
          <td>The what-if fails, or a stack would delete something not approved</td>
      </tr>
      <tr>
          <td>PSRule <em>(opt-in)</em></td>
          <td>PSRule for Azure against the Well-Architected rules</td>
          <td>A rule fails</td>
      </tr>
      <tr>
          <td>Cost estimate</td>
          <td>The monthly cost of the compiled template</td>
          <td>It exceeds your threshold</td>
      </tr>
      <tr>
          <td>Bicep snapshot <em>(automatic)</em></td>
          <td>The template against a committed snapshot of every resource it produces</td>
          <td>The template no longer matches the snapshot</td>
      </tr>
  </tbody>
</table>
<p>The what-if is the heart of the comment. It is posted as a coloured diff, <code>+</code> for create, <code>-</code> for delete, <code>!</code> for modify, with property-level changes listed under each resource and long results folded away. Reviewers read infrastructure changes the way they read code changes.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="deletes-are-approved-in-a-commit-not-discovered-afterwards"><a href="#deletes-are-approved-in-a-commit-not-discovered-afterwards" class="header-mark" aria-label="Header mark for 'Deletes are approved in a commit, not discovered afterwards'"></a>
    Deletes are approved in a commit, not discovered afterwards
</h3>

<p>The single most valuable thing bicep-action does is make deletes visible and deliberate. With <code>deployment_mode: stack</code>, the template is deployed as an Azure <strong>deployment stack</strong>, which means Azure knows which resources belong to the template. When you remove something from the code, the stack what-if shows exactly what would be detached or deleted.</p>
<p>






<figure class="my-8">
  <img src="https://raw.githubusercontent.com/innofactororg/bicep-action/v1/docs/images/stacks.png" alt="A stack creates, detaches, and deletes only when approved" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>The default behaviour for removed resources, <code>detachAll</code>, never deletes anything; the resource is simply released from the stack. If you choose <code>deleteResources</code> or <code>deleteAll</code>, a <strong>delete gate</strong> applies: the plan fails unless every resource the stack would delete is listed, by resource ID, in an approved-deletes file in the repository. Deleting a production resource therefore needs a reviewed commit that names it. If Azure cannot determine every resource that might be deleted, because some names are only known at deploy time, the plan fails rather than risk a hidden delete.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="a-snapshot-that-puts-the-real-change-in-the-diff"><a href="#a-snapshot-that-puts-the-real-change-in-the-diff" class="header-mark" aria-label="Header mark for 'A snapshot that puts the real change in the diff'"></a>
    A snapshot that puts the real change in the diff
</h3>

<p>Bicep can now produce a <strong>snapshot</strong>: a fully expanded list of every resource the template produces, computed offline. Commit it next to your parameters file and the plan compares the template with it. If the template&rsquo;s output changes, the plan fails until you regenerate and commit the snapshot, at which point the exact resource-level change sits in the pull request diff. A refactor that claims to change nothing can prove it. A Bicep release that silently changes compiled output gets reviewed like any other change.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="cost-before-you-spend-it"><a href="#cost-before-you-spend-it" class="header-mark" aria-label="Header mark for 'Cost before you spend it'"></a>
    Cost before you spend it
</h3>

<p>The plan runs the Azure Cost Estimator against the compiled template and puts the monthly estimate in the comment. Set a <code>cost_threshold</code> and the plan fails when the estimate exceeds it, or when the estimate cannot be made, because a budget you cannot check is not a budget. Leave it at the default and the estimate is report-only.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="deploy-exactly-what-was-planned" class="absolute -top-28"></div>
  Deploy exactly what was planned
</h2>
<p>






<figure class="my-8">
  <img src="https://raw.githubusercontent.com/innofactororg/bicep-action/v1/docs/images/plan-equals-deploy.png" alt="The deployment matches the plan" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>A reviewer approves a specific plan. If the deployment can drift from that plan, the review is worth very little. bicep-action closes the obvious gaps:</p>
<ul>
<li><strong>The same Bicep version.</strong> The plan records the Bicep CLI version it compiled with. The deploy job installs that version, even if a newer one shipped while the plan waited for approval.</li>
<li><strong>The same mode and stack settings.</strong> The plan records its deployment mode and stack settings, and a deployment with different settings fails and asks for a new plan.</li>
<li><strong>Deletes checked again.</strong> With a delete mode, the deploy job runs the delete gate again against the current state, immediately before deploying, because a plan can be hours old.</li>
<li><strong>Fresh state where it matters.</strong> Values read from Azure during planning, such as existing tag values, are read again at deploy time rather than reused.</li>
</ul>
<p>On Azure DevOps the deploy stage picks these values up from the plan stage automatically. On GitHub you pass the plan action&rsquo;s outputs to the deploy action, which every example in the repository already does.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="how-it-compares-with-atlantis" class="absolute -top-28"></div>
  How it compares with Atlantis
</h2>
<p>bicep-action exists because Atlantis is right about the workflow. The comparison is worth making honestly, because the platforms are different in ways that matter.</p>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Atlantis</th>
          <th>bicep-action</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Language</td>
          <td>Terraform and OpenTofu</td>
          <td>Azure Bicep (and ARM JSON)</td>
      </tr>
      <tr>
          <td>Where it runs</td>
          <td>A self-hosted server that receives webhooks</td>
          <td>Inside your existing GitHub Actions or Azure DevOps runners; nothing to host</td>
      </tr>
      <tr>
          <td>Plan</td>
          <td><code>terraform plan</code>, posted as a comment</td>
          <td>Build, validate, what-if, PSRule, cost and snapshot, posted as one comment</td>
      </tr>
      <tr>
          <td>Apply trigger</td>
          <td>An <code>atlantis apply</code> comment, subject to apply requirements</td>
          <td>An environment approval in the platform&rsquo;s own UI</td>
      </tr>
      <tr>
          <td>Plan equals apply</td>
          <td>Applies the saved plan file</td>
          <td>No saved plan exists in ARM; the Bicep version and settings are pinned and deletes are re-checked</td>
      </tr>
      <tr>
          <td>Locking</td>
          <td>Per project or directory, held until the pull request merges or is unlocked</td>
          <td>A concurrency group per Azure target on GitHub; one run at a time, deployments never cancelled</td>
      </tr>
      <tr>
          <td>Policy</td>
          <td>Conftest/OPA policy checks</td>
          <td>PSRule for Azure, with your own baseline and rules</td>
      </tr>
      <tr>
          <td>Cost</td>
          <td>Not built in</td>
          <td>Azure Cost Estimator, with an optional failing threshold</td>
      </tr>
      <tr>
          <td>Deletes</td>
          <td>Shown as destroys in the plan</td>
          <td>Stack what-if plus a delete gate that requires approved IDs</td>
      </tr>
      <tr>
          <td>Licence</td>
          <td>Apache 2.0</td>
          <td>BSD 3-Clause</td>
      </tr>
  </tbody>
</table>
<p>Two rows deserve a closer look.</p>
<p><strong>Plan equals apply.</strong> Atlantis applies the exact plan file it showed you, which is the strongest guarantee available. ARM has no equivalent: a what-if is a preview, not a contract, and Azure re-evaluates the template at deployment time. bicep-action gets as close as the platform allows by pinning the compiler and settings and re-running the delete gate, but if something in Azure changes between plan and deploy, the deployment acts on the new state. Treat an old plan with suspicion, and re-plan when in doubt.</p>
<p><strong>No server.</strong> Atlantis is a long-running service with credentials, a webhook endpoint and its own user interface, and it has to be patched, scaled and secured like any other. bicep-action has no running component. Credentials are your platform&rsquo;s own workload identity federation or service connection, approvals are your platform&rsquo;s environments, logs are your platform&rsquo;s artifacts. The attack surface is the one you already have.</p>
<p>The lock deserves a note too. On GitHub, each example puts the workflow in a concurrency group per Azure target with <code>cancel-in-progress: false</code>. A second pull request waits until the first is deployed or rejected, so a deployment never runs over changes it did not plan. GitHub keeps one waiting run per group, so a newer waiting run replaces an older one, which is usually what you want.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="the-details-that-usually-break-pipelines" class="absolute -top-28"></div>
  The details that usually break pipelines
</h2>
<p>A few features exist because production pipelines kept tripping over the same things.</p>
<p><strong>New subscriptions.</strong> A pipeline that runs against a subscription created minutes earlier, which is exactly what subscription vending produces, often cannot see it yet, or its role assignments have not propagated. The scripts retry that one error, the subscription not being visible, for up to <code>subscription_wait_minutes</code> (30 by default), logging what the identity can see on each attempt. Any other error, such as a missing permission, still fails at once. In real runs we have watched that window last more than an hour.</p>
<p><strong>Tags that should keep their first value.</strong> Tags such as <code>createdOn</code> are meant to record when a resource was first deployed, but a template that sets them overwrites them on every run. The existing tags feature reads chosen tag values from the resources already in Azure, scoped to the resource groups you name, and passes them into the template so they survive redeployment.</p>
<p><strong>Automation on top of the plan.</strong> Every plan writes <code>whatif-summary.json</code>: counts of creates, modifies, deletes, detaches and unsupported changes, the IDs involved, and whether the result was deterministic. One of the examples uses it to auto-approve plans that are provably safe, such as a plan with no deletes, no detaches, no unsupported changes and a deterministic result, and routes everything else to a human.</p>
<p><strong>Secrets in the comment.</strong> Azure masks secret values in the what-if. This week&rsquo;s release makes sure those masked values render correctly in Azure DevOps comments, where a run of asterisks used to turn the rest of the what-if into an unreadable block of comment colouring. It is a small fix, and a good example of why the project moves the way it does: it came from a reviewer struggling to read a real production plan.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="one-environment" class="absolute -top-28"></div>
  One environment
</h2>
<p>On GitHub, a single-environment setup is a plan job and a deploy job. The plan:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">yaml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 12 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-0178041d16e852b9168ffe8cf474f007-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-0178041d16e852b9168ffe8cf474f007-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">actions/checkout@v7</span><span class="w">
</span></span></span><span class="line"><span class="cl">- <span class="nt">id</span><span class="p">:</span><span class="w"> </span><span class="l">plan</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">innofactororg/bicep-action/.github/actions/plan@v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">with</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">azure_client_id</span><span class="p">:</span><span class="w"> </span><span class="l">${{ env.azure_client_id }}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">azure_subscription_id</span><span class="p">:</span><span class="w"> </span><span class="l">${{ env.azure_subscription_id }}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">azure_tenant_id</span><span class="p">:</span><span class="w"> </span><span class="l">${{ env.azure_tenant_id }}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">deployment_mode</span><span class="p">:</span><span class="w"> </span><span class="l">stack</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">location</span><span class="p">:</span><span class="w"> </span><span class="l">westeurope</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">scope</span><span class="p">:</span><span class="w"> </span><span class="l">sub</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">template</span><span class="p">:</span><span class="w"> </span><span class="l">infra/main.bicep</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">template_parameters</span><span class="p">:</span><span class="w"> </span><span class="l">infra/main.bicepparam</span></span></span></code></pre>
  </details>
</div>
<p>The deploy job runs in a GitHub environment with required reviewers and passes the plan&rsquo;s outputs, <code>providers</code>, <code>bicep_version</code> and <code>stack_settings</code>, to the deploy action. The <code>recommended.yml</code> example in the repository is the complete version, with OpenID Connect sign-in, the concurrency lock, auto merge and the optional checks turned on.</p>
<p>On Azure DevOps, copy <code>ms.azure.deploy.yml</code> into the repository, set its variables, point an environment with an approval check at it, and add a build validation branch policy so it runs on every pull request. Every step is inline, so the single-environment pipeline needs no template repository. The pipeline downloads the scripts at the release you pin in <code>WORKFLOW_VERSION</code>.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="many-environments" class="absolute -top-28"></div>
  Many environments
</h2>
<p>Real workloads have test and production, often more, each in its own subscription. bicep-action handles that by repeating the plan-and-deploy pair per environment and chaining them.</p>
<p>On GitHub, the multi-environment example runs test first and production second, all from one pull request:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-0178041d16e852b9168ffe8cf474f007-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-0178041d16e852b9168ffe8cf474f007-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">plan_test → deploy_test (environment: test) → plan_prod → deploy_prod (environment: production)</span></span></code></pre>
  </details>
</div>
<p>Each environment has its own subscription, parameters file (<code>main.test.bicepparam</code>, <code>main.prod.bicepparam</code>), stack name, cost threshold, GitHub environment with its own reviewers and federated credential, and <code>artifact_identifier</code>, so the logs of the two runs do not collide. Production is planned only after test has deployed, so the production plan reflects a change that has already been proven once, and only the production deploy merges the pull request.</p>
<p>On Azure DevOps, the repository ships reusable <strong>stage templates</strong>, <code>plan-stage.yml</code> and <code>deploy-stage.yml</code>. A multi-environment pipeline references the bicep-action repository as a resource, pinned to a release tag, and calls the templates once per environment with that environment&rsquo;s variables:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">yaml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 33 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-0178041d16e852b9168ffe8cf474f007-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-0178041d16e852b9168ffe8cf474f007-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nt">resources</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">repositories</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">bicep_action</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">github</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">innofactororg/bicep-action</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">ref</span><span class="p">:</span><span class="w"> </span><span class="l">refs/tags/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">endpoint</span><span class="p">:</span><span class="w"> </span><span class="l">github_connection</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">stages</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="nt">template</span><span class="p">:</span><span class="w"> </span><span class="l">.azuredevops/templates/plan-stage.yml@bicep_action</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">parameters</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">stageName</span><span class="p">:</span><span class="w"> </span><span class="l">Plan_test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">serviceConnection</span><span class="p">:</span><span class="w"> </span><span class="l">test_arm_connection</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">variables</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">ARTIFACT_IDENTIFIER</span><span class="p">:</span><span class="w"> </span><span class="l">test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">SUBSCRIPTION_ID</span><span class="p">:</span><span class="w"> </span><span class="m">11111111-1111-1111-1111-111111111111</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">IN_TEMPLATE_PARAMS</span><span class="p">:</span><span class="w"> </span><span class="l">infra/main.test.bicepparam</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">STACK_NAME</span><span class="p">:</span><span class="w"> </span><span class="l">app-test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="nt">template</span><span class="p">:</span><span class="w"> </span><span class="l">.azuredevops/templates/deploy-stage.yml@bicep_action</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">parameters</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">stageName</span><span class="p">:</span><span class="w"> </span><span class="l">Deploy_test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">dependsOn</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="l">Plan_test]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">planStageName</span><span class="p">:</span><span class="w"> </span><span class="l">Plan_test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">environmentName</span><span class="p">:</span><span class="w"> </span><span class="l">test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">serviceConnection</span><span class="p">:</span><span class="w"> </span><span class="l">test_arm_connection</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">variables</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">ARTIFACT_IDENTIFIER</span><span class="p">:</span><span class="w"> </span><span class="l">test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">SUBSCRIPTION_ID</span><span class="p">:</span><span class="w"> </span><span class="m">11111111-1111-1111-1111-111111111111</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">IN_TEMPLATE_PARAMS</span><span class="p">:</span><span class="w"> </span><span class="l">infra/main.test.bicepparam</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span><span class="nt">STACK_NAME</span><span class="p">:</span><span class="w"> </span><span class="l">app-test</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="c"># ...then Plan_prod and Deploy_prod the same way, with the production values</span></span></span></code></pre>
  </details>
</div>
<p>Shared settings live in pipeline variables or a variable group, and per-environment values in each stage&rsquo;s <code>variables</code>, which take precedence. Each environment gets its own service connection and its own approval check, so production reviewers approve production and nobody else.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="getting-started" class="absolute -top-28"></div>
  Getting started
</h2>
<p>The repository has everything needed to adopt it, written to be copied rather than interpreted:</p>
<ul>
<li><strong><a href="https://github.com/innofactororg/bicep-action/blob/main/docs/how-it-works.md" target="_blank" rel="noopener noreferrer">How it works</a></strong>: the plan and deploy jobs step by step, stacks and the delete gate, the snapshot, cost, PSRule and the summary file.</li>
<li><strong><a href="https://github.com/innofactororg/bicep-action/blob/main/docs/configuration.md" target="_blank" rel="noopener noreferrer">Configuration reference</a></strong>: every GitHub input and its Azure DevOps variable side by side, with defaults and recommended settings.</li>
<li><strong>Setup guides</strong> for <a href="https://github.com/innofactororg/bicep-action/blob/main/docs/setup-github.md" target="_blank" rel="noopener noreferrer">GitHub</a> and <a href="https://github.com/innofactororg/bicep-action/blob/main/docs/setup-azure-devops.md" target="_blank" rel="noopener noreferrer">Azure DevOps</a>: environments, federated credentials, roles and branch policies.</li>
<li><strong><a href="https://github.com/innofactororg/bicep-action/tree/main/docs/examples" target="_blank" rel="noopener noreferrer">Examples</a></strong>: recommended, minimal, multi-environment and auto-approval workflows for GitHub, and multi-environment and variable-group pipelines for Azure DevOps.</li>
<li><strong><a href="https://github.com/innofactororg/bicep-action/blob/main/docs/troubleshooting.md" target="_blank" rel="noopener noreferrer">Troubleshooting</a></strong>: the messages you might see and what to do about them.</li>
</ul>
<p>Pin a release: <code>@v1</code> on GitHub and <code>WORKFLOW_VERSION: v1</code> on Azure DevOps follow the latest release, or pin a dated tag such as <code>v2026.11.13</code> if you want to choose when to move.</p>
<p>If you run Bicep in production and nobody reads what it will do before it does it, this is the cheapest fix you will find. It costs nothing, it runs in the CI you already have, and the first pull request it plans will show you something you did not know your template was about to change.</p>
<p><a href="https://damianflynn.com/posts/bicep-action-plan-review-and-deploy-bicep-from-pull-requests/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/bicep-action-plan-review-and-deploy-bicep-from-pull-requests.gif" width="1" height="1" alt="" />]]></description></item><item><title>Azure Quota Groups: Recycling Capacity You Already Own</title><link>https://damianflynn.com/posts/azure-quota-groups-recycling-capacity-you-already-own/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/azure-quota-groups-recycling-capacity-you-already-own/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/azure-quota-groups-recycling-capacity-you-already-own/hero.png" referrerpolicy="no-referrer">
            </div><p>The most expensive vCPU in Azure is the one you already had approved, gave back by accident, and now have to ask for again. That is exactly what happens every time an old subscription is cancelled. Years of quota increases, each one a support ticket, a business justification and a few days of waiting, disappear with the subscription. Meanwhile the brand-new subscription that replaces it starts life with default limits, in a region where capacity is tight, and the first deployment into it fails with a quota error the platform team then has to chase.</p>
<p>For most of Azure&rsquo;s history there was no way around this. Quota was a property of the subscription: granted to it, enforced on it, and lost with it. Azure Quota Groups change that. They lift compute quota from the subscription to a group object, so quota can be pooled across subscriptions, handed back to the pool when a workload shrinks or is retired, and handed out again to a new subscription without a ticket.</p>
<p>I spend a lot of my time on landing zones and on subscription vending, the automated process that creates a subscription, places it in the management group hierarchy, wires it to the network and hands it to a team with a working deployment pipeline. In our case that engine is called Concierge. When a reviewer asked recently whether we should be putting every new subscription into a quota group as part of vending, especially as older subscriptions are being decommissioned, it was the right question, and working through the answer properly is what this post is about.</p>
<p>Quota Groups fit the problem well. They are also more subtle than the announcement suggests, and three limits decide whether you can use them at all. They only accept Enterprise Agreement and Microsoft Customer Agreement subscriptions, which rules out anything bought through a Cloud Solution Provider. They only cover IaaS compute quota, the vCPU limits per VM family. And they do nothing for region or zone access, which is a separate gate that fails in a confusingly similar way. If you run vending through a CSP partner, the first of those ends the conversation before it starts, and you need a different design.</p>
<p>First, what quota actually is, because everything after depends on it.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="quota-capacity-and-access-are-three-different-gates" class="absolute -top-28"></div>
  Quota, capacity and access are three different gates
</h2>
<p>When a deployment fails to get compute in Azure, it is usually one of three things, and they are often confused.</p>
<p><strong>Quota</strong> is a limit Azure enforces on your subscription: how many vCPUs of a given VM family you may run in a given region, plus a total regional vCPU limit across families. It is a number on your subscription, it is checked at deployment time, and exceeding it fails the deployment with a quota error such as <code>QuotaExceeded</code> or an <code>OperationNotAllowed</code> that names the family and the limit. Quota is not capacity. A high limit does not mean the hardware is free; it means Azure has agreed you may use up to that much.</p>
<p><strong>Capacity</strong> is whether the region actually has the hardware to place your VM right now. When it does not, you get an allocation failure such as <code>AllocationFailed</code> or <code>ZonalAllocationFailed</code>, even with plenty of quota. Quota increase requests are themselves checked against capacity, which is why increases in busy regions can be rejected or take a long time.</p>
<p><strong>Access</strong> is whether your subscription may use a region, a zone or a VM size at all. Some regions are reserved and need an explicit access request. Within an open region, a specific size can be restricted for a specific subscription, which you can see in the SKU list: <code>az vm list-skus --location &lt;region&gt; --size &lt;size&gt; --all</code> returns a <code>restrictions</code> block, with a <code>type</code> of <code>Location</code> or <code>Zone</code> and a <code>reasonCode</code> of <code>NotAvailableForSubscription</code>. A deployment that hits it fails with <code>SkuNotAvailable</code>.</p>
<p>Quota Groups address the first gate only. Microsoft says so plainly in the documentation: &ldquo;Quota Groups addresses the quota management pain point, it does not address the regional and or zonal access pain point.&rdquo; Keep that sentence in mind, because it comes back when we get to automation.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="what-a-quota-group-actually-is" class="absolute -top-28"></div>
  What a quota group actually is
</h2>
<p>A quota group is an Azure Resource Manager object of type <code>Microsoft.Quota/groupQuotas</code>. It is created at a <strong>management group</strong> scope and inherits its permissions from that management group, but it is not tied to the hierarchy beneath it. Membership is explicit: you add subscriptions to it through the API, from any management group, and nothing is synchronised automatically. A subscription can belong to one quota group at a time.</p>
<p>Creating one is a single <code>PUT</code>:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">http</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 7 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="err">PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupName}?api-version=2025-03-01
</span></span></span><span class="line"><span class="cl"><span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err">{
</span></span></span><span class="line"><span class="cl"><span class="err">  &#34;properties&#34;: {
</span></span></span><span class="line"><span class="cl"><span class="err">    &#34;displayName&#34;: &#34;platform-compute-pool&#34;
</span></span></span><span class="line"><span class="cl"><span class="err">  }
</span></span></span><span class="line"><span class="cl"><span class="err">}</span></span></span></code></pre>
  </details>
</div>
<p>Adding a subscription is another <code>PUT</code>, with no body:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">http</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="err">PUT https://management.azure.com/providers/Microsoft.Management/managementGroups/{mgId}/providers/Microsoft.Quota/groupQuotas/{groupName}/subscriptions/{subscriptionId}?api-version=2025-03-01</span></span></span></code></pre>
  </details>
</div>
<p>Both return <code>provisioningState: ACCEPTED</code> and complete asynchronously, so any automation has to poll before it moves on.</p>
<p>Two prerequisites catch people out. Every member subscription needs the <code>Microsoft.Quota</code> and <code>Microsoft.Compute</code> resource providers registered before it is added. And the roles are split across two scopes: <em>GroupQuota Request Operator</em> on the management group that holds the group, to create it and manage its limit, and <em>Quota Request Operator</em> on each participating subscription, to move quota in and out of it.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="the-group-limit-starts-at-zero"><a href="#the-group-limit-starts-at-zero" class="header-mark" aria-label="Header mark for 'The group limit starts at zero'"></a>
    The group limit starts at zero
</h3>

<p>A new quota group has a limit of <strong>zero</strong>, and that surprises most people. Adding subscriptions does not change that. The documentation is explicit: &ldquo;When added to the group, subscriptions carry their existing quota and usage. The subscriptions&rsquo; quota isn&rsquo;t manipulated when added to a group. Subscription quota remains separate from the group limit.&rdquo;</p>
<p>So the group limit is its own pot, separate from the members&rsquo; limits, and you fill it in one of two ways:</p>
<ol>
<li><strong>Deallocation.</strong> You move unused quota from a member subscription into the group.</li>
<li><strong>A group limit increase.</strong> You ask Microsoft for more quota at the group level, for one region and one VM family at a time. It goes through the same capacity checks as a subscription request, and if it is rejected you fall back to a support ticket raised from the quota group blade. If it is approved, the quota is stamped on the group rather than on any one subscription.</li>
</ol>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="deployments-still-check-the-subscription"><a href="#deployments-still-check-the-subscription" class="header-mark" aria-label="Header mark for 'Deployments still check the subscription'"></a>
    Deployments still check the subscription
</h3>

<p>The other thing to internalise is where the check happens. The documentation says: &ldquo;When deploying resources the quota check at runtime is done against the subscription quota.&rdquo; The group is never consulted when you deploy. Quota in the group is inventory; it does nothing until you <strong>allocate</strong> it to a subscription.</p>
<p>That single fact shapes every automated flow. Putting a new subscription into a group gives it nothing. Somebody, or something, has to move quota from the group to the subscription before the first deployment, or that deployment fails exactly as it would have without a group.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="allocation-and-deallocation-are-absolute-not-deltas" class="absolute -top-28"></div>
  Allocation and deallocation are absolute, not deltas
</h2>
<p>Moving quota in either direction uses the same call, and the semantics are easy to get wrong. You <code>PATCH</code> the subscription&rsquo;s <strong>allocation</strong> for a region, and you set the <strong>new absolute limit</strong> you want the subscription to have, not the amount to move.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">http</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 14 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-e8d867dcb5c0ec7661b6e9082b398e76-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="err">PATCH https://management.azure.com/providers/Microsoft.Management/managementGroups/{mgId}/subscriptions/{subscriptionId}/providers/Microsoft.Quota/groupQuotas/{groupName}/resourceProviders/Microsoft.Compute/quotaAllocations/{location}?api-version=2025-03-01
</span></span></span><span class="line"><span class="cl"><span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err">{
</span></span></span><span class="line"><span class="cl"><span class="err">  &#34;properties&#34;: {
</span></span></span><span class="line"><span class="cl"><span class="err">    &#34;value&#34;: [
</span></span></span><span class="line"><span class="cl"><span class="err">      {
</span></span></span><span class="line"><span class="cl"><span class="err">        &#34;properties&#34;: {
</span></span></span><span class="line"><span class="cl"><span class="err">          &#34;resourceName&#34;: &#34;standardddv4family&#34;,
</span></span></span><span class="line"><span class="cl"><span class="err">          &#34;limit&#34;: 50
</span></span></span><span class="line"><span class="cl"><span class="err">        }
</span></span></span><span class="line"><span class="cl"><span class="err">      }
</span></span></span><span class="line"><span class="cl"><span class="err">    ]
</span></span></span><span class="line"><span class="cl"><span class="err">  }
</span></span></span><span class="line"><span class="cl"><span class="err">}</span></span></span></code></pre>
  </details>
</div>
<p>If the subscription currently has 60 vCPUs of that family, setting 50 <strong>deallocates</strong> 10 to the group. If it has 40, setting 50 <strong>allocates</strong> 10 from the group. The direction is implied by the difference between the current limit and the one you send.</p>
<p>Two constraints follow from that. You cannot deallocate below what the subscription is using, so quota is only reclaimable once the VMs consuming it are gone. And you cannot allocate more than the group has available.</p>
<p>Reading the state back is where the vocabulary matters. The allocation snapshot for a subscription returns its <code>limit</code> and a <code>shareableQuota</code>; a value of <code>-10</code> means that subscription has given 10 vCPUs to the group. The group&rsquo;s own view, from <code>groupQuotaLimits/{location}</code>, returns three numbers that are easy to conflate:</p>
<ul>
<li><code>limit</code> is what has been <strong>stamped</strong> on the group by approved increase requests.</li>
<li><code>availableLimit</code> is what the group can <strong>hand out right now</strong>, including quota deallocated from members.</li>
<li><code>allocatedToSubscriptions</code> lists each member&rsquo;s net movement, negative for subscriptions that have given quota back.</li>
</ul>
<p>In the documentation&rsquo;s own example, a group with a stamped <code>limit</code> of 40 shows an <code>availableLimit</code> of 50, because a member had already deallocated 10. If you build reporting or automation on top of this API, <code>availableLimit</code> is the number that answers &ldquo;can I allocate this?&rdquo;.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="recycling-quota-from-decommissioned-environments" class="absolute -top-28"></div>
  Recycling quota from decommissioned environments
</h2>
<p>Decommissioning is the scenario that prompted the question, and it is where Quota Groups pay for themselves. Most estates that have been in Azure for a while are carrying subscriptions that are being consolidated or retired: old per-environment subscriptions, a previous generation of landing zone, workloads moving to a new hierarchy. Each one holds quota that somebody fought for.</p>
<p>The decommissioning flow with a quota group looks like this:</p>

<figure class="mermaid-diagram my-8">
<pre class="mermaid pele" hidden>flowchart LR
    A[Old subscription&lt;br/&gt;in the group] --&gt;|1. Remove workloads| B[Usage falls]
    B --&gt;|2. PATCH allocation&lt;br/&gt;limit = usage| C[Unused quota&lt;br/&gt;moves to group]
    C --&gt;|3. DELETE membership| D[Subscription leaves group]
    D --&gt;|4. Cancel| E[Subscription gone]
    C --&gt; P[(Group pool&lt;br/&gt;availableLimit)]
    P --&gt;|5. PATCH allocation&lt;br/&gt;on new subscription| N[New subscription&lt;br/&gt;ready to deploy]</pre>
<details class="mermaid-source"><summary>Diagram source</summary><pre>flowchart LR
    A[Old subscription&lt;br/&gt;in the group] --&gt;|1. Remove workloads| B[Usage falls]
    B --&gt;|2. PATCH allocation&lt;br/&gt;limit = usage| C[Unused quota&lt;br/&gt;moves to group]
    C --&gt;|3. DELETE membership| D[Subscription leaves group]
    D --&gt;|4. Cancel| E[Subscription gone]
    C --&gt; P[(Group pool&lt;br/&gt;availableLimit)]
    P --&gt;|5. PATCH allocation&lt;br/&gt;on new subscription| N[New subscription&lt;br/&gt;ready to deploy]</pre></details>
<figcaption data-mermaid-auto-caption>Figure 7</figcaption>
</figure>
<p>The order matters, and it is the order most decommissioning runbooks get wrong if they were written before quota groups existed.</p>
<ol>
<li><strong>Join the old subscription to the group first.</strong> A subscription that is not a member cannot deallocate into it. If your retiring subscriptions predate the group, adding them is step zero.</li>
<li><strong>Remove the workloads.</strong> Deallocation cannot go below usage, so the VMs, scale sets and anything else consuming the family have to be gone first.</li>
<li><strong>Deallocate per region and per family.</strong> Set each allocation to the remaining usage, normally zero. This is one <code>PATCH</code> per region, with one entry per family in the body. Check <code>shareableQuota</code> afterwards.</li>
<li><strong>Remove the subscription from the group.</strong> On removal, &ldquo;subscriptions carry their existing quota and usage. The group limit isn&rsquo;t manipulated based on subscription removal.&rdquo; Quota already deallocated stays in the pool.</li>
<li><strong>Only then cancel the subscription.</strong> Cancel first and the quota goes with it, which is exactly what you were trying to avoid.</li>
</ol>
<p>Done in this order, a retirement programme becomes a quota source rather than a quota sink. Every subscription you close tops up the pool that the next one draws from, and the support tickets you raised years ago keep paying out.</p>
<p>One governance point is easy to miss. Deleting the management group that holds a quota group loses access to its limit, recoverable only by recreating a management group with the same ID. If you are reshaping your hierarchy at the same time as retiring subscriptions, which is common, put the quota group on a management group that is not going anywhere. A dedicated platform management group near the root is a better home than a landing-zone group that might be renamed or collapsed.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="how-it-would-fit-an-automated-vending-flow" class="absolute -top-28"></div>
  How it would fit an automated vending flow
</h2>
<p>A subscription-vending engine like Concierge runs a fixed sequence for every order: create the subscription, place it in the right management group, allocate its address space, create its repository and pipeline, give its deployment identity the access it needs, and hand over. The first deployment is the workload&rsquo;s own pipeline, running as its own identity. That is deliberate, because the first run is the proof that the pipeline works. It also means that if the subscription lacks the quota the workload needs, the order is reported as complete and then the very first thing the team does fails.</p>
<p>With a quota group available, the vending flow gains one step between placement and handover:</p>

<figure class="mermaid-diagram my-8">
<pre class="mermaid pele" hidden>sequenceDiagram
    participant O as Order
    participant V as Vending engine
    participant S as New subscription
    participant G as Quota group
    participant P as Workload pipeline
    O-&gt;&gt;V: request (architype, region, quota needs)
    V-&gt;&gt;S: create, place in management group
    V-&gt;&gt;S: register Microsoft.Quota, Microsoft.Compute
    V-&gt;&gt;G: PUT groupQuotas/{g}/subscriptions/{sub}
    V-&gt;&gt;G: GET groupQuotaLimits/{region} (availableLimit)
    alt pool has enough
        V-&gt;&gt;S: PATCH quotaAllocations/{region} (absolute limit)
        V-&gt;&gt;S: GET allocation, confirm limit
    else pool is short
        V-&gt;&gt;G: PATCH groupQuotaLimits/{region} (increase request)
        V--&gt;&gt;O: report &#34;quota pending&#34; with request ID
    end
    V-&gt;&gt;P: hand over
    P-&gt;&gt;S: first deploy</pre>
<details class="mermaid-source"><summary>Diagram source</summary><pre>sequenceDiagram
    participant O as Order
    participant V as Vending engine
    participant S as New subscription
    participant G as Quota group
    participant P as Workload pipeline
    O-&gt;&gt;V: request (architype, region, quota needs)
    V-&gt;&gt;S: create, place in management group
    V-&gt;&gt;S: register Microsoft.Quota, Microsoft.Compute
    V-&gt;&gt;G: PUT groupQuotas/{g}/subscriptions/{sub}
    V-&gt;&gt;G: GET groupQuotaLimits/{region} (availableLimit)
    alt pool has enough
        V-&gt;&gt;S: PATCH quotaAllocations/{region} (absolute limit)
        V-&gt;&gt;S: GET allocation, confirm limit
    else pool is short
        V-&gt;&gt;G: PATCH groupQuotaLimits/{region} (increase request)
        V--&gt;&gt;O: report &#34;quota pending&#34; with request ID
    end
    V-&gt;&gt;P: hand over
    P-&gt;&gt;S: first deploy</pre></details>
<figcaption data-mermaid-auto-caption>Figure 8</figcaption>
</figure>
<p>A few design decisions fall out of building this rather than drawing it.</p>
<p><strong>The order has to say what quota it needs.</strong> The engine cannot guess. The cleanest place for that is the architype, the template a workload is built from, which already knows its VM families and sizes. The order then carries region, family and vCPU count, with the architype supplying defaults.</p>
<p><strong>The engine allocates; it does not manage the pool.</strong> Allocating from the group on behalf of a new subscription is a vending concern. Raising the group limit, deciding how much headroom to hold, and deallocating from retiring subscriptions are platform-ownership concerns. Mixing them gives an automated service the power to drain a pool that other teams depend on. In our design, the engine reads <code>availableLimit</code>, allocates if it can, and otherwise reports the shortfall rather than escalating on its own.</p>
<p><strong>&ldquo;Done, quota pending&rdquo; is a real state.</strong> Increase requests are asynchronous and can be rejected. The order should be able to complete with an explicit warning and the request ID, so nobody runs the first deployment into a known shortfall and nobody believes a subscription is ready when it is not.</p>
<p><strong>The roles are a real expansion of trust.</strong> The vending identity needs <em>Quota Request Operator</em> on each subscription it creates, which is modest because it usually owns those subscriptions anyway. It also needs <em>GroupQuota Request Operator</em> on the management group that holds the group, which is a standing grant at management-group scope in the customer&rsquo;s tenant. That deserves the same scrutiny as any other privileged grant, and it is another argument for a dedicated management group.</p>
<p><strong>One group per tenant, configured per customer.</strong> The group lives under a management group in one tenant. A vending engine that serves several customers from one deployment needs the group ID as customer configuration, not as a global setting.</p>
<p>Whether you can build any of it depends on three limits.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="the-three-limits-that-decide-whether-you-can-use-it" class="absolute -top-28"></div>
  The three limits that decide whether you can use it
</h2>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="billing-no-csp"><a href="#billing-no-csp" class="header-mark" aria-label="Header mark for 'Billing: no CSP'"></a>
    Billing: no CSP
</h3>

<p>The documentation lists it as the first limitation: &ldquo;Available only for Enterprise Agreement, Microsoft Customer Agreement (MCA), and Internal subscriptions.&rdquo;</p>
<p>Subscriptions bought through a Cloud Solution Provider, the partner-led Azure Plan billed under a Microsoft Partner Agreement, are none of those. They cannot be added to a quota group. That is not a configuration gap you can engineer around; the API will not accept them.</p>
<p>This matters more than it sounds, because a large share of managed estates are CSP. A managed service provider vending subscriptions for customers through its partner tenant is creating exactly the subscriptions Quota Groups exclude. Concierge supports all three agreement types, EA, MCA and MPA, but where a customer is billed through CSP, the vending engine has nothing to join the new subscription to.</p>
<p>The useful nuance is that an estate can be mixed. If the subscriptions being retired are EA or MCA, a quota group can still pool quota <em>between them</em> while they are wound down, and allocate it to other EA or MCA subscriptions. What it cannot do is carry that quota across the billing boundary into new CSP subscriptions.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="scope-iaas-compute-only"><a href="#scope-iaas-compute-only" class="header-mark" aria-label="Header mark for 'Scope: IaaS compute only'"></a>
    Scope: IaaS compute only
</h3>

<p>The second limitation is &ldquo;Supports IaaS compute resources only.&rdquo; The group APIs live under <code>resourceProviders/Microsoft.Compute</code>, and the unit is the VM family vCPU limit. That covers virtual machines and scale sets.</p>
<p>It does not cover the quota that, in my experience, blocks new workloads most often today: Azure OpenAI tokens per minute, App Service and Functions plans, Container Apps environments, database vCores, public IP addresses. Each of those has its own quota and its own request process, usually per subscription. A platform built on PaaS and AI services can adopt quota groups and still find that most of its first-deploy failures are untouched by them.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="access-not-a-quota-problem"><a href="#access-not-a-quota-problem" class="header-mark" aria-label="Header mark for 'Access: not a quota problem'"></a>
    Access: not a quota problem
</h3>

<p>The third limitation causes the most confusion, because it fails in a way that looks like quota. Quota transfers and deployments &ldquo;will fail unless regional and or zonal access is provided on the subscription.&rdquo; A new subscription can be denied a reserved region, a zone, or a specific VM size, and no amount of quota in a group changes that. You can allocate 200 vCPUs of a family to a subscription and still have every deployment fail with <code>SkuNotAvailable</code>.</p>
<p>Access is fixed through the region access request process, which is a support request, not an API call. For reserved regions it is an &ldquo;Other Requests&rdquo; ticket listing the subscriptions, region and planned usage. An automated flow can detect the restriction up front by reading the SKU restrictions for the target region and sizes, and it should, because it is far cheaper to report &ldquo;this subscription cannot use this size here&rdquo; at vending time than to let the workload team discover it.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="what-we-do-instead-when-the-subscriptions-are-csp" class="absolute -top-28"></div>
  What we do instead when the subscriptions are CSP
</h2>
<p>Because Concierge vends CSP subscriptions for some customers, we recorded the decision in an architecture decision record rather than leaving it in a review thread. It comes down to the same three gates, handled without a pool.</p>
<p><strong>Quota is part of the order.</strong> After placement, the engine registers the providers it needs, reads current usage and limits through the <code>Microsoft.Quota</code> API at subscription scope, and raises a <strong>per-subscription</strong> increase for any shortfall, for whatever resource type the architype declares, not only compute. The quota API addresses a subscription&rsquo;s limits by scope, along the lines of <code>/subscriptions/{id}/providers/Microsoft.Compute/locations/{region}/providers/Microsoft.Quota/quotas/{family}</code>, and the same pattern covers other providers that publish their limits through it. Whether every provider accepts API increase requests on a CSP subscription, or some still need a ticket, is something we are verifying on a test subscription before we rely on it.</p>
<p><strong>Access is checked, not assumed.</strong> The engine reads SKU restrictions for the target region and sizes and reports any <code>NotAvailableForSubscription</code> before handover, with the region access request listed as an action rather than buried in a failed pipeline run.</p>
<p><strong>The outcome is recorded on the order.</strong> Granted, pending with a request ID, or rejected. The order can finish as &ldquo;done, quota pending&rdquo;, and the ticket that tracks it says so.</p>
<p><strong>Quota groups stay as an option for EA and MCA customers.</strong> Where the customer&rsquo;s configuration names a group, the engine joins the subscription and allocates compute from it instead of raising a per-subscription compute request. Everything that is not compute still goes through the per-subscription path.</p>
<p>It is less elegant than a single pool. It still turns a failed first deployment into a known state at vending time, which is the outcome that actually matters to the team receiving the subscription.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="where-this-leaves-you" class="absolute -top-28"></div>
  Where this leaves you
</h2>
<p>Quota Groups solve a real and old problem: quota you paid for in time and tickets no longer has to die with the subscription that held it. For EA and MCA estates, especially ones in the middle of consolidating or retiring subscriptions, the flow is worth building now. Join the retiring subscriptions, deallocate before you cancel, keep the group on a management group that will outlive your current hierarchy, and let vending allocate from the pool rather than raise tickets.</p>
<p>Go in with the boundaries clear, though. The group is inventory, not entitlement: the subscription is what gets checked, so allocation is a step, not a side effect. It covers VM families, not the PaaS and AI quota that increasingly gates new workloads. It does nothing for region or zone access. And if your subscriptions come through CSP, it is not available to you at all, so the design has to treat quota, capacity and access as explicit, per-subscription parts of every order.</p>
<p>That last point is the one I would carry into any vending design, pool or no pool. A subscription is not ready because it exists. It is ready when the first deployment of the workload it was built for can succeed, and quota and access are part of that definition.</p>
<p><a href="https://damianflynn.com/posts/azure-quota-groups-recycling-capacity-you-already-own/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/azure-quota-groups-recycling-capacity-you-already-own.gif" width="1" height="1" alt="" />]]></description></item><item><title>Azure DevOps Wiki to a Corporate PDF</title><link>https://damianflynn.com/posts/from-azure-devops-wiki-to-a-corporate-pdf/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 05 Oct 2026 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/from-azure-devops-wiki-to-a-corporate-pdf/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/from-azure-devops-wiki-to-a-corporate-pdf/hero.png" referrerpolicy="no-referrer">
            </div><p>The project documentation is in good shape. The team has been maintaining an Azure DevOps wiki, the architecture pages link to the detailed design, and the deployment instructions sit alongside the decisions that explain them.</p>
<p>Then comes the handover request: “Can you send us the design document as a PDF? Please use the company template.”</p>
<p>That is a reasonable request. The recipient might not have access to Azure DevOps. An architecture board may need a fixed version to review, or the customer may need to file the document in a records system. A wiki is useful for the people doing the work; a controlled document is useful for the people accepting it.</p>
<p>Copying the pages into Word gets the first document out of the door. It also creates another copy to maintain. At the next revision, someone has to work out what changed, paste it again, repair the formatting and check the page numbers.</p>
<p>I wanted to keep the Markdown as the source and make the formatted document a build output. The implementation is available in <a href="https://github.com/innofactororg/markdown2pdf" target="_blank" rel="noopener noreferrer">innofactororg/markdown2pdf</a>. It includes an Azure DevOps pipeline and a GitHub Action, both using Pandoc and a LaTeX template to produce a PDF artifact.</p>
<p>This post walks through the Azure DevOps route, explains where the corporate formatting belongs, and shows how the underlying Pandoc commands fit together.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="give-the-wiki-a-publishing-process" class="absolute -top-28"></div>
  Give the wiki a publishing process
</h2>
<p>Consider a design document spread across several wiki pages: an overview, requirements, architecture, security and an operational handover. The team wants to keep editing those pages normally. At agreed points, it needs to publish those sections as one document with a cover, version history, contents page and consistent branding.</p>
<p>There are two separate decisions here: which content belongs in the document, and how that content should look. The workflow keeps them separate:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 10 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">Markdown pages + explicit document order
</span></span><span class="line"><span class="cl">                  |
</span></span><span class="line"><span class="cl">                  v
</span></span><span class="line"><span class="cl">Merge content and resolve supported asset paths
</span></span><span class="line"><span class="cl">                  |
</span></span><span class="line"><span class="cl">                  v
</span></span><span class="line"><span class="cl">Apply document metadata, history and replacements
</span></span><span class="line"><span class="cl">                  |
</span></span><span class="line"><span class="cl">                  v
</span></span><span class="line"><span class="cl">Pandoc + corporate LaTeX template -&gt; PDF artifact</span></span></code></pre>
  </details>
</div>
<p>The order file defines the publication. The template defines its presentation. Authors can change the design without adjusting headers and footers on every page, while template changes can be reviewed independently of technical content.</p>
<p>The output is a snapshot of the source used by that build. Generating it does not approve it: the organisation&rsquo;s review, sign-off and records process still applies.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="start-with-the-git-repository-behind-the-wiki" class="absolute -top-28"></div>
  Start with the Git repository behind the wiki
</h2>
<p>An Azure DevOps wiki is backed by Git, but the type of wiki matters when arranging the build.</p>
<p>A <strong>project wiki</strong> has its own wiki repository. Use the wiki&rsquo;s <strong>Clone wiki</strong> option to obtain the repository URL, then clone it using your normal authenticated Git setup:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">git clone &lt;wiki-clone-url&gt; wiki-source</span></span></code></pre>
  </details>
</div>
<p>Replace the placeholder; don&rsquo;t put a personal access token into a command that will be saved in a script or build log.</p>
<p>A <strong>code wiki</strong> publishes Markdown from a normal repository and branch. That is a convenient arrangement when you want documentation changes reviewed through pull requests and built by a pipeline in the same repository.</p>
<p>The supplied conversion pipeline checks out <code>self</code>. It does not automatically discover or export a separate project wiki. For a project wiki, add an authenticated checkout or staging step to bring its Markdown and attachments into the build workspace, or deliberately move to a code-wiki arrangement. Keep that acquisition step explicit so that a successful build cannot quietly publish an outdated copy.</p>
<p>For the rest of this example, assume the Markdown is available in the pipeline&rsquo;s source repository under <code>docs/design</code>.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="choose-the-documents-reading-order" class="absolute -top-28"></div>
  Choose the document&rsquo;s reading order
</h2>
<p>A wiki&rsquo;s navigation tree is not necessarily a good printed document. It may include working notes, obsolete pages or several audiences&rsquo; material. Alphabetical file order is rarely what a design reviewer needs either.</p>
<p>The converter uses a <code>document.order</code> file to select the pages and their sequence:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 10 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">docs/
</span></span><span class="line"><span class="cl">  design/
</span></span><span class="line"><span class="cl">    document.order
</span></span><span class="line"><span class="cl">    Overview.md
</span></span><span class="line"><span class="cl">    Requirements.md
</span></span><span class="line"><span class="cl">    Architecture.md
</span></span><span class="line"><span class="cl">    Security.md
</span></span><span class="line"><span class="cl">    Operations.md
</span></span><span class="line"><span class="cl">    images/
</span></span><span class="line"><span class="cl">      architecture.png</span></span></code></pre>
  </details>
</div>
<p>For this document, <code>docs/design/document.order</code> contains:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 6 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"># Customer design and handover
</span></span><span class="line"><span class="cl">Overview.md
</span></span><span class="line"><span class="cl">Requirements.md
</span></span><span class="line"><span class="cl">Architecture.md
</span></span><span class="line"><span class="cl">Security.md
</span></span><span class="line"><span class="cl">Operations.md</span></span></code></pre>
  </details>
</div>
<p>Each entry names a file relative to the document folder, including its extension. Lines beginning with <code>#</code> are comments. Nested paths can be listed explicitly when the content spans subfolders.</p>
<p>Azure DevOps also uses <code>.order</code> files for wiki navigation. Those are not interchangeable with <code>document.order</code>: the converter expects an explicit list of Markdown paths, not a recursive walk of the wiki&rsquo;s navigation files.</p>
<p>My early experiments used PowerShell helpers named <code>Get-DocfxFolderItems</code>, <code>Get-DocfxItem</code> and <code>Invoke-DocfxTocProcessing</code> to inspect the wiki hierarchy and its <code>.order</code> files. That was useful for exploring the source structure. The implementation shared here uses the simpler publication manifest instead; you don&rsquo;t need those helpers or DocFX to run it.</p>
<p>This gives the author an editorial decision to review in Git. A new wiki page doesn&rsquo;t become part of the customer deliverable merely because it exists.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="add-the-azure-devops-pipeline" class="absolute -top-28"></div>
  Add the Azure DevOps pipeline
</h2>
<p>Copy the repository&rsquo;s <a href="https://github.com/innofactororg/markdown2pdf/blob/main/.azuredevops/markdown2pdf.yml" target="_blank" rel="noopener noreferrer">Azure DevOps pipeline</a> into the source repository, for example as:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">.pipelines/docs.design.yml</span></span></code></pre>
  </details>
</div>
<p>Use the full supplied pipeline, not just the variable block below. For this scenario, its variables would look like this:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">yaml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 14 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nt">variables</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">FIRST_CHANGE_DESCRIPTION</span><span class="p">:</span><span class="w"> </span><span class="l">Initial design draft</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">FOLDER</span><span class="p">:</span><span class="w"> </span><span class="l">docs/design</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">GIT_LOG_LIMIT</span><span class="p">:</span><span class="w"> </span><span class="m">15</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">HISTORY_FILE</span><span class="p">:</span><span class="w"> </span><span class="l">history.txt</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">MAIN_AUTHOR</span><span class="p">:</span><span class="w"> </span><span class="l">Architecture Team</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">ORDER_FILE</span><span class="p">:</span><span class="w"> </span><span class="l">document.order</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">OUT_FILE</span><span class="p">:</span><span class="w"> </span><span class="l">solution-design.pdf</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">PROJECT</span><span class="p">:</span><span class="w"> </span><span class="l">CUSTOMER-001</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">REPLACE_FILE</span><span class="p">:</span><span class="w"> </span><span class="l">replace.json</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">SKIP_GIT_COMMIT_HISTORY</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">SUBTITLE</span><span class="p">:</span><span class="w"> </span><span class="l">Solution Design and Operational Handover</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">TITLE</span><span class="p">:</span><span class="w"> </span><span class="l">Customer Platform</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">WORKFLOW_VERSION</span><span class="p">:</span><span class="w"> </span><span class="l">v3</span></span></span></code></pre>
  </details>
</div>
<p>The next sections define the optional <code>history.txt</code> and <code>replace.json</code> used here. Leave their variables empty if you don&rsquo;t want those features.</p>
<p><code>FOLDER</code> tells the converter where the content lives. <code>ORDER_FILE</code> selects the publication manifest. <code>TITLE</code>, <code>SUBTITLE</code> and <code>PROJECT</code> provide document metadata, while <code>OUT_FILE</code> names the PDF published as a pipeline artifact.</p>
<p><code>WORKFLOW_VERSION</code> selects the converter scripts and template assets fetched from GitHub. The repository&rsquo;s example uses <code>v3</code>. For a controlled publishing process, choose and review a specific version; use an immutable commit reference where your standards require it. A template change can alter the deliverable even when none of its Markdown changes.</p>
<p>The supplied pipeline performs these jobs:</p>
<ol>
<li>Checks out the source with <code>fetchDepth: 0</code>, making Git history available for the document history feature.</li>
<li>Caches TeX Live and installs the conversion dependencies.</li>
<li>Fetches the converter, LaTeX template and branding images from the selected implementation version.</li>
<li>Runs the conversion with the configured inputs.</li>
<li>Publishes the resulting PDF with <code>PublishPipelineArtifact@1</code>.</li>
</ol>
<p>Create a pipeline in Azure DevOps using <strong>Existing Azure Pipelines YAML file</strong>, select the copied file, and run it manually for the first test. The agent needs access both to the source content and to the external locations used to download the tools and template.</p>
<p>For Azure Repos Git, configure <strong>build validation in the branch policies</strong> if you want the PDF generated during pull-request review. Don&rsquo;t rely on the sample YAML&rsquo;s <code>pr:</code> block to configure Azure Repos PR validation; the branch policy is the relevant control there. Configure a normal CI trigger separately if you also want builds after merges.</p>
<p>The finished PDF is a downloadable artifact on the run. Publishing it to SharePoint, a customer portal or a records system is a separate delivery step, with its own access and approval requirements.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="make-the-template-match-the-document-standard" class="absolute -top-28"></div>
  Make the template match the document standard
</h2>
<p>The implementation has three main presentation assets:</p>
<ul>
<li><a href="https://github.com/innofactororg/markdown2pdf/blob/main/tools/designdoc.tex" target="_blank" rel="noopener noreferrer"><code>tools/designdoc.tex</code></a>: the LaTeX document template.</li>
<li><code>tools/designdoc-cover.png</code>: the cover image.</li>
<li><code>tools/designdoc-logo.png</code>: the page-header logo.</li>
</ul>
<p>The template provides a title page, version history, table of contents and styled content pages. Headers carry the logo and document context; footers provide page numbering. The converter supplies metadata such as title, project, authors and date.</p>
<p>That is the place to implement the approved fonts, colours, margins and page furniture. Keep those choices out of individual Markdown pages so authors aren&rsquo;t maintaining formatting instructions alongside the design.</p>
<p>The supplied assets are Innofactor-specific. To publish under another organisation&rsquo;s standard, maintain a reviewed customisation or fork, and update the pipeline&rsquo;s download locations to use it. Copying a different template into the documentation folder is not enough if the pipeline still fetches the upstream assets on every run.</p>
<p>Also inspect <code>tools/convert.sh</code>. Some presentation and policy values are supplied there rather than in the <code>.tex</code> file, including an Innofactor-specific confidentiality statement. Changing the logo alone does not make the document appropriate for another company or for public distribution.</p>
<p>A template can reproduce a corporate layout, but that does not automatically make a document compliant. If the standard requires a document identifier, classification, approver table or specific revision fields, add and review those explicitly. Check the generated PDF against an approved sample before treating the template as ready for formal use.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="decide-what-version-history-means" class="absolute -top-28"></div>
  Decide what “version history” means
</h2>
<p>The converter supports three sources for the history page, in priority order:</p>
<ol>
<li>An explicit history file, when supplied and found.</li>
<li>The fallback author and initial change description when Git history is deliberately skipped.</li>
<li>Git commit history for the documentation folder, falling back to the initial entry when no history is available.</li>
</ol>
<p>Git history is useful during drafting, but commit messages are not always suitable for a customer-facing revision table. “Fix typo” and “move diagram again” record the work without describing a formal issue of the document.</p>
<p>For a controlled deliverable, I would use <code>docs/design/history.txt</code>:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">1.0|Oct 26, 2023|Architecture Team|Initial design issued for review
</span></span><span class="line"><span class="cl">1.1|Oct 28, 2023|Architecture Team|Updated network design following review</span></span></code></pre>
  </details>
</div>
<p>The format is <code>Version|Date|Author|Description</code>, one entry per line, without a header row. These are illustrative entries, not dates generated by the pipeline.</p>
<p>Set <code>HISTORY_FILE: history.txt</code> to use it. If you prefer Git-derived history during development, leave that setting empty, keep <code>SKIP_GIT_COMMIT_HISTORY: false</code>, and use <code>GIT_LOG_LIMIT</code> to bound the number of entries.</p>
<p>Neither option proves that a revision was approved. Record approval through the process your organisation actually uses, and retain the issued PDF with its source revision and build reference.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="reuse-content-without-maintaining-customer-specific-copies" class="absolute -top-28"></div>
  Reuse content without maintaining customer-specific copies
</h2>
<p>A common documentation problem is a largely reusable design with a few customer-specific names. The converter&rsquo;s replacement file lets the publishing step substitute those values.</p>
<p>For example, a Markdown paragraph might contain:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">markdown</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">The primary services for {organization name} run in {data center name}.</span></span></code></pre>
  </details>
</div>
<p>With <code>docs/design/replace.json</code>:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">json</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 4 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-8" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-8"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;{organization name}&#34;</span><span class="p">:</span> <span class="s2">&#34;Contoso&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;{data center name}&#34;</span><span class="p">:</span> <span class="s2">&#34;WE1&#34;</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre>
  </details>
</div>
<p>Set <code>REPLACE_FILE: replace.json</code> to apply the replacements to the merged content before conversion. Keep that configuration with the publication so reviewers can see which values were used.</p>
<p>This is simple text substitution, not a full document templating language. The implementation uses shell and <code>sed</code> processing, so test values containing slashes, ampersands or other special characters before relying on them. Don&rsquo;t use the file as a secret store; the substituted text is going into a distributed document.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="write-markdown-that-survives-the-move-to-paper" class="absolute -top-28"></div>
  Write Markdown that survives the move to paper
</h2>
<p>A browser can scroll horizontally. A portrait A4 page cannot. A few authoring habits make the generated PDF much more useful.</p>
<p>Keep tables narrow, give diagrams readable labels, and split large comparison matrices into smaller sections. Use proper Markdown headings rather than formatting ordinary paragraphs to resemble headings. Let the generated contents page describe the document instead of carrying a wiki-specific contents widget into print.</p>
<p>Use explicit relative image paths where possible:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">markdown</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-9" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-9"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">![<span class="nt">Platform architecture</span>](<span class="na">./images/architecture.png</span>)</span></span></code></pre>
  </details>
</div>
<p>The converter rewrites supported relative paths as it merges pages, and the repository specifically recommends paths starting with <code>./</code>. It is not a complete Azure DevOps wiki-rendering engine. Check attachments, page links, anchors and any wiki-specific syntax against the output. Turning a path into an absolute build-agent path does not make it a useful link for the recipient of a PDF.</p>
<p>The implementation also supports fenced admonitions through its Pandoc filter:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">markdown</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 3 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-10" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-10"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">::: warning
</span></span><span class="line"><span class="cl">Confirm the recovery procedure before scheduling the production cutover.
</span></span><span class="line"><span class="cl">:::</span></span></code></pre>
  </details>
</div>
<p>The supported classes are <code>warning</code>, <code>important</code>, <code>note</code>, <code>caution</code> and <code>tip</code>. Check how these appear in both your wiki and PDF; support in the converter does not guarantee identical rendering in every Markdown viewer.</p>
<p>The supplied template is designed for portrait A4 and does not offer a per-page landscape switch. Wide tables and diagrams need an editorial decision, not just a smaller font. Section numbering is not enabled automatically by the supplied conversion command either; agree a consistent approach before numbering headings manually.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="where-the-original-pandoc-commands-fit" class="absolute -top-28"></div>
  Where the original Pandoc commands fit
</h2>
<p>The pipeline wraps tools that can also be used directly. These commands are useful for understanding the conversion or testing a formatting change without first wiring up a complete publishing process.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="combine-pages-in-an-explicit-order"><a href="#combine-pages-in-an-explicit-order" class="header-mark" aria-label="Header mark for 'Combine pages in an explicit order'"></a>
    Combine pages in an explicit order
</h3>

<p>Pandoc can read an ordered list of inputs from a defaults file. For example, save this as <code>defaults.yaml</code>:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">yaml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 5 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-11" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-11"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nt">input-files</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="l">Overview.md</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="l">Requirements.md</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span>- <span class="l">Architecture.md</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">verbosity</span><span class="p">:</span><span class="w"> </span><span class="l">INFO</span></span></span></code></pre>
  </details>
</div>
<p>Then run Pandoc from the folder containing those files:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-12" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-12"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --defaults defaults.yaml -o output.docx</span></span></code></pre>
  </details>
</div>
<p>This illustrates the same principle as <code>document.order</code>, but the formats are different. <code>defaults.yaml</code> is Pandoc configuration; <code>document.order</code> is input to the repository&rsquo;s merge script. They are not two files you must maintain for the supplied pipeline.</p>
<p>Defaults files can also hold resource paths and other conversion settings. Pandoc supports <code>${.}</code> in path-valued fields to refer to the defaults file&rsquo;s directory, which helps when keeping configuration and supporting assets together. See the <a href="https://pandoc.org/MANUAL.html#defaults-files" target="_blank" rel="noopener noreferrer">Pandoc defaults documentation</a> for the available fields.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="use-a-word-reference-document-when-word-is-the-deliverable"><a href="#use-a-word-reference-document-when-word-is-the-deliverable" class="header-mark" aria-label="Header mark for 'Use a Word reference document when Word is the deliverable'"></a>
    Use a Word reference document when Word is the deliverable
</h3>

<p>Sometimes the official handover format is DOCX, or the recipient needs to make tracked edits. Pandoc&rsquo;s Word route uses a reference document:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-13" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-13"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --defaults defaults.yaml --reference-doc<span class="o">=</span>reference.docx -o output.docx</span></span></code></pre>
  </details>
</div>
<p>Save the approved template as a <code>.docx</code>, rather than passing a <code>.dotx</code> directly. Put <code>reference.docx</code> in the working folder or pass its explicit path.</p>
<p>Pandoc uses the reference document&rsquo;s styles and document properties; it does not fill an arbitrary existing Word document as though it were a mail-merge template. Check the result against the corporate standard, especially when it contains custom cover content or mandatory tables.</p>
<p>This is a separate output route. The <code>markdown2pdf</code> implementation described above renders through LaTeX and XeLaTeX; it does not take a corporate Word template and automatically turn that into its PDF layout.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="apply-latex-settings-to-the-pdf-route"><a href="#apply-latex-settings-to-the-pdf-route" class="header-mark" aria-label="Header mark for 'Apply LaTeX settings to the PDF route'"></a>
    Apply LaTeX settings to the PDF route
</h3>

<p>For local PDF experiments, a header include such as <code>head.tex</code> can hold page and link settings:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">tex</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 9 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-14" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-14"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="k">\usepackage</span><span class="nb">{</span>fancyvrb,newverbs<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\usepackage</span><span class="na">[top=2cm, bottom=1.5cm, left=2cm, right=2cm]</span><span class="nb">{</span>geometry<span class="nb">}</span>
</span></span><span class="line"><span class="cl"><span class="k">\hypersetup</span><span class="nb">{</span>
</span></span><span class="line"><span class="cl">    bookmarksopen=true,
</span></span><span class="line"><span class="cl">    colorlinks=true,
</span></span><span class="line"><span class="cl">    linkcolor=blue,
</span></span><span class="line"><span class="cl">    filecolor=magenta,
</span></span><span class="line"><span class="cl">    urlcolor=blue
</span></span><span class="line"><span class="cl"><span class="nb">}</span></span></span></code></pre>
  </details>
</div>
<p>Apply it when generating a PDF:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-15" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-15"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --defaults defaults.yaml --pdf-engine<span class="o">=</span>xelatex -H head.tex -o output.pdf</span></span></code></pre>
  </details>
</div>
<p>This requires Pandoc and a suitable TeX installation. A LaTeX header does not style DOCX output; use the reference document for that. In the automated implementation, make the equivalent changes in the reviewed template and metadata rather than maintaining a competing set of local overrides.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="inspect-code-highlighting-and-link-colours"><a href="#inspect-code-highlighting-and-link-colours" class="header-mark" aria-label="Header mark for 'Inspect code highlighting and link colours'"></a>
    Inspect code highlighting and link colours
</h3>

<p>Pandoc can list its syntax-highlighting styles and recognised languages:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-16" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-16"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --list-highlight-styles
</span></span><span class="line"><span class="cl">pandoc --list-highlight-languages</span></span></code></pre>
  </details>
</div>
<p>For a standalone experiment using its built-in highlighting:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-17" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-17"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --pdf-engine<span class="o">=</span>xelatex --highlight-style zenburn test.md -o test.pdf</span></span></code></pre>
  </details>
</div>
<p>Or combine the defaults file with numbered sections and a different highlight style:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-18" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-18"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --defaults defaults.yaml --pdf-engine<span class="o">=</span>xelatex -H head.tex <span class="se">\
</span></span></span><span class="line"><span class="cl">  -N --highlight-style<span class="o">=</span>espresso -V colorlinks -o output.pdf</span></span></code></pre>
  </details>
</div>
<p>Language labels on fenced code blocks help Pandoc choose the right syntax rules. The shared converter uses <code>--listings</code>, so its code presentation is controlled through the LaTeX listings configuration; changing a <code>--highlight-style</code> example is not the same as changing that pipeline&rsquo;s code styling.</p>
<p>Link colours can be tested independently too:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-19" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-717c585a47ff2f24462733aa7fc0ae01-19"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">pandoc --pdf-engine<span class="o">=</span>xelatex -V colorlinks -V <span class="nv">urlcolor</span><span class="o">=</span>blue <span class="se">\
</span></span></span><span class="line"><span class="cl">  -V <span class="nv">toccolor</span><span class="o">=</span>red test.md -o test.pdf</span></span></code></pre>
  </details>
</div>
<p>The text must be recognised as a link. Use Markdown links or an explicit autolink such as <code>&lt;https://example.com&gt;</code> rather than assuming that every URL-looking string will become one.</p>
<p>These commands explain the building blocks. For repeated delivery, the versioned pipeline should remain the publishing route, so the document doesn&rsquo;t depend on whichever combination of flags someone last used locally.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="review-the-artifact-before-issuing-it" class="absolute -top-28"></div>
  Review the artifact before issuing it
</h2>
<p>For the first run, choose a small but representative document: several pages, an image, a table and a code block. Inspect the PDF rather than treating a green pipeline result as evidence of document quality.</p>
<p>Check that the pages appear in the intended order, images resolve, table columns fit and code is legible. Confirm that the cover, history, confidentiality text and branding are appropriate for the recipient. Test links from the downloaded PDF, outside the build agent and ideally without access to the source wiki.</p>
<p>After that first review, the publishing loop becomes manageable: edit the Markdown, review the change, build the PDF and retain the version that was actually issued. If you want artifacts on every relevant change, include order files, history files, replacement files and pipeline configuration in your trigger or branch-policy path filters, not just <code>.md</code> files.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="use-the-implementation" class="absolute -top-28"></div>
  Use the implementation
</h2>
<p>The complete project is available at <a href="https://github.com/innofactororg/markdown2pdf" target="_blank" rel="noopener noreferrer">innofactororg/markdown2pdf</a>, with <a href="https://github.com/innofactororg/markdown2pdf/tree/main/.azuredevops" target="_blank" rel="noopener noreferrer">Azure DevOps setup instructions</a> and a <a href="https://github.com/innofactororg/markdown2pdf#usage" target="_blank" rel="noopener noreferrer">GitHub Action example</a> for documentation hosted on GitHub. The code and documentation are released under the BSD 3-Clause License; retain the relevant notices when adapting them.</p>
<p>The useful starting point is one document, one explicit order file and one reviewed template. Keep the wiki as the place the team works, and publish a PDF from the reviewed source when someone needs a formal copy. The next revision can then follow the same process without rebuilding the document by hand in Word.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="references"><a href="#references" class="header-mark" aria-label="Header mark for 'References'"></a>
    References
</h3>

<ul>
<li><a href="https://github.com/innofactororg/markdown2pdf" target="_blank" rel="noopener noreferrer">markdown2pdf source and usage</a></li>
<li><a href="https://github.com/innofactororg/markdown2pdf/blob/main/.azuredevops/markdown2pdf.yml" target="_blank" rel="noopener noreferrer">Azure DevOps pipeline implementation</a></li>
<li><a href="https://github.com/innofactororg/markdown2pdf/blob/main/tools/convert.sh" target="_blank" rel="noopener noreferrer">Conversion script</a></li>
<li><a href="https://pandoc.org/MANUAL.html" target="_blank" rel="noopener noreferrer">Pandoc user guide</a></li>
<li><a href="https://jdhao.github.io/2019/05/30/markdown2pdf_pandoc/" target="_blank" rel="noopener noreferrer">Converting Markdown to Beautiful PDF with Pandoc — jdhao</a></li>
</ul>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/from-azure-devops-wiki-to-a-corporate-pdf/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/from-azure-devops-wiki-to-a-corporate-pdf.gif" width="1" height="1" alt="" />]]></description></item><item><title>Running Tailscale on a Ubiquiti EdgeRouter X</title><link>https://damianflynn.com/posts/running-tailscale-on-a-ubiquiti-edgerouter/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Sat, 14 Dec 2024 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/running-tailscale-on-a-ubiquiti-edgerouter/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/running-tailscale-on-a-ubiquiti-edgerouter/hero.png" referrerpolicy="no-referrer">
            </div>
<p>Having grown up in the world of &lsquo;on premise&rsquo; computing, I have always prioritized data privacy in my home network.</p>
<p>Though there may not be much of interest to hackers, there is still personal data and services that I want to keep secure. I have spent years working with OpenVPN and IPSec, building and supporting a Dynamic Multi-site VPN Mesh with Cisco DMVPN, and I know first hand the challenges of connecting clients to a private network and managing keys.</p>
<p>When WireGuard emerged a few years ago, I quickly switched to an Edge Router X to make it my default VPN technology. Though WireGuard had some scaling challenges to manage, it was still significantly easier to use than what I was used to.</p>
<p>Then Tailscale came along, which made WireGuard even more user-friendly with additional security features like key rotation and single sign-on. While I’ve been using Tailscale on all of my systems, including Linux, macOS, and iOS, I recently decided to shift the endpoint to the edge of my network to make connectivity even easier.</p>
<blockquote class="blockquote">
    <p>My EdgeRouter passed away, it served me well, and has been replaced by a UniFi Cloud Gateway Max, And is quite happy to assume the <code>tailscale</code> responsibility</p>
</blockquote><blockquote class="blockquote">
    <p>Latest builds now support the <code>tailscale update</code> command, which makes the maintenance trivial.
Removed defunct configuration details from the post</p>
</blockquote><blockquote class="blockquote">
    <p>Updating notes to reflect switch from Unstable which I have been using since verision 1.7, to the current stable branch running 1.38.</p>
</blockquote><blockquote class="blockquote">
    <p>Updating notes to reflect switch from stable 1.40 to 1.50.</p>
</blockquote><h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="ubuquiti-edge-router-x" class="absolute -top-28"></div>
  Ubuquiti Edge Router X
</h2>
<p>The router at the edge of my home network is currently a Ubiquiti EdgeRouter X, which boasts a power-efficient MIPSLE CPU and runs on a Linux-based operating system that was derived from VyattaOS.</p>
<p>The device offers a wide range of settings that can be adjusted via SSH that are not available through the web UI. With Tailscale, which provides MIPS binaries in addition to ARM, I can now connect the router to Tailscale and treat it like any other Linux system.</p>
<p>In this post, we&rsquo;ll explore how to configure the EdgeRouter to function as a gateway, allowing external systems to access internal networks.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="installation-and-upgrade" class="absolute -top-28"></div>
  Installation and Upgrade
</h2>
<p>The Tailscale client comes in two branches, Tailscale Unstable and Tailscale Stable. While Unstable was necessary for me a few years ago, I now prefer using Stable. To download the latest version for the MIPS platform, visit the <a href="https://pkgs.tailscale.com/stable/?ref=www.damianflynn.com#static" target="_blank" rel="noopener noreferrer">Tailscale Stable</a> page and scroll down to find the current build, such as <em>tailscale_1.54.0_mips.tgz</em>.</p>
<p>To install and set up Tailscale, follow these steps:</p>
<ol>
<li>Navigate to your home folder and download the current build. Then, extract it and delete the download file:</li>
</ol>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 4 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-b9be15095b778101c832e6477aa5dd6a-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-b9be15095b778101c832e6477aa5dd6a-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">cd</span> ~
</span></span><span class="line"><span class="cl">curl https://pkgs.tailscale.com/stable/tailscale_1.54.0_mipsle.tgz -o tailscale.tgz  
</span></span><span class="line"><span class="cl">tar xzvf tailscale.tgz  
</span></span><span class="line"><span class="cl">rm tailscale.tgz</span></span></code></pre>
  </details>
</div>
<ol start="2">
<li>Move the extracted files to their proper locations on the router and create the necessary directories for log data and runtime socket file:</li>
</ol>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 18 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-b9be15095b778101c832e6477aa5dd6a-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-b9be15095b778101c832e6477aa5dd6a-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="c1"># Change into a real shell and switch to root user </span>
</span></span><span class="line"><span class="cl">sudo bash 
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl"><span class="c1"># Navigate to the extracted download </span>
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> tailscale_1.50.0_mipsle 
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl"><span class="c1"># Move the application to the right location </span>
</span></span><span class="line"><span class="cl">mv tailscale* /usr/sbin 
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl"><span class="c1"># Place systemd and defaults into etc </span>
</span></span><span class="line"><span class="cl">mv systemd/tailscaled.service /etc/systemd/system 
</span></span><span class="line"><span class="cl">mv systemd/tailscaled.defaults /etc/default/tailscaled 
</span></span><span class="line"><span class="cl">    
</span></span><span class="line"><span class="cl"><span class="c1"># Create the state storage folders </span>
</span></span><span class="line"><span class="cl">mkdir /var/lib/tailscale /run/tailscale
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Create a symbolic link from /usr/bin which is in the path</span>
</span></span><span class="line"><span class="cl">sudo ln -s /usr/sbin/tailscale /usr/bin/tailscale</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="initial-confuration"><a href="#initial-confuration" class="header-mark" aria-label="Header mark for 'Initial Confuration'"></a>
    Initial Confuration
</h3>

<p>The following steps are not typically required if you are upgrading between versions; however if this is a fresh installation you will need to start the service, and authenticate your node with the tailnet.</p>
<ol>
<li>Start it up! If you have any issues, they should appear here as the service gets started. Check the logs by tailing the output from Tailscale using  <code>tail -f /var/log/messages</code>.</li>
</ol>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-b9be15095b778101c832e6477aa5dd6a-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-b9be15095b778101c832e6477aa5dd6a-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">systemctl <span class="nb">enable</span> --now tailscaled</span></span></code></pre>
  </details>
</div>
<ol start="2">
<li>Authenticate your device to Tailscale by starting it up and following the instructions. You can also use some options, such as:
<ul>
<li><code>--advertise-routes</code>: a comma-separated list of subnets that other clients can reach via this router</li>
<li><code>--advertise-exit-node</code>: allows any Tailscale instance to act as an exit node, sending your otherwise-public traffic to a specific node that will NAT your traffic out to the internet. This option is useful when you&rsquo;re on an untrusted network or if you want to source your traffic from a different network.</li>
</ul>
</li>
</ol>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-b9be15095b778101c832e6477aa5dd6a-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-b9be15095b778101c832e6477aa5dd6a-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">tailscale up --advertise-routes<span class="o">=</span>172.16.1.0/24 --advertise-exit-node --accept-routes</span></span></code></pre>
  </details>
</div>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 24 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-b9be15095b778101c832e6477aa5dd6a-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-b9be15095b778101c832e6477aa5dd6a-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">When you start Tailscale, it will present you with a URL to visit that allows you to authenticate the device to your Tailscale account. 
</span></span><span class="line"><span class="cl">- ![](./sw.tailscale.configuration.authenticate.png)
</span></span><span class="line"><span class="cl">- Once you do this, your router will show up under the “Machines” list in the admin UI
</span></span><span class="line"><span class="cl">- ![](./sw.tailscale.configuration.tailscale-settings.png)
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">&gt; [!Warning] Disconnect
</span></span><span class="line"><span class="cl">&gt; At this point all traffic on the router will appear to black hole for both ingress and egress. 
</span></span><span class="line"><span class="cl">&gt; To restore service, we must acknowledge the settings in the Tailscale portal; this may required that you use an alternate device that is not on this network to reach the port. Once in the portal we should validate and enable both settings we applied in the `tailscale up` command, which will then unblock the device
</span></span><span class="line"><span class="cl">&gt; ![](./sw.tailscale.configuration.device-configuration.png)
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">## Final Testing
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">If you’ve made it this far, you should be able to ping other Tailscale nodes bidirectionally.
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">If you’d like hosts behind the EdgeRouter to communicate to other Tailscale clients outside the local network, you’ll want to add a NAT so that traffic knows where to go (without one, you’ll only have inbound access to devices on the network). To do this, you can add it via CLI:
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">```shell
</span></span><span class="line"><span class="cl">router$ configure
</span></span><span class="line"><span class="cl">router# set service nat rule 5012 description Tailscale
</span></span><span class="line"><span class="cl">router# set service nat rule 5012 outbound-interface tailscale0
</span></span><span class="line"><span class="cl">router# set service nat rule 5012 protocol all
</span></span><span class="line"><span class="cl">router# set service nat rule 5012 type masquerade</span></span></code></pre>
  </details>
</div>
<p>…or find it in the Ubiquiti web UI under “Firewall/NAT” and click a few options. The <code>tailscale0</code> interface will not show up in the dropdown list, so you must choose “Other” and type in <code>tailscale0</code>.</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/running-tailscale-on-a-ubiquiti-edgerouter/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/running-tailscale-on-a-ubiquiti-edgerouter.gif" width="1" height="1" alt="" />]]></description></item><item><title>Terraform or Bicep for Azure: Strengths Compared</title><link>https://damianflynn.com/posts/considering-terraform-and-bicep/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Wed, 15 Feb 2023 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/considering-terraform-and-bicep/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/considering-terraform-and-bicep/hero.png" referrerpolicy="no-referrer">
            </div>
<p>As more organizations adopt cloud infrastructure, the demand for infrastructure as code (IAC) solutions has grown. Infrastructure as code allows developers to manage and automate infrastructure deployments using code, making it easier to track changes and maintain consistency.</p>
<p>Terraform and Bicep are two popular IAC solutions that enable developers to manage and automate infrastructure deployments using code.</p>
<p>While both tools share some similarities, Terraform is more widely adopted solution with many benefits,  In this post, we will highligh some of the benfits each expose, so you can start to figure out where you next learning should be focused</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="bicep-and-arm" class="absolute -top-28"></div>
  Bicep and ARM
</h2>
<p>Azure Resource Manager (ARM) templates are a popular way to define and deploy infrastructure as code in Azure. However, writing ARM templates can be challenging, particularly for beginners. Bicep is a new language developed by Microsoft that makes writing Azure infrastructure code easier and more streamlined. In this blog post, we will explore the benefits of using Bicep over ARM.</p>
<ol>
<li>
<p><strong>Simpler Syntax</strong>: Bicep&rsquo;s syntax is simpler and easier to read and write than ARM&rsquo;s. The code is written in JSON-like format and requires less boilerplate code. Additionally, Bicep has a smaller learning curve than ARM, making it easier for beginners to get started.</p>
</li>
<li>
<p><strong>Better Modularity</strong>: Bicep&rsquo;s modular design allows developers to define reusable components and deploy them across multiple environments. This can help reduce code duplication and improve code maintainability. The modules in Bicep are simpler to define and use than the modules in ARM, which can make code reuse more accessible.</p>
</li>
<li>
<p><strong>Improved Type Safety</strong>: Bicep provides type safety to help developers catch errors before deployment. The language&rsquo;s strong typing system ensures that variables are defined correctly and that the correct data types are used. This can help prevent errors in deployments and improve the overall quality of the code.</p>
</li>
<li>
<p><strong>Better Tooling</strong>: Bicep has better tooling support than ARM. It is integrated with Visual Studio Code, which provides auto-completion and syntax highlighting for the language. Additionally, Bicep is integrated with Azure CLI, which makes it easier to manage and automate infrastructure deployments.</p>
</li>
<li>
<p><strong>Easier to Read and Maintain</strong>: Bicep&rsquo;s simpler syntax and modular design make it easier to read and maintain compared to ARM. The code is less verbose and easier to understand, which can help reduce errors and improve code quality.</p>
</li>
<li>
<p><strong>Greater Consistency</strong>: Bicep promotes consistency in infrastructure deployments. Developers can use templates across different environments, which can ensure that infrastructure is deployed consistently across all environments. This can help reduce errors and improve the overall quality of the infrastructure.</p>
</li>
</ol>
<p>Of course, we can also ask the question, of what are the Benfits of ARM over Bicep. Azure Resource Manager (ARM) templates have been around for a while and are a widely adopted way to define and deploy infrastructure as code in Azure. While Bicep has many benefits, there are still some advantages to using ARM templates.</p>
<ol>
<li>
<p><strong>Widely Adopted</strong>: ARM templates have been around for a while and are a widely adopted way to deploy infrastructure in Azure. Many organizations have already invested time and resources in building ARM templates, and they may find it easier to continue using them rather than switching to a new language.</p>
</li>
<li>
<p><strong>Better Compatibility</strong>: ARM templates are compatible with more Azure services than Bicep. While Bicep is designed to work with Azure, ARM templates can be used with many other services and platforms, for example Azure Policy still requires ARM syntax.</p>
</li>
<li>
<p><strong>Easier to Write for Experienced Developers</strong>: Experienced developers <em>may</em> find it easier to write ARM templates than Bicep code. While Bicep is simpler and easier to learn for beginners, experienced developers may prefer the greater flexibility and complexity offered by ARM template</p>
</li>
</ol>
<p>In conclusion, Bicep offers several benefits over ARM. Its simpler syntax, better modularity, improved type safety, better tooling, and easier-to-read code make it an attractive option for developers who are focused on Azure infrastructure. Additionally, its focus on consistency can help improve the overall quality of infrastructure deployments. While ARM templates remain a popular way to deploy Azure infrastructure, Bicep provides a more accessible and streamlined approach that can make infrastructure as code more accessible to developers of all skill levels.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="considerating-terraform" class="absolute -top-28"></div>
  Considerating Terraform
</h2>
<p>Both Terraform  and bicep use a declarative language, which means that it focuses on the desired end-state rather than the specific steps needed to achieve it. This makes it easier to manage and automate infrastructure changes.</p>
<p>Both options are very popular, and very powerful. At one point in time, Terraform was a poor option for working with Azure, and Bicep did not even exist (its just 2 years young).</p>
<p>Selecting the Declarative Language and tooling is not black and white; so consider your requirements, and lets take a little time to conside their respective strengths.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="bicep-strengths"><a href="#bicep-strengths" class="header-mark" aria-label="Header mark for 'Bicep Strengths'"></a>
    Bicep Strengths
</h3>

<ol>
<li>
<p>Simpler Syntax: Bicep has a simpler syntax than Terraform, making it easier for beginners to get started. The syntax is also more concise and readable, which can make code maintenance easier. The code is written in JSON-like format and requires less boilerplate code compared to Terraform&rsquo;s HashiCorp Configuration Language (HCL).</p>
</li>
<li>
<p>Integrated Language: Bicep is built on top of the Azure Resource Manager (ARM) language and is fully integrated with Azure. This means that developers can use Bicep to write ARM templates that can be used with any Azure resource type. Additionally, Bicep has direct access to all Azure resources, including new features and services.</p>
</li>
<li>
<p>Type Safety: Bicep provides type safety to help developers catch errors before deployment. The language&rsquo;s strong typing system ensures that variables are defined correctly and that the correct data types are used. This can help prevent errors in deployments and improve the overall quality of the code.</p>
</li>
<li>
<p>Improved Modularity: Bicep&rsquo;s modular design allows developers to define reusable components and deploy them across multiple environments. This can help reduce code duplication and improve code maintainability. The modules in Bicep are simpler to define and use than the modules in Terraform, which can make code reuse more accessible.</p>
</li>
<li>
<p>Accessability: Bicep is included in the Azure Quickstart templates, which can make it easier to deploy infrastructure with a single click.</p>
</li>
</ol>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="terraform-strengths"><a href="#terraform-strengths" class="header-mark" aria-label="Header mark for 'Terraform Strengths'"></a>
    Terraform Strengths
</h3>

<ol>
<li>
<p>Multi-cloud support: Terraform supports more cloud providers compared to Bicep. Terraform can be used to manage infrastructure across multiple cloud providers, including AWS, Azure, Google Cloud, and many others, while Bicep is currently only available for Azure.</p>
</li>
<li>
<p>Greater ecosystem and community: Terraform has a larger and more active community compared to Bicep, making it easier to find resources, get help, and share knowledge.</p>
</li>
<li>
<p>Modular design: Terraform&rsquo;s modular design allows for code reusability and easier management of large infrastructure deployments, while Bicep&rsquo;s module system is less robust and can be more challenging to maintain.</p>
</li>
<li>
<p>Built-in state management: Terraform has built-in state management, which allows it to keep track of the current state of the infrastructure and make changes accordingly. Bicep relies on external state management - essentially the Azure Resource Manager.</p>
</li>
<li>
<p>Richer documentation: Terraform has extensive documentation that covers every aspect of the tool, including configuration options, provider support, and best practices. Bicep&rsquo;s documentation is still developing and can be less comprehensive.</p>
</li>
<li>
<p>More provider support: Terraform has a broader range of provider support compared to Bicep. This means that it can integrate with more services and resources from various cloud providers.</p>
</li>
<li>
<p>Wider range of configuration options: Terraform provides more configuration options for its users, including custom providers, modules, and backend configurations, while Bicep&rsquo;s configuration options are more limited.</p>
</li>
<li>
<p>More testing options: Terraform has more testing options compared to Bicep, such as testing infrastructure deployments with Terraform&rsquo;s built-in testing framework, Terratest.</p>
</li>
<li>
<p>Greater maturity: Terraform has been around longer and has a more mature feature set, while Bicep is a relatively new tool and still in active development. Terraform has been battle-tested over the years and has a robust set of features.</p>
</li>
</ol>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="summary" class="absolute -top-28"></div>
  Summary
</h2>
<p>While Terraform is a popular IAC solution with many benefits, Bicep has some unique advantages that can make it the right choice for certain projects. Its simpler syntax, integrated language, type safety, improved modularity, and integration with other Azure tools make it an attractive option for developers who are focused on Azure-specific infrastructure.</p>
<p>Terraform has several advantages over Bicep in terms of multi-cloud support, community, modular design, declarative language, state management, documentation, provider support, configuration options, testing options, and maturity.</p>
<p>Choosing the right IAC tool for your organization is critical, and evaluating the features of each tool can help you make an informed decision. Ultimately, the choice between Terraform and Bicep will depend on the specific needs of your organization and the nature of your projects.</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/considering-terraform-and-bicep/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/considering-terraform-and-bicep.gif" width="1" height="1" alt="" />]]></description></item><item><title>Theming Hugo with a Hugo Module</title><link>https://damianflynn.com/posts/theming-hugo-with-module/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 21 Nov 2022 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/theming-hugo-with-module/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/theming-hugo-with-module/hero.png" referrerpolicy="no-referrer">
            </div>
<p>To utilize modules in Hugo for our theme, we first must ensure that our site supports Hugo Modules.</p>
<blockquote class="blockquote">
    <p>You can quickly verify that you site is configured for Hugo Modules, as it should contain a  <code>go.mod</code> file in the repository root.</p>

</blockquote><h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="import-the-theme-module" class="absolute -top-28"></div>
  Import the <code>theme</code> module
</h2>
<p>The concept of a Hugo <em>theme</em> has been superseded with the concept of <em>modules</em>, with the main difference that the former will allow you to build your site entirely, while the latter might implement only some modular features like enabling the ATOM feed, or adding a search to your website.</p>
<p>Importing a module as a theme will typically follow the convention:</p>
<p>Update the sites <code>config.toml</code> file with the below content, so that it imports the <a href="https://github.com/DamianFlynn/hugo-bilberry-theme" target="_blank" rel="noopener noreferrer"><code>hugo-bilberry-theme</code></a> </p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">toml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 3 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">module</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">	<span class="nx">module</span><span class="p">.</span><span class="nx">imports</span>
</span></span><span class="line"><span class="cl">		<span class="nx">path</span> <span class="p">=</span> <span class="s2">&#34;github.com/Lednerb/bilberry-hugo-theme/v3&#34;</span></span></span></code></pre>
  </details>
</div>
<p>In this case, the path <code>github.com/Lednerb/bilberry-hugo-theme/v3</code> references the Github repo hosting the theme to be used.</p>
<blockquote class="blockquote">
    <p>It’s possible to take any Hugo theme git repo and import that as a Hugo Module even if that repo isn’t actually one i.e. doesn’t have a <code>go.mod</code>. But it’s recommended that the theme be a proper Hugo Module so that you have better dependency tracking between your site and the theme.</p>
</blockquote><h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="testing"><a href="#testing" class="header-mark" aria-label="Header mark for 'Testing'"></a>
    Testing
</h3>

<p>Create <code>content/testing.md</code>. This step is optional and is only so that your test site as some content.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">md</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 7 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">---
</span></span><span class="line"><span class="cl">title = &#34;Hello&#34;
</span></span><span class="line"><span class="cl">type = Article
</span></span><span class="line"><span class="cl">---
</span></span><span class="line"><span class="cl"><span class="gh"># Hey!
</span></span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">We have a sample article posted</span></span></code></pre>
  </details>
</div>
<p>That’s it! Now run the Hugo server with the command <code>hugo server</code> and look at your site running on localhost.</p>
<p>Just to summerise</p>
<ul>
<li>Did you need to manually clone any theme? <strong>No</strong></li>
<li>Would you need to deal with the <code>.gitmodules</code> file? <strong>No</strong></li>
</ul>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="tidy-up-the-modules" class="absolute -top-28"></div>
  Tidy up the modules
</h2>
<p>Finally, run <a href="https://gohugo.io/commands/hugo_mod_tidy/" target="_blank" rel="noopener noreferrer"><code>hugo mod tidy</code></a> to clean up the <code>go.mod</code> and update or generate the <code>go.sum</code> file. These files will track the module dependencies for your site.</p>
<ul>
<li>The <code>go.mod</code> contains the direct module dependencies for your site.</li>
<li>The <code>go.sum</code> contains the versions and hashes of all the direct <strong>and indirect</strong> dependencies</li>
</ul>
<p>Just as you added a theme as a Hugo Module to your site, it’s possible that that theme is depending on other Hugo Modules for your site.</p>
<blockquote class="blockquote">
    <p>You should ensure that both the <code>go.mod</code> and <code>go.sum</code> are not excluded from your respoitory, for example due to a <code>.gitignore</code> inclusion.</p>
</blockquote><p>Currently you <code>go.mod</code> will be similar to the following:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">go</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 5 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nx">module</span><span class="w"> </span><span class="nx">github</span><span class="p">.</span><span class="nx">com</span><span class="o">/</span><span class="nx">DamianFlynn</span><span class="o">/</span><span class="nx">hugo</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="k">go</span><span class="w"> </span><span class="mf">1.19</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nx">require</span><span class="w"> </span><span class="nx">github</span><span class="p">.</span><span class="nx">com</span><span class="o">/</span><span class="nx">Lednerb</span><span class="o">/</span><span class="nx">bilberry</span><span class="o">-</span><span class="nx">hugo</span><span class="o">-</span><span class="nx">theme</span><span class="o">/</span><span class="nx">v3</span><span class="w"> </span><span class="nx">v3</span><span class="mf">.14.0</span><span class="w"> </span><span class="c1">// indirect</span></span></span></code></pre>
  </details>
</div>
<p>while, you now also should have a new <code>go.sum</code> which again should be similar to this:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">github.com/Lednerb/bilberry-hugo-theme/v3 v3.14.0 h1:4kahS1hSN/txeL2J9MzsEqidz52N0Fltf2iwE2Jmbn0=
</span></span><span class="line"><span class="cl">github.com/Lednerb/bilberry-hugo-theme/v3 v3.14.0/go.mod h1:ERTLq/0yIBb0jN0Dh+w5G4wCp9TrB0JY86+Zh+26Dkg=</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="updating-the-theme" class="absolute -top-28"></div>
  Updating the theme 
</h2>
<p>Issing the command will instruct our Hugo module to update all the modules it depends on recursivly.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">hugo mod get -u ./..</span></span></code></pre>
  </details>
</div>
<p>If you wish to target a specif module only, for example our theme, then we would issue the following command</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">hugo mod get -u github.com/DamianFlynn/hugo</span></span></code></pre>
  </details>
</div>
<p>And, if you wish to reference a specific tag or commit in git with the following format</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">hugo mod get &lt;module path&gt;@&lt;git ref&gt;</span></span></code></pre>
  </details>
</div>
<blockquote class="blockquote">
    <p>If you have a theme added as a Hugo Module, which depends on other Hugo Modules, it’s often helpful to know the dependency graph. You can do that by running:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">shell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"> hugo mod graph</span></span></code></pre>
  </details>
</div>
<p>Which in our current configuration, appears as follows</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8cf00684ab2f4532ec98756cab13d758-8" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8cf00684ab2f4532ec98756cab13d758-8"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">github.com/DamianFlynn/hugo github.com/Lednerb/bilberry-hugo-theme/v3@v3.14.0</span></span></code></pre>
  </details>
</div>
</blockquote><hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/theming-hugo-with-module/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/theming-hugo-with-module.gif" width="1" height="1" alt="" />]]></description></item><item><title>Network Change Detection with Oxidized and Git</title><link>https://damianflynn.com/posts/change-detection-using-oxidized/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Thu, 17 Nov 2022 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/change-detection-using-oxidized/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/change-detection-using-oxidized/hero.png" referrerpolicy="no-referrer">
            </div><p>The process is very simple:</p>
<ol>
<li>Login to each device in the router list <code>router.db</code>,</li>
<li>Run Commands to get the information that will be saved</li>
<li>Clean the output</li>
<li>Commit the Changes to GIT Repository</li>
</ol>
<p>The tool is coded in <em>Ruby</em>, and implements a Domain Specific Language (DSL) for interaction.</p>
<p>Finally, there is a Web based User experience included in the solution so we can get a fast overview of the world.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="docker-container" class="absolute -top-28"></div>
  Docker Container
</h2>
<p>All of the configuration for my container is hosted at the file system location <code>/opt/appdata/oxidized</code></p>
<p>I will also select to execute the Web Interface for Oxidized using its default port with is <code>tcp:8888</code></p>
<p>Using the follow command, we will grab the latest container version from Docker Hub, and call the container <em>oxidized</em> locally. Additionally, if the container should stop, I am providing the flag to instruct docker to always restart the service again.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-a81ab2b34feca0b467adb264de8f159f-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-a81ab2b34feca0b467adb264de8f159f-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo docker run --restart always -v /opt/appdata/oxidized:/root/.config/oxidized -p 8888:8888/tcp -t oxidized/oxidized:latest oxidized</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="configuration" class="absolute -top-28"></div>
  Configuration
</h2>
<p>We need a configuration file to guide Oxidized running process</p>
<p><code>vi config</code></p>
<p>The following is the configuration sample that I am running with</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">yaml</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 56 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-a81ab2b34feca0b467adb264de8f159f-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-a81ab2b34feca0b467adb264de8f159f-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nn">---</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l">admin</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">P@ssw0rd!</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">model</span><span class="p">:</span><span class="w"> </span><span class="l">junos</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">resolve_dns</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">interval</span><span class="p">:</span><span class="w"> </span><span class="m">3600</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">use_syslog</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="nt">debug</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">threads</span><span class="p">:</span><span class="w"> </span><span class="m">30</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">timeout</span><span class="p">:</span><span class="w"> </span><span class="m">20</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">retries</span><span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">prompt</span><span class="p">:</span><span class="w"> </span>!<span class="l">ruby/regexp /^([\w.@-]+[#&gt;]\s?)$/</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">rest</span><span class="p">:</span><span class="w"> </span><span class="m">0.0.0.0</span><span class="p">:</span><span class="m">8888</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">next_adds_job</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">vars</span><span class="p">:</span><span class="w"> </span>{}<span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">groups</span><span class="p">:</span><span class="w"> </span>{}<span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">models</span><span class="p">:</span><span class="w"> </span>{}<span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">pid</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;/root/.config/oxidized/pid&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">crash</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">directory</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;/root/.config/oxidized/crashes&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">hostnames</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">stats</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">history_size</span><span class="p">:</span><span class="w"> </span><span class="m">10</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">input</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">default</span><span class="p">:</span><span class="w"> </span><span class="l">ssh, telnet</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">debug</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">ssh</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">secure</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">ftp</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">passive</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">utf8_encoded</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">output</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">default</span><span class="p">:</span><span class="w"> </span><span class="l">git</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">file</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">directory</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;/root/.config/oxidized/configs&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">git</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">single_repo</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">user</span><span class="p">:</span><span class="w"> </span><span class="l">Oxidized</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">email</span><span class="p">:</span><span class="w"> </span><span class="l">oxidized@email.target</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">repo</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;~/.config/oxidized/oxidized.git&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">default</span><span class="p">:</span><span class="w"> </span><span class="l">csv</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">csv</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">file</span><span class="p">:</span><span class="w"> </span><span class="l">~/.config/oxidized/router.db</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">delimiter</span><span class="p">:</span><span class="w"> </span>!<span class="l">ruby/regexp /:/</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span><span class="nt">map</span><span class="p">:</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="w">      </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="m">0</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="w">      </span><span class="nt">ip</span><span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="w">      </span><span class="nt">model</span><span class="p">:</span><span class="w"> </span><span class="m">2</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="w">      </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span></span></span><span class="line hl"><span class="cl"><span class="w">      </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="m">4</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">model_map</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">cisco</span><span class="p">:</span><span class="w"> </span><span class="l">ios</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">juniper</span><span class="p">:</span><span class="w"> </span><span class="l">junos</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">unifiap</span><span class="p">:</span><span class="w"> </span><span class="l">airos</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">edgeos</span><span class="p">:</span><span class="w"> </span><span class="l">edgeos</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="device-list"><a href="#device-list" class="header-mark" aria-label="Header mark for 'Device list'"></a>
    Device list
</h3>

<p>The table based on the configuration we just defined, will be formatted as follows</p>
<table>
  <thead>
      <tr>
          <th>Name</th>
          <th>IP</th>
          <th>Model</th>
          <th>Username</th>
          <th>Password</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Device Name</td>
          <td>172.16.1.x</td>
          <td>unifiap</td>
          <td>sysadmin</td>
          <td>P@ssw0rd!</td>
      </tr>
  </tbody>
</table>
<p>To populate the table, we can open the editor <code>vi router.db</code>, and then inset the following sample entries</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 5 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-a81ab2b34feca0b467adb264de8f159f-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-a81ab2b34feca0b467adb264de8f159f-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="na">Bedroom1_ap:172.16.1.114:unifiap:sysadmin:P@ssw0rd!</span>
</span></span><span class="line"><span class="cl"><span class="na">Kitchen_ap:172.16.1.121:unifiap:sysadmin:P@ssw0rd!</span>
</span></span><span class="line"><span class="cl"><span class="na">Cinema_ap:172.16.1.160:unifiap:sysadmin:P@ssw0rd!</span>
</span></span><span class="line"><span class="cl"><span class="na">ServerRoom_ap:172.16.1.115:unifiap:sysadmin:P@ssw0rd!</span>
</span></span><span class="line"><span class="cl"><span class="na">Firewall:172.16.1.1:edgeos:ubnt:P@ssw0rd!</span></span></span></code></pre>
  </details>
</div>
<p>Now, we are ready, we have the configuration all set for this installation</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="web-interface"><a href="#web-interface" class="header-mark" aria-label="Header mark for 'Web Interface'"></a>
    Web Interface
</h3>

<p>Launching our browser to the oxidized site hosted on <code>TCP 8888</code> renders the current status</p>
<p><a href="https://damianflynn.com/posts/obsidian2hugo/" rel="">Hugo and Obsidian</a></p>
<p><em>(image unavailable — “List of Devices Monitored for Change Detection” screenshot not in source vault)</em></p>
<p>From here we can see all the version changes for the devices configuration</p>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/change-detection-using-oxidized/assets/images/index_2020-07-01-16-46-41.png" alt="History of Changes on the Firewall Device" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>And even select any one of these change sets, and view the changes which were applied to the configuration</p>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/change-detection-using-oxidized/assets/images/index_2020-07-01-16-48-20.png" alt="Change Difference View" class="w-full rounded-lg"  />
  
</figure>
</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="closing-thoughts" class="absolute -top-28"></div>
  Closing Thoughts
</h2>
<p>Now, I wonder if we could integrate this with Azure?&hellip;</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/change-detection-using-oxidized/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/change-detection-using-oxidized.gif" width="1" height="1" alt="" />]]></description></item><item><title>Getting Azure Function Keys with ARM Templates</title><link>https://damianflynn.com/posts/azure-iac-function-keys/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 07 Nov 2022 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/azure-iac-function-keys/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/azure-iac-function-keys/hero.png" referrerpolicy="no-referrer">
            </div><p>Today&rsquo;s conundrum: I&rsquo;ve deployed a new <a href="https://damianflynn.com/posts/azure-functions-scaffolding/" rel="">Function Application</a>, and another service needs a key to call it. API Management is a good example. The infrastructure deployment should prepare that integration without someone opening the portal, copying a key and pasting it into the next configuration step.</p>
<p>ARM templates can create a named host key and retrieve its value through <code>listKeys</code>. Giving the integration its own named key also makes its purpose clearer than reusing a generic default key.</p>
<p>The examples below show the resource definition and the lookup used in my original deployment. They are fragments to merge into an existing Function App template, not a complete deployment on their own.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="create-a-named-host-key" class="absolute -top-28"></div>
  Create a named host key
</h2>
<p>The resource type is <code>Microsoft.Web/sites/host/functionKeys</code>. This creates a key at the <strong>Function App host level</strong>, rather than a key scoped to one individual function.</p>
<p>A host key can authorise calls to functions in that app that accept function keys. Choose that scope deliberately: a function-specific key is a narrower option when an integration only needs one function. A host key is also distinct from the host&rsquo;s administrative master key; the example does not retrieve the master key.</p>
<p>In this fragment, <code>webappName</code> is an existing template variable containing the Function App&rsquo;s name. The Function App itself is declared elsewhere in the same template:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">json</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 16 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;resources&#34;</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">    <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;comments&#34;</span><span class="p">:</span> <span class="s2">&#34;Create a dedicated host key for API Management&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;type&#34;</span><span class="p">:</span> <span class="s2">&#34;Microsoft.Web/sites/host/functionKeys&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;apiVersion&#34;</span><span class="p">:</span> <span class="s2">&#34;2018-11-01&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;[concat(variables(&#39;webappName&#39;), &#39;/default/apimanagement&#39;)]&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;dependsOn&#34;</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;[resourceId(&#39;Microsoft.Web/sites&#39;, variables(&#39;webappName&#39;))]&#34;</span>
</span></span><span class="line"><span class="cl">      <span class="p">],</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;properties&#34;</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&#34;name&#34;</span><span class="p">:</span> <span class="s2">&#34;apimanagement&#34;</span>
</span></span><span class="line"><span class="cl">      <span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre>
  </details>
</div>
<p>The resource name has three parts:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">&lt;function-app-name&gt;/default/apimanagement</span></span></code></pre>
  </details>
</div>
<p>The first identifies the Function App. <code>default</code> identifies the host resource, and <code>apimanagement</code> names the key. Keep that final segment consistent with <code>properties.name</code> and with the lookup used later.</p>
<p><code>dependsOn</code> orders key creation after the Function App resource. It does not deploy the function code or prove that an HTTP endpoint is ready to serve requests. If code deployment happens in another stage, arrange the integration and testing stages accordingly.</p>
<p>These API versions are retained from the original working example: <code>2018-11-01</code> for the key resource and <code>2016-08-01</code> for the lookup below. They are historical choices, not a claim that they are the latest recommended versions. Check the <a href="https://learn.microsoft.com/en-us/azure/templates/microsoft.web/" target="_blank" rel="noopener noreferrer">Microsoft.Web template reference</a> and your target environment when adapting the example.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="retrieve-the-key-with-listkeys" class="absolute -top-28"></div>
  Retrieve the key with <code>listKeys</code>
</h2>
<p>Once the named key exists, ARM can query the host&rsquo;s keys and select it from the <code>functionKeys</code> object.</p>
<blockquote class="blockquote">
    <p><strong>Treat the result as a secret.</strong> The ordinary string output below demonstrates the lookup used in the original template. It can expose the key through deployment history and through tools or pipeline logs that print outputs. Don&rsquo;t use a plain deployment output as a production secret-transfer mechanism. Prefer consuming the value directly in the dependent resource&rsquo;s configuration, where supported, or using an appropriately secured secret store such as Key Vault. Review the destination&rsquo;s secret-handling behaviour too.</p>

</blockquote><p>The original output pattern is:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">json</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 8 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-2e70343439c7b3a2e32ea9cb811f5851-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="nt">&#34;outputs&#34;</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&#34;functionKey&#34;</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;type&#34;</span><span class="p">:</span> <span class="s2">&#34;string&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">      <span class="nt">&#34;value&#34;</span><span class="p">:</span> <span class="s2">&#34;[listKeys(concat(resourceId(&#39;Microsoft.Web/sites&#39;, variables(&#39;webappName&#39;)), &#39;/host/default/&#39;), &#39;2016-08-01&#39;).functionKeys.apimanagement]&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre>
  </details>
</div>
<p>The expression does three things:</p>
<ol>
<li><code>resourceId('Microsoft.Web/sites', variables('webappName'))</code> identifies the Function App in the deployment&rsquo;s resource group.</li>
<li>Appending <code>/host/default/</code> identifies its host for the <code>listKeys</code> operation.</li>
<li><code>.functionKeys.apimanagement</code> selects the named key from the returned object.</li>
</ol>
<p>The deployment identity needs permission to perform the key-listing operation. A successful deployment of an unrelated resource does not imply that the identity can read Function App keys.</p>
<p>If you adapt this lookup for another resource in the template, make that consumer depend on the named key&rsquo;s creation. In a separate deployment stage, run the lookup only after the key-creation stage succeeds. The consumer should not race the resource that creates the key it needs.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="use-the-key-to-complete-the-integration" class="absolute -top-28"></div>
  Use the key to complete the integration
</h2>
<p>For API Management, the next step is to place the key in the integration&rsquo;s protected configuration and use it when calling the Function App. Avoid copying it into source-controlled policy text or printing it during deployment.</p>
<p>Retrieving a key confirms that the key-management operation succeeded; it does not validate the function&rsquo;s behaviour. To validate the deployment, make a separate request to the intended endpoint and check the response. Keep the key out of request logs and diagnostic output while doing so.</p>
<p>The useful part of this pattern is that key creation and lookup can be part of the deployment process. Keep the key name consistent, choose the narrowest appropriate scope, and handle its value as a credential throughout the handover to the consuming service.</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p><p><a href="https://damianflynn.com/posts/azure-iac-function-keys/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/azure-iac-function-keys.gif" width="1" height="1" alt="" />]]></description></item><item><title>Obsidian to Hugo with Obsidian2Hugo</title><link>https://damianflynn.com/posts/obsidian2hugo/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Mon, 07 Nov 2022 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/obsidian2hugo/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/obsidian2hugo/hero.png" referrerpolicy="no-referrer">
            </div><p>My Blog has evolved over the years, initially hosted on Wordpress, but some 6 years back I abandond that plaform for Static Sites, initially with Jekyll and used Github Pages, but that also got sunset in favor of my current generator Hugo.</p>
<p>As part of my current workflow, I use Obsidian for almost all my notes, which includes the posts which you get to read publically on this blog.</p>
<p>To make this happen, there are some very cool open source projects which I am relying to pipeline the content for its raw source, to the presentation which is finally published.</p>
<p>All the documentation I create, presonally and professionally, is authored in Markdown. So keeping this source standard based is critically important to me.</p>
<p>One thing I didn’t like was to have to put the title into frontmatter and to manually write the description used by hugo as a <code>&lt;meta&gt;</code> description which is important for search engine optimization (SEO). The here introduced <code>obsidian2hugo</code> does exactly this. I t parses a obsidian source (sub)tree, parses every markdown file and extracts (and deletes) a <code>h1</code> title (if present) and uses the content of a named <code>h2</code> header (standard <code>## tl;dr</code>)</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="obsidian-export" class="absolute -top-28"></div>
  Obsidian Export
</h2>
<p><a href="https://github.com/aadimator/obsidian-export" target="_blank" rel="noopener noreferrer">https://github.com/aadimator/obsidian-export</a></p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="dependencies"><a href="#dependencies" class="header-mark" aria-label="Header mark for 'Dependencies'"></a>
    Dependencies
</h3>

<p>Install the rust development tools on our workstation</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">xcode-select --install
</span></span><span class="line"><span class="cl">brew install rust</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="clone-and-build"><a href="#clone-and-build" class="header-mark" aria-label="Header mark for 'Clone and Build'"></a>
    Clone and Build
</h3>

<p>Grab the source of the tool, and compile it</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 7 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">cd</span> ~/vault
</span></span><span class="line"><span class="cl">git clone https://github.com/aadimator/obsidian-export
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> obsidian-export
</span></span><span class="line"><span class="cl">cargo build --release --locked
</span></span><span class="line"><span class="cl">cp target/release/obsidian-export ~/vault/obsidian-exporter
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> ..
</span></span><span class="line"><span class="cl">./obsidian-exporter --help</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="export-from-the-vault" class="absolute -top-28"></div>
  Export from the Vault
</h2>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 11 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">mkdir ./damianflynn.com-hugo/content/article
</span></span><span class="line"><span class="cl">./obsidian-exporter ./Cranium/knowledge/blog  ./damianflynn.com-hugo/content/article --hard-linebreaks --no-recursive-embeds --embed-info --hugo-frontmatter --retain-wikilinks --flat
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Using a Start-At folder</span>
</span></span><span class="line"><span class="cl">./obsidian-exporter ./Cranium/  ./damianflynn.com-hugo/content/article --start-at ./Cranium/knowledge/blog --hard-linebreaks --no-recursive-embeds --embed-info  --retain-wikilinks --flat --hugo-frontmatter
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Using an .export-ignore</span>
</span></span><span class="line"><span class="cl">./obsidian-exporter ./Cranium/  ./damianflynn.com-hugo/content/article --hard-linebreaks --no-recursive-embeds --embed-info  --retain-wikilinks --flat --hugo-frontmatter
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">### From the Video</span>
</span></span><span class="line"><span class="cl">./obsidian-exporter ./Cranium/  ./damianflynn.com-hugo/content/article --add-titles --frontmatter<span class="o">=</span>always</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="hugo-obsidian" class="absolute -top-28"></div>
  Hugo Obsidian
</h2>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="install"><a href="#install" class="header-mark" aria-label="Header mark for 'Install'"></a>
    Install
</h3>

<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">go install github.com/aadimator/hugo-obsidian@latest</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="test"><a href="#test" class="header-mark" aria-label="Header mark for 'Test'"></a>
    Test
</h3>

<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">~/go/bin/hugo-obsidian --help</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="convert-content"><a href="#convert-content" class="header-mark" aria-label="Header mark for 'Convert Content'"></a>
    Convert Content
</h3>

<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f0a2193b0624e36ffb06eea742742545-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f0a2193b0624e36ffb06eea742742545-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">hugo-obsidian -input<span class="o">=</span>./damianflynn.com-hugo/content/article -output<span class="o">=</span>damianflynn.com-hugo/assets/indices -index<span class="o">=</span><span class="nb">true</span> -root<span class="o">=</span>.</span></span></code></pre>
  </details>
</div>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/obsidian2hugo/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/obsidian2hugo.gif" width="1" height="1" alt="" />]]></description></item><item><title>Active Directory Administrative Limits: Finding and Resolving the Bloat</title><link>https://damianflynn.com/posts/ad-administrative-limits/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Tue, 27 Jul 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/ad-administrative-limits/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/ad-administrative-limits/hero.png" referrerpolicy="no-referrer">
            </div><p>I recently ran into an issue with a particular environment where Active Directory and PKI services were deployed. One of the service accounts which I was attempting to &lsquo;unlock&rsquo; refused to co-operate and instead offered the most unhelpful message.</p>
<p><code>Administrative limit for this request was exceeded</code> - this was not my first time encountering the message, previously this haunted me while I was managing a Windows PKI infrastructure and with some quick searches, confirmed my initial suspicion. This is a symptom of an AD object quite simply being to large!</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="explaination" class="absolute -top-28"></div>
  Explaination
</h2>
<p>Active Directory is in the simplest form a Database, and each object can be considered as a row in this database. Like any database there are limits to what data can be stored in the table, the type of data, but also the amount.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="resolving-the-problem" class="absolute -top-28"></div>
  Resolving the problem
</h2>
<p>Using a tool like <strong>ADSI Edit</strong> will allow you to open the database, and select the schema partition we would like to work with. Standard objects which we can see in the <em>Active Directory Users and Computers</em> extension are all hosted in the partition called the <em>Default Naming Context</em>; which is where we need to focus for this problem</p>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/ad-administrative-limits/sw_active-directory_administrative-limits_2021-07-27-10-55-18.png" alt="ADSI Edit - Default Naming Context" class="w-full rounded-lg"  />
  
</figure>
</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="identifying-the-bloat"><a href="#identifying-the-bloat" class="header-mark" aria-label="Header mark for 'Identifying the Bloat'"></a>
    Identifying the Bloat
</h3>

<p>There is no super cool trick here, we just need a little investigation. Start by navigating the OU structure you are familiar with in Active Directory Users and Computers, to locate the account with issues.</p>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/ad-administrative-limits/sw_active-directory_administrative-limits_2021-07-27-11-00-37.png" alt="AD Object Navigation in ADSI Edit" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>Right Click on the object, and select <strong>Properties</strong> where you now get to view the 100&rsquo;s of columns of data which AD stores for each object.</p>
<p>Click on the <strong>Filter</strong> button and enable the option <em>Show only attributes that have values</em> - this will remove all the columns which are empty - and therefore not adding to our overside object!</p>
<p>





  
  
    
  


<figure class="my-8">
  <img src="https://damianflynn.com/posts/ad-administrative-limits/sw_active-directory_administrative-limits_2021-07-27-11-03-48.png" alt="ADSI Properties Filter" class="w-full rounded-lg"  />
  
</figure>
</p>
<p>Now, you can check each of the remaining attributes (columns) and see what they contain, I&rsquo;ll save a few minutes, and in this case I expect my issue is to do with Certificates, so we will focus on the attribute called <em>userCertificate</em> which contains an collection of <em>[byte[]]</em>, each representing a Base64 encoded Certificate.</p>
<p>BINGO! looking at this property I can see 100&rsquo;s of entries, and each one has the same <em>byte[]</em> string, which implies the same certificate is loaded into the object a lot of times.</p>
<p>I am going to flush the lot of them out, as these are added by the system, and it will reload them as required; but for now, I am simply the garbage collector.</p>
<p>Using the UX, we can delete these 1 at a time, so we need a little automation, or the rest of the week will be wasted.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="powershell-helper" class="absolute -top-28"></div>
  Powershell Helper
</h2>
<p>Using standard Active Directory module for Powershell, we can get a reference to the object which needs to be flushed</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nv">$certUser</span> <span class="p">=</span> <span class="nb">Get-Aduser</span> <span class="s2">&#34;svc_PKI_NDES&#34;</span> <span class="n">-Properties</span> <span class="n">certificates</span></span></span></code></pre>
  </details>
</div>
<p>Now, let&rsquo;s check what we got from AD</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nv">$certuser</span><span class="p">.</span><span class="py">Certificates</span><span class="p">.</span><span class="py">Count</span>
</span></span><span class="line"><span class="cl"><span class="mf">1169</span></span></span></code></pre>
  </details>
</div>
<p>Right, time to fix this, we will use the following command to remove all the certificates from the object</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">PS </span><span class="n">C:</span><span class="p">\</span><span class="n">Users</span><span class="p">\</span><span class="n">sysadmin</span><span class="p">.</span><span class="n">AD</span><span class="p">&gt;</span> <span class="nb">set-ADUser</span> <span class="n">svc_PKI_NDES</span> <span class="n">-Certificates</span> <span class="vm">@</span><span class="p">{}</span></span></span></code></pre>
  </details>
</div>
<p>And, let&rsquo;s confirm it worked</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 3 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-fcbd5f115d1b7afb67c0d9b9c4f70d20-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nv">$certuser</span> <span class="p">=</span> <span class="nb">Get-ADUser</span> <span class="n">svc_PKI_NDES</span> <span class="n">-Properties</span> <span class="n">Certificates</span>
</span></span><span class="line"><span class="cl"><span class="nv">$certuser</span><span class="p">.</span><span class="py">Certificates</span><span class="p">.</span><span class="py">count</span>
</span></span><span class="line"><span class="cl"><span class="mf">0</span></span></span></code></pre>
  </details>
</div>
<p>And now, just check that you can unlock the account, or complete the operation that sent you chasing this wild goose!</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/ad-administrative-limits/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/ad-administrative-limits.gif" width="1" height="1" alt="" />]]></description></item><item><title>Azure Tags as Bicep Parameters</title><link>https://damianflynn.com/posts/bicep-tags-as-parameters/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Fri, 23 Jul 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/bicep-tags-as-parameters/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/bicep-tags-as-parameters/iac_bicep_tags-as-parameters.png" referrerpolicy="no-referrer">
            </div><p>A deployment often needs to find infrastructure that already exists. A virtual machine might belong to a subscription with a shared Recovery Services vault, while its backup policy depends on the workload. Passing the vault name, its resource group and the policy name into every deployment works, but repeats configuration that may already be recorded in Azure.</p>
<p>In the earlier post, <a href="https://damianflynn.com/posts/azure-iac-tags-as-parameters/" rel="">Azure Tags as ARM Template Parameters</a>, I used tags to look up those values from an ARM JSON template. This is the same lab scenario expressed in Bicep. The lookup behaves the same way, but the string interpolation makes the resource paths easier to follow.</p>
<p>The title describes the intended use of the values: they can supply configuration to a deployment. The tag values are not Bicep parameter defaults, however. They are read at deployment time with <code>reference</code>, and this example returns them as outputs so we can inspect the result before wiring them into another resource or module.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="the-scenario-find-the-right-vault-and-policy" class="absolute -top-28"></div>
  The scenario: find the right vault and policy
</h2>
<p>Suppose each subscription has a designated backup vault. Rather than repeat that choice in every workload&rsquo;s parameter file, record the vault&rsquo;s name and resource group as subscription tags. The VM carries a separate tag identifying its intended backup policy.</p>
<p>The lab uses this convention:</p>
<table>
  <thead>
      <tr>
          <th>Scope</th>
          <th>Tag</th>
          <th>Example value</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Subscription</td>
          <td><code>recoveryVault</code></td>
          <td><code>p-vault-001</code></td>
      </tr>
      <tr>
          <td>Subscription</td>
          <td><code>recoveryVaultRG</code></td>
          <td><code>p-vault</code></td>
      </tr>
      <tr>
          <td>Virtual machine</td>
          <td><code>recoveryPolicy</code></td>
          <td><code>DefaultPolicy</code></td>
      </tr>
  </tbody>
</table>
<p>The vault and policy already exist. The VM is also an existing resource; the example does not create it or apply any tags.</p>
<p>Subscription tags and VM tags are read separately. Azure does not automatically inherit subscription tags onto resources. In this design, the subscription records the shared vault selection, while the VM records its own policy selection.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="look-up-the-tags-with-bicep" class="absolute -top-28"></div>
  Look up the tags with Bicep
</h2>
<p>Azure exposes tags through the <code>Microsoft.Resources/tags</code> extension resource. Appending <code>/providers/Microsoft.Resources/tags/default</code> to a resource&rsquo;s scope gives us the identifier to query.</p>
<p>The following example retains the resource ID from my original lab. Replace <code>sourceResourceId</code> with your own VM&rsquo;s resource ID before deploying it. The subscription lookup uses the <strong>deployment&rsquo;s current subscription</strong>, and the lab assumes the VM and vault are in that same subscription.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">bicep</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 20 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="p">@</span><span class="nf">description</span><span class="p">(</span><span class="s">&#39;The resource ID of the existing resource whose tags we want to read.&#39;</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">param</span><span class="w"> </span><span class="nv">sourceResourceId</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&#39;/subscriptions/547d54ea-411b-459e-b6f8-b3cc5e84c535/resourceGroups/p-vm/providers/Microsoft.Compute/virtualMachines/p-vm001&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="c1">// Tags on the deployment subscription.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">var</span><span class="w"> </span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&#39;/subscriptions/</span><span class="si">${</span><span class="nf">subscription</span><span class="p">().</span><span class="nv">subscriptionId</span><span class="si">}</span><span class="s">/providers/Microsoft.Resources/tags/default&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="c1">// Tags on the selected resource.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">var</span><span class="w"> </span><span class="nv">referenceResourceTagsResourceId</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&#39;</span><span class="si">${</span><span class="nv">sourceResourceId</span><span class="si">}</span><span class="s">/providers/Microsoft.Resources/tags/default&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">var</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&#39;2020-06-01&#39;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="c1">// Inspect the values read from the subscription.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">output</span><span class="w"> </span><span class="nv">subscriptionRecoveryVaultRGTag</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVaultRG</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">output</span><span class="w"> </span><span class="nv">subscriptionRecoveryVaultTag</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVault</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="c1">// Inspect the policy selected on the resource.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">output</span><span class="w"> </span><span class="nv">resourceRecoveryPolicyTag</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceResourceTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryPolicy</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="c1">// Build identifiers for the existing vault and policy.</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">output</span><span class="w"> </span><span class="nv">recoveryVaultId</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="nf">resourceId</span><span class="p">(</span><span class="nf">subscription</span><span class="p">().</span><span class="nv">subscriptionId</span><span class="p">,</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVaultRG</span><span class="p">,</span><span class="w"> </span><span class="s">&#39;Microsoft.RecoveryServices/vaults&#39;</span><span class="p">,</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVault</span><span class="p">)</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="kd">output</span><span class="w"> </span><span class="nv">recoveryPolicyId</span><span class="w"> </span><span class="nv">string</span><span class="w"> </span><span class="p">=</span><span class="w"> </span><span class="s">&#39;</span><span class="si">${</span><span class="nf">resourceId</span><span class="p">(</span><span class="nf">subscription</span><span class="p">().</span><span class="nv">subscriptionId</span><span class="p">,</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVaultRG</span><span class="p">,</span><span class="w"> </span><span class="s">&#39;Microsoft.RecoveryServices/vaults&#39;</span><span class="p">,</span><span class="w"> </span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceSubscriptionTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryVault</span><span class="p">)</span><span class="si">}</span><span class="s">/backupPolicies/</span><span class="si">${</span><span class="nf">reference</span><span class="p">(</span><span class="nv">referenceResourceTagsResourceId</span><span class="p">,</span><span class="w"> </span><span class="nv">referenceTagsApi</span><span class="p">).</span><span class="nv">tags</span><span class="p">.</span><span class="nv">recoveryPolicy</span><span class="si">}</span><span class="s">&#39;</span></span></span></code></pre>
  </details>
</div>
<p>The first two variables construct the tag-resource identifiers. <code>referenceTagsApi</code> supplies the API version for reading them, and each <code>reference(...).tags.&lt;name&gt;</code> expression selects one value from the returned tag collection.</p>
<p>The first three outputs are deliberately simple: they let us check that the tagging convention has been applied correctly before using the values elsewhere.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="turn-the-values-into-resource-ids" class="absolute -top-28"></div>
  Turn the values into resource IDs
</h2>
<p>The final two outputs build the identifiers that another deployment component could consume.</p>
<p><code>resourceId</code> combines the current subscription, the tagged resource group, the Recovery Services resource type and the tagged vault name. The policy identifier then adds <code>/backupPolicies/</code> and the policy name read from the VM.</p>
<p>With the example tag values, the results are:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">text</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 5 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">Vault:
</span></span><span class="line"><span class="cl">/subscriptions/547d54ea-411b-459e-b6f8-b3cc5e84c535/resourceGroups/p-vault/providers/Microsoft.RecoveryServices/vaults/p-vault-001
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Policy:
</span></span><span class="line"><span class="cl">/subscriptions/547d54ea-411b-459e-b6f8-b3cc5e84c535/resourceGroups/p-vault/providers/Microsoft.RecoveryServices/vaults/p-vault-001/backupPolicies/DefaultPolicy</span></span></code></pre>
  </details>
</div>
<p>Constructing these strings does not prove that the vault and policy exist, or that the policy is compatible with the workload. This example resolves configuration; it does not enable backup, register the VM with the vault or create a protected item. Those are separate deployment steps.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="deploy-the-lookup-and-inspect-the-outputs" class="absolute -top-28"></div>
  Deploy the lookup and inspect the outputs
</h2>
<p>Save the example as <code>tags-as-parameters.bicep</code>. From an authenticated Azure CLI session, select the intended subscription and deploy to an existing resource group:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 7 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f3f0712ddc409798c2fe9581f2593e6b-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">az account <span class="nb">set</span> --subscription &lt;subscription-id&gt;
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">az deployment group create <span class="se">\
</span></span></span><span class="line"><span class="cl">  --resource-group &lt;deployment-resource-group&gt; <span class="se">\
</span></span></span><span class="line"><span class="cl">  --template-file tags-as-parameters.bicep <span class="se">\
</span></span></span><span class="line"><span class="cl">  --parameters <span class="nv">sourceResourceId</span><span class="o">=</span>&lt;vm-resource-id&gt; <span class="se">\
</span></span></span><span class="line"><span class="cl">  --query properties.outputs</span></span></code></pre>
  </details>
</div>
<p>Replace the angle-bracket placeholders rather than entering them literally. The template declares no infrastructure resources, but it still creates a deployment record and performs the tag lookups. The deployment identity needs permission to deploy at that scope and read tags at both the subscription and selected resource scopes.</p>
<p>Check the individual tag outputs first, then the assembled vault and policy IDs. If a required tag is absent or the tag resource cannot be read, the lookup can fail. This sample intentionally has no fallback vault or policy: silently choosing one would hide a configuration error.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="where-this-pattern-fitsand-where-it-doesnt" class="absolute -top-28"></div>
  Where this pattern fits—and where it doesn&rsquo;t
</h2>
<p>Using tags this way can be useful when an organisation already governs a small set of configuration tags. A workload deployment can discover the local subscription&rsquo;s shared service without maintaining a separate copy of its name in every parameter file.</p>
<p>It also makes tag editing operationally significant. Someone who can change <code>recoveryVault</code> or <code>recoveryPolicy</code> can influence what a later deployment selects. Document the convention, restrict write access appropriately and validate the selected resources before applying changes.</p>
<p>A few limits matter:</p>
<ul>
<li><strong>Tags are strings.</strong> Validate their values rather than treating them as typed configuration.</li>
<li><strong>Tags are not a secret store.</strong> Keep credentials and other sensitive values out of them.</li>
<li><strong>Lookups happen during deployment.</strong> Changing a tag afterwards does not automatically rerun the deployment or reconfigure an existing workload.</li>
<li><strong>The subscription scopes are explicit.</strong> Passing a VM ID from another subscription does not change the subscription used for the vault lookup or the assembled vault ID. Cross-subscription designs need additional scope and permission handling.</li>
</ul>
<p>For configuration that should be versioned and reviewed with the code, a parameter file may remain the better choice. Tags are useful here because they describe an existing environment&rsquo;s agreed configuration, not because they replace every other source of deployment inputs.</p>
<p>Start with the lookup-only template and check its outputs against the intended vault and policy. Once those values are reliable, connect them to the deployment component that actually configures backup, with validation appropriate to that operation.</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/bicep-tags-as-parameters/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/bicep-tags-as-parameters.gif" width="1" height="1" alt="" />]]></description></item><item><title>FreeRADIUS for 802.1X with Certificates: EAP and PKI Setup</title><link>https://damianflynn.com/posts/configuring-freeradius-for-802-1x/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Sun, 07 Mar 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/configuring-freeradius-for-802-1x/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/configuring-freeradius-for-802-1x/hero.png" referrerpolicy="no-referrer">
            </div><p>In a pervious post, I covered the steps to <a href="https://damianflynn.com/posts/installing-freeradius/" rel="">deploy the current stable release of FreeRadius, by installing the packages from the NetworkRadius organizations repository</a>.</p>
<p>We will now, focus on configuring the FreeRadius server so that it can authenticate 802.1x requests, which depends on valid [Computer Certificates](/posts/create-pki-certificate-for-linux-server/#Creating our Certificate Request).</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="why" class="absolute -top-28"></div>
  Why?
</h2>
<p>Why would we go to this trouble, especially given the fact that Windows has shipped with its own NPS service, for the past 20 years?</p>
<p>Simple really, In the world of Cloud First, many customers are now selecting the option of Azure AD Joined only, for their machines in preference to AD Joined, or even Hybrid Joined. This matters, as the Windows NPS Service is hardcoded to check if a computer account object is present in the Active Directory; which is obviously not the case for Cloud Only systems. The result - every authentication request will automatically respond as failed validation!</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="configuring-free-radius" class="absolute -top-28"></div>
  Configuring Free Radius
</h2>
<p>There are a number of files used to configure the behavior of the FreeRadius service, the default configuration within these files is very verbose, so in this post we will clean up the configuration, and implement the settings required to validate 802.1x requests - Specifically we will check the computer certificate to ensure it is valid.</p>
<blockquote class="blockquote">
    <p>FreeRaidus by default protects all the configuration so that your normal account has no access to the files, and folders. To enable a lower resistance path to working on this server, you can <strong>Assume <code>root</code> access</strong> with the following command</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo su -</span></span></code></pre>
  </details>
</div>

</blockquote><h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="radius-server"><a href="#radius-server" class="header-mark" aria-label="Header mark for 'Radius Server'"></a>
    Radius Server
</h3>

<p>We will turn off proxy features in the server, and enable logging for authentication. We begin by editing the core configuration file called <code>/etc/freeradius/radiusd.conf</code></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 74 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="na">prefix</span> <span class="o">=</span> <span class="s">/usr</span>
</span></span><span class="line"><span class="cl"><span class="na">exec_prefix</span> <span class="o">=</span> <span class="s">/usr</span>
</span></span><span class="line"><span class="cl"><span class="na">sysconfdir</span> <span class="o">=</span> <span class="s">/etc</span>
</span></span><span class="line"><span class="cl"><span class="na">localstatedir</span> <span class="o">=</span> <span class="s">/var</span>
</span></span><span class="line"><span class="cl"><span class="na">sbindir</span> <span class="o">=</span> <span class="s">${exec_prefix}/sbin</span>
</span></span><span class="line"><span class="cl"><span class="na">logdir</span> <span class="o">=</span> <span class="s">/var/log/freeradius</span>
</span></span><span class="line"><span class="cl"><span class="na">raddbdir</span> <span class="o">=</span> <span class="s">/etc/freeradius</span>
</span></span><span class="line"><span class="cl"><span class="na">radacctdir</span> <span class="o">=</span> <span class="s">${logdir}/radacct</span>
</span></span><span class="line"><span class="cl"><span class="na">name</span> <span class="o">=</span> <span class="s">freeradius</span>
</span></span><span class="line"><span class="cl"><span class="na">confdir</span> <span class="o">=</span> <span class="s">${raddbdir}</span>
</span></span><span class="line"><span class="cl"><span class="na">modconfdir</span> <span class="o">=</span> <span class="s">${confdir}/mods-config</span>
</span></span><span class="line"><span class="cl"><span class="na">certdir</span> <span class="o">=</span> <span class="s">${confdir}/certs</span>
</span></span><span class="line"><span class="cl"><span class="na">cadir</span>   <span class="o">=</span> <span class="s">${confdir}/certs</span>
</span></span><span class="line"><span class="cl"><span class="na">run_dir</span> <span class="o">=</span> <span class="s">${localstatedir}/run/${name}</span>
</span></span><span class="line"><span class="cl"><span class="na">db_dir</span> <span class="o">=</span> <span class="s">${raddbdir}</span>
</span></span><span class="line"><span class="cl"><span class="na">libdir</span> <span class="o">=</span> <span class="s">/usr/lib/freeradius</span>
</span></span><span class="line"><span class="cl"><span class="na">pidfile</span> <span class="o">=</span> <span class="s">${run_dir}/${name}.pid</span>
</span></span><span class="line"><span class="cl"><span class="na">correct_escapes</span> <span class="o">=</span> <span class="s">true</span>
</span></span><span class="line"><span class="cl"><span class="na">max_request_time</span> <span class="o">=</span> <span class="s">30</span>
</span></span><span class="line"><span class="cl"><span class="na">cleanup_delay</span> <span class="o">=</span> <span class="s">5</span>
</span></span><span class="line"><span class="cl"><span class="na">max_requests</span> <span class="o">=</span> <span class="s">16384</span>
</span></span><span class="line"><span class="cl"><span class="na">hostname_lookups</span> <span class="o">=</span> <span class="s">no</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">log {</span>
</span></span><span class="line"><span class="cl">  <span class="na">destination</span> <span class="o">=</span> <span class="s">files
</span></span></span><span class="line"><span class="cl"><span class="s">  colourise = yes
</span></span></span><span class="line"><span class="cl"><span class="s">  file = ${logdir}/radius.log
</span></span></span><span class="line"><span class="cl"><span class="s">  syslog_facility = daemon
</span></span></span><span class="line"><span class="cl"><span class="s">  stripped_names = no
</span></span></span><span class="line"><span class="cl"><span class="s">  auth = no
</span></span></span><span class="line"><span class="cl"><span class="s">  auth_badpass = no
</span></span></span><span class="line"><span class="cl"><span class="s">  auth_goodpass = no
</span></span></span><span class="line"><span class="cl"><span class="s">  msg_denied = &#34;You are already logged in - access denied&#34;</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">checkrad</span> <span class="o">=</span> <span class="s">${sbindir}/checkrad</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">ENV {</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">security {</span>
</span></span><span class="line"><span class="cl">  <span class="na">user</span> <span class="o">=</span> <span class="s">freerad
</span></span></span><span class="line"><span class="cl"><span class="s">  group = freerad
</span></span></span><span class="line"><span class="cl"><span class="s">  allow_core_dumps = no
</span></span></span><span class="line"><span class="cl"><span class="s">  max_attributes = 200
</span></span></span><span class="line"><span class="cl"><span class="s">  reject_delay = 1
</span></span></span><span class="line"><span class="cl"><span class="s">  status_server = yes</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">proxy_requests</span>  <span class="o">=</span> <span class="s">yes</span>
</span></span><span class="line"><span class="cl"><span class="na">$INCLUDE proxy.conf</span>
</span></span><span class="line"><span class="cl"><span class="na">$INCLUDE clients.conf</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">thread pool {</span>
</span></span><span class="line"><span class="cl">  <span class="na">start_servers</span> <span class="o">=</span> <span class="s">5
</span></span></span><span class="line"><span class="cl"><span class="s">  max_servers = 32
</span></span></span><span class="line"><span class="cl"><span class="s">  min_spare_servers = 3
</span></span></span><span class="line"><span class="cl"><span class="s">  max_spare_servers = 10
</span></span></span><span class="line"><span class="cl"><span class="s">  max_requests_per_server = 0
</span></span></span><span class="line"><span class="cl"><span class="s">  auto_limit_acct = no</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">modules {</span>
</span></span><span class="line"><span class="cl">  <span class="na">$INCLUDE mods-enabled/</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">instantiate {</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">policy {</span>
</span></span><span class="line"><span class="cl">  <span class="na">$INCLUDE policy.d/</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">$INCLUDE sites-enabled/</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="proxy-configuration"><a href="#proxy-configuration" class="header-mark" aria-label="Header mark for 'Proxy Configuration'"></a>
    Proxy Configuration
</h3>

<p>The configuration of the proxy feature is maintained in the file `/etc/freeradius/proxy.conf'</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 44 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="na">proxy server {</span>
</span></span><span class="line"><span class="cl">  <span class="na">default_fallback</span> <span class="o">=</span> <span class="s">no</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">home_server localhost {</span>
</span></span><span class="line"><span class="cl">  <span class="na">type</span> <span class="o">=</span> <span class="s">auth
</span></span></span><span class="line"><span class="cl"><span class="s">  ipaddr = 127.0.0.1
</span></span></span><span class="line"><span class="cl"><span class="s">  port = 1812
</span></span></span><span class="line"><span class="cl"><span class="s">  secret = testing123
</span></span></span><span class="line"><span class="cl"><span class="s">  response_window = 20
</span></span></span><span class="line"><span class="cl"><span class="s">  zombie_period = 40
</span></span></span><span class="line"><span class="cl"><span class="s">  revive_interval = 120
</span></span></span><span class="line"><span class="cl"><span class="s">  status_check = status-server
</span></span></span><span class="line"><span class="cl"><span class="s">  check_interval = 30
</span></span></span><span class="line"><span class="cl"><span class="s">  check_timeout = 4
</span></span></span><span class="line"><span class="cl"><span class="s">  num_answers_to_alive = 3
</span></span></span><span class="line"><span class="cl"><span class="s">  max_outstanding = 65536</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="na">coa {</span>
</span></span><span class="line"><span class="cl">    <span class="na">irt</span> <span class="o">=</span> <span class="s">2
</span></span></span><span class="line"><span class="cl"><span class="s">    mrt = 16
</span></span></span><span class="line"><span class="cl"><span class="s">    mrc = 5
</span></span></span><span class="line"><span class="cl"><span class="s">    mrd = 30
</span></span></span><span class="line"><span class="cl"><span class="s">  }</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="na">limit {</span>
</span></span><span class="line"><span class="cl">    <span class="na">max_connections</span> <span class="o">=</span> <span class="s">16
</span></span></span><span class="line"><span class="cl"><span class="s">    max_requests = 0
</span></span></span><span class="line"><span class="cl"><span class="s">    lifetime = 0
</span></span></span><span class="line"><span class="cl"><span class="s">    idle_timeout = 0
</span></span></span><span class="line"><span class="cl"><span class="s">  }</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">home_server_pool my_auth_failover {</span>
</span></span><span class="line"><span class="cl">  <span class="na">type</span> <span class="o">=</span> <span class="s">fail-over
</span></span></span><span class="line"><span class="cl"><span class="s">  home_server = localhost</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">realm example.com {</span>
</span></span><span class="line"><span class="cl">  <span class="na">auth_pool</span> <span class="o">=</span> <span class="s">my_auth_failover</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="na">realm LOCAL {</span>
</span></span><span class="line"><span class="cl"><span class="na">}</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="radius-clients"><a href="#radius-clients" class="header-mark" aria-label="Header mark for 'Radius Clients'"></a>
    Radius Clients
</h3>

<p>To specify the clients allowed to send requests to the RADIUS server. Most of the times we want to configure a router or wireless access points as a Network Access Server (NAS), so that WiFi clients connecting will communicate to the RADIUS server via the router. We define the client networks in the file <code>/etc/freeradius/clients.conf</code> configuration file</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">conf</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 27 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">############################ /clients.conf
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">client localhost {
</span></span><span class="line"><span class="cl">  ipaddr = 127.0.0.1
</span></span><span class="line"><span class="cl">  proto = *
</span></span><span class="line"><span class="cl">  secret = testing123
</span></span><span class="line"><span class="cl">  require_message_authenticator = no
</span></span><span class="line"><span class="cl">  nas_type = other
</span></span><span class="line"><span class="cl">  limit {
</span></span><span class="line"><span class="cl">    max_connections = 16
</span></span><span class="line"><span class="cl">    lifetime = 0
</span></span><span class="line"><span class="cl">    idle_timeout = 30
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># IPv6 Client
</span></span><span class="line"><span class="cl">client localhost_ipv6 {
</span></span><span class="line"><span class="cl">  ipv6addr= ::1
</span></span><span class="line"><span class="cl">  secret= testing123
</span></span><span class="line"><span class="cl">}
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># Our Clients Network
</span></span><span class="line"><span class="cl">client private-network-1 {
</span></span><span class="line"><span class="cl">  ipaddr= 10.46.0.0/16
</span></span><span class="line"><span class="cl">  secret= radius
</span></span><span class="line"><span class="cl">  require_message_authenticator = yes
</span></span><span class="line"><span class="cl">}</span></span></code></pre>
  </details>
</div>
<p>The section <strong>private-network-1</strong> lists the IP range of the Radius Clients (ipaddr) and the secret they must provide to be trusted (secret).</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="freeradius-default-service"><a href="#freeradius-default-service" class="header-mark" aria-label="Header mark for 'FreeRadius Default Service'"></a>
    FreeRadius Default Service
</h3>

<p>Next we will update the service so that the modules required for WiFi authentication are enabled, and all additional services are disabled.</p>
<p>We will replace the content in <code>/etc/freeradius/sites-enabled/default</code> with the following configuration</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">conf</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 68 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">############################ sites-enabled/default
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">server {
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  listen {
</span></span><span class="line"><span class="cl">    type = auth
</span></span><span class="line"><span class="cl">    port = 1812
</span></span><span class="line"><span class="cl">    ipaddr = *
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  authorize {
</span></span><span class="line"><span class="cl">    preprocess
</span></span><span class="line"><span class="cl">    eap {
</span></span><span class="line"><span class="cl">      ok = return
</span></span><span class="line"><span class="cl">    }
</span></span><span class="line"><span class="cl">    expiration
</span></span><span class="line"><span class="cl">    logintime
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  authenticate {
</span></span><span class="line"><span class="cl">    eap
</span></span><span class="line"><span class="cl">    Auth-Type eap {
</span></span><span class="line"><span class="cl">      eap {
</span></span><span class="line"><span class="cl">        handled = 1
</span></span><span class="line"><span class="cl">      }
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">      if (handled &amp;&amp; (Response-Packet-Type == Access-Challenge)) {
</span></span><span class="line"><span class="cl">        attr_filter.access_challenge.post-auth
</span></span><span class="line"><span class="cl">        handled # override the &#34;updated&#34; code from attr_filter
</span></span><span class="line"><span class="cl">      }
</span></span><span class="line"><span class="cl">    }
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  preacct {
</span></span><span class="line"><span class="cl">    preprocess
</span></span><span class="line"><span class="cl">    acct_unique
</span></span><span class="line"><span class="cl">    suffix
</span></span><span class="line"><span class="cl">    files
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  accounting {
</span></span><span class="line"><span class="cl">    detail
</span></span><span class="line"><span class="cl">    radutmp
</span></span><span class="line"><span class="cl">    attr_filter.accounting_response
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  session {
</span></span><span class="line"><span class="cl">    radutmp
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  post-auth {
</span></span><span class="line"><span class="cl">    Post-Auth-Type REJECT {
</span></span><span class="line"><span class="cl">      attr_filter.access_reject
</span></span><span class="line"><span class="cl">    }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">    Post-Auth-Type Challenge {
</span></span><span class="line"><span class="cl">      remove_reply_message_if_eap
</span></span><span class="line"><span class="cl">      attr_filter.access_challenge.post-auth
</span></span><span class="line"><span class="cl">    }        
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  pre-proxy {
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">  
</span></span><span class="line"><span class="cl">  post-proxy {
</span></span><span class="line"><span class="cl">    eap
</span></span><span class="line"><span class="cl">  }
</span></span><span class="line"><span class="cl">}</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="freeradius-eap-configuration" class="absolute -top-28"></div>
  FreeRadius EAP Configuration
</h2>
<p>This is the heart of the configuration, we will disable all the options and focus only on using EAP-TLS for the WiFi authentication.</p>
<p>This configuration will require that we complete the following steps</p>
<ol>
<li>
<p>Issue a certificate for this Radius Server, from the same PKI service which we will be issuing certificates to our client devices.</p>
</li>
<li>
<p>The Private Key for this issued Certificate is stored on this server</p>
</li>
<li>
<p>The Root Certificate of the chain we are issuing from (intermediate issuing servers are not required) is also available on this server</p>
</li>
<li>
<p>A working folder, to be used to host the certificates passed from the clients for verification</p>
</li>
</ol>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="create-a-certificate-for-the-radius-server"><a href="#create-a-certificate-for-the-radius-server" class="header-mark" aria-label="Header mark for 'Create a Certificate for the Radius Server'"></a>
    Create a Certificate for the Radius Server
</h3>

<p>There are a few steps to this process, Follow this guide <strong>Create PKI Certificate for Linux Server</strong> to complete the exercise, after which we should have a certificate which matches the requirements called <code>server.pem</code> (1), and a matching private key file called <code>server.key</code> (2)  to place in our <code>/etc/freeradius/certs</code> folder.</p>
<p>We need to ensure also the service has read access to this files</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">chmod <span class="m">644</span> /etc/freeradius/certs/server.pem
</span></span><span class="line"><span class="cl">chmod <span class="m">644</span> /etc/freeradius/certs/server.key</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="pki-chain-for-radius-server"><a href="#pki-chain-for-radius-server" class="header-mark" aria-label="Header mark for 'PKI Chain for Radius Server'"></a>
    PKI Chain for Radius Server
</h3>

<p>The certificates we have created for the Server and the Clients which will be authenticating to the server are all issued by the same PKI environment. To successfully validate any certificate, we will need a copy of the public keys for each server in this chain, which will be stored in Base64 format in the <code>ca.pem</code>(3) file.</p>

<h4 class="heading heading-4" id="manually-creating-the-pem-file">Manually Creating the PEM File</h4><a href="#manually-creating-the-pem-file" class="header-mark" aria-label="Header mark for 'Manually Creating the PEM File'"></a>

<p>Export all the certificates in the chain, for example <em>Root CA</em> and <em>Issuing CA</em> in turn as Base64.</p>
<p>Copy all the Certificates content into a file called <code>/etc/freeradius/ca.pem</code>, so that it looks similar to the following example - If you issue your certificates directly from your Root CA, then there will be only 1 certificate, or more typically you will have multiple issuers, implying you will have multiple to paste.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 15 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="na">-----BEGIN CERTIFICATE-----</span>
</span></span><span class="line"><span class="cl"><span class="na">MIIGRDCCBCygAwIBAgITaQAAAASav/V29nA9rgAAAAAABDANBgkqhkiG9w0BAQsF</span>
</span></span><span class="line"><span class="cl"><span class="na">....</span>
</span></span><span class="line"><span class="cl"><span class="na">.... Root CA Base64 Content</span>
</span></span><span class="line"><span class="cl"><span class="na">....</span>
</span></span><span class="line"><span class="cl"><span class="na">gQtDSbTj5kKWLuyPEWT3VepWpJ0MRIceZ/UCpf9KCkR8y9hcMEd+1/vDlFD/AJxz</span>
</span></span><span class="line"><span class="cl"><span class="na">MvZ0K7TQqxqCJ5OiB3SfH91Bc1D7Yvwn</span>
</span></span><span class="line"><span class="cl"><span class="na">-----END CERTIFICATE-----</span>
</span></span><span class="line"><span class="cl"><span class="na">-----BEGIN CERTIFICATE-----</span>
</span></span><span class="line"><span class="cl"><span class="na">MIIGRDCCBCygAwIBAgITaQAAAASav/V29nA9rgAAAAAABDANBgkqhkiG9w0BAQsF</span>
</span></span><span class="line"><span class="cl"><span class="na">....</span>
</span></span><span class="line"><span class="cl"><span class="na">.... Issuing CA Base64 Content</span>
</span></span><span class="line"><span class="cl"><span class="na">....</span>
</span></span><span class="line"><span class="cl"><span class="na">MvZ0K7TQqxqCJ5OiB3SfH91Bc1D7Yvwn</span>
</span></span><span class="line"><span class="cl"><span class="na">-----END CERTIFICATE-----</span></span></span></code></pre>
  </details>
</div>

<h4 class="heading heading-4" id="creating-pem-from-a-pfx">Creating PEM from a PFX</h4><a href="#creating-pem-from-a-pfx" class="header-mark" aria-label="Header mark for 'Creating PEM from a PFX'"></a>

<p>If we have a PFX file containing the chain of certificates, we can use openssl to create the <code>ca.pem</code> file for us</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl pkcs12 -in exported.pfx -cacerts -nokeys -chain -out ca.pem</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="dh-ciphers"><a href="#dh-ciphers" class="header-mark" aria-label="Header mark for 'DH Ciphers'"></a>
    DH Ciphers
</h3>

<p>For DH cipher suites to work, you have to run OpenSSL to create the DH file first:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-8" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-8"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl dhparam -out certs/dh <span class="m">2048</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="eap-module"><a href="#eap-module" class="header-mark" aria-label="Header mark for 'EAP Module'"></a>
    EAP Module
</h3>

<p>We begin by creating a soft link for EAP module under <code>/etc/freeradius/3.0/mods-enabled/</code></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-9" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-9"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo ln -s /etc/freeradius/3.0/mods-available/eap /etc/freeradius/3.0/mods-enabled/</span></span></code></pre>
  </details>
</div>
<p>Then change group right of <code>/etc/freeradius/3.0/mods-enabled/eap</code></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-10" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-10"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo chgrp -h freerad /etc/freeradius/3.0/mods-available/eap
</span></span><span class="line"><span class="cl">sudo chown -R freerad:freerad /etc/freeradius/3.0/mods-enabled/eap</span></span></code></pre>
  </details>
</div>
<p>Next configure the logic we need the server to follow. We will edit the file for the module <code>/etc/freeradius/mods-available/eap</code> and set the content as follows</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">conf</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 47 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-11" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-11"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="c1">############################ /etc/freeradius/mods-available/eap</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">eap</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">  <span class="n">default_eap_type</span> <span class="o">=</span> <span class="n">tls</span>
</span></span><span class="line"><span class="cl">  <span class="n">timer_expire</span> <span class="o">=</span> <span class="mi">60</span>
</span></span><span class="line"><span class="cl">  <span class="n">ignore_unknown_eap_types</span> <span class="o">=</span> <span class="n">no</span>
</span></span><span class="line"><span class="cl">  <span class="n">cisco_accounting_username_bug</span> <span class="o">=</span> <span class="n">no</span>
</span></span><span class="line"><span class="cl">  <span class="n">max_sessions</span> <span class="o">=</span> <span class="mi">4096</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="n">tls</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="n">certdir</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">confdir</span><span class="p">}</span><span class="o">/</span><span class="n">certs</span>
</span></span><span class="line"><span class="cl">    <span class="n">cadir</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">confdir</span><span class="p">}</span><span class="o">/</span><span class="n">certs</span>
</span></span><span class="line"><span class="cl">    <span class="n">private_key_password</span> <span class="o">=</span> <span class="n">S3cur3</span><span class="o">!</span><span class="mi">2021</span>
</span></span><span class="line"><span class="cl">    <span class="n">private_key_file</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">certdir</span><span class="p">}</span><span class="o">/</span><span class="n">server</span><span class="o">.</span><span class="n">key</span>
</span></span><span class="line"><span class="cl">    <span class="n">certificate_file</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">certdir</span><span class="p">}</span><span class="o">/</span><span class="n">server</span><span class="o">.</span><span class="n">pem</span>
</span></span><span class="line"><span class="cl">    <span class="n">ca_path</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">cadir</span><span class="p">}</span>
</span></span><span class="line"><span class="cl">    <span class="n">ca_file</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">cadir</span><span class="p">}</span><span class="o">/</span><span class="n">ca</span><span class="o">.</span><span class="n">pem</span>
</span></span><span class="line"><span class="cl">    <span class="n">dh_file</span> <span class="o">=</span> <span class="o">$</span><span class="p">{</span><span class="n">certdir</span><span class="p">}</span><span class="o">/</span><span class="n">dh</span>
</span></span><span class="line"><span class="cl">    <span class="n">random_file</span> <span class="o">=</span> <span class="o">/</span><span class="n">dev</span><span class="o">/</span><span class="n">urandom</span>
</span></span><span class="line"><span class="cl">    <span class="n">cipher_list</span> <span class="o">=</span> <span class="s2">&#34;HIGH&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="n">make_cert_command</span> <span class="o">=</span> <span class="s2">&#34;${certdir}/bootstrap&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="n">ecdh_curve</span> <span class="o">=</span> <span class="s2">&#34;prime256v1&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="n">tls_max_version</span> <span class="o">=</span> <span class="s2">&#34;&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="n">tls_min_version</span> <span class="o">=</span> <span class="s2">&#34;1.2&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="n">cache</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="n">enable</span> <span class="o">=</span> <span class="n">no</span> <span class="c1"># Optionally enable</span>
</span></span><span class="line"><span class="cl">      <span class="n">lifetime</span> <span class="o">=</span> <span class="mi">24</span> <span class="c1"># hours</span>
</span></span><span class="line"><span class="cl">      <span class="n">max_entries</span> <span class="o">=</span> <span class="mi">255</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="n">verify</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="n">tmpdir</span> <span class="o">=</span> <span class="o">/</span><span class="k">var</span><span class="o">/</span><span class="nb">log</span><span class="o">/</span><span class="n">freeradius</span><span class="o">/</span><span class="n">radiusd</span>
</span></span><span class="line"><span class="cl">      <span class="n">client</span> <span class="o">=</span> <span class="s2">&#34;/usr/bin/openssl verify -CAfile ${..ca_file} %{TLS-Client-Cert-Filename}&#34;</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">    <span class="n">ocsp</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">      <span class="n">enable</span> <span class="o">=</span> <span class="n">no</span> <span class="c1"># optionally enable</span>
</span></span><span class="line"><span class="cl">      <span class="n">override_cert_url</span> <span class="o">=</span> <span class="n">no</span>
</span></span><span class="line"><span class="cl">      <span class="n">url</span> <span class="o">=</span> <span class="s2">&#34;http://aez-app-prd-scep.azurewebsites.net/ocsp/&#34;</span>
</span></span><span class="line"><span class="cl">      <span class="n">softfail</span> <span class="o">=</span> <span class="n">yes</span>
</span></span><span class="line"><span class="cl">      <span class="n">timeout</span> <span class="o">=</span> <span class="mi">10</span>
</span></span><span class="line"><span class="cl">      <span class="n">use_nonce</span> <span class="o">=</span> <span class="n">no</span>
</span></span><span class="line"><span class="cl">    <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="working-folder-for-verification"><a href="#working-folder-for-verification" class="header-mark" aria-label="Header mark for 'Working folder for Verification'"></a>
    Working folder for Verification
</h3>

<p>The EAP flow utilizes <code>openssl</code> to validate the clients certificate, in order to complete this, we need to store the certificate to the file system first, and ensure that the service has access to this folder</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-12" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-12"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo mkdir /var/log/freeradius/radiusd
</span></span><span class="line"><span class="cl">sudo chown freerad:freerad /var/log/freeradius/radiusd</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="running-in-debug-mode" class="absolute -top-28"></div>
  Running in Debug mode
</h2>
<p>Our FreeRadius service is now ready to test, to make this process a lot easier, we can choose to start the service interactively in the console, and watch the debug logs.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-13" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-13"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">systemctl stop freeradius
</span></span><span class="line"><span class="cl">/usr/sbin.freeradius -x <span class="p">&amp;</span></span></span></code></pre>
  </details>
</div>
<blockquote class="blockquote">
    <p>This is a great scenario to leverage <code>tmux</code>, which will allow you have multiple sessions, and keep the session open even after you disconnect, rendering it simple to return to at a later stage</p>

</blockquote><p>With the service online, we can emulate a client connecting, and providing its client secret e.g. <em>testing123</em></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-14" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-14"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">radtest client@ullensaker.kommune.no testing123 127.0.0.1 <span class="m">0</span> testing123 -x</span></span></code></pre>
  </details>
</div>
<p>When you are satisfied that all is good, we can restart in service mode</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-15" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-15"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">systemctl start freeradius</span></span></code></pre>
  </details>
</div>
<p>Now - Get a Certificate on your test client, and WiFi gateways configured to communicate with our Radius server; and TEST!</p>
<blockquote class="blockquote">
    <h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="synchronizing-multiple-servers"><a href="#synchronizing-multiple-servers" class="header-mark" aria-label="Header mark for 'Synchronizing Multiple Servers'"></a>
    Synchronizing Multiple Servers
</h3>

<p>For production deployments, you will wish to have multiple instances of the FreeRadius server deployed. As the function of the server is primarily stateless, we really only need to synchronies the actual configuration files, to ensure all our instances are built the same.</p>
<p>The FreeRadius configuration is protected by the  root user; therefore to sync files, we need to ensure that the source permissions are respected.</p>
<p>To allow <code>rsync</code> complete this, we need to append to the <strong>sudoers</strong> file <code>/etc/sudoers</code> setup your user like this:</p>
<p><code>username ALL= NOPASSWD:/usr/bin/rsync</code></p>
<p>The <strong>NOPASSWD:/usr/bin/rsync</strong> tells sudo that when your user runs <strong>/usr/bin/rsync</strong> or just <strong>rsync</strong> that no password is needed.</p>
<p>We can try the following to sync the files from our source server using SSH based authentication.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-16" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-d2ced22b3b1c63207bb639c62cc325bb-16"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">rsync -avz -e ssh username@x.x.x.x:/etc/freeradius /etc/freeradius --rsync-path<span class="o">=</span><span class="s2">&#34;sudo rsync&#34;</span></span></span></code></pre>
  </details>
</div>

</blockquote><hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/configuring-freeradius-for-802-1x/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/configuring-freeradius-for-802-1x.gif" width="1" height="1" alt="" />]]></description></item><item><title>Extract Public and Private Keys from a PFX with OpenSSL</title><link>https://damianflynn.com/posts/extracting-certificates-from-a-pfx/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Fri, 05 Mar 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/extracting-certificates-from-a-pfx/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/extracting-certificates-from-a-pfx/hero.png" referrerpolicy="no-referrer">
            </div>
<p>Using <strong>OpenSSL</strong> we can extract the private key, and the certificate into independent file&rsquo;s, which is required for most networking devices, and linux services.</p>
<p>You will need to install the <a href="https://damianflynn.com/posts/installing-the-latest-openssl-release/" rel="">OpenSSL</a>, package, either on your system.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="export-the-private-key-from-the-pfx-file" class="absolute -top-28"></div>
  Export the private key from the PFX file
</h2>
<p>We begin, by passing in the PFX and requesting the Private key to be placed into its own file. This process will require that you provide the password which is used to protect the PFX file, and also a new password to protect the new private key file (this is not optional).</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl pkcs12 -in filename.pfx -nocerts -out PrivateKeyWithPassword.pem</span></span></code></pre>
  </details>
</div>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">output</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 3 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">Enter</span> <span class="n">Import</span> <span class="n">Password</span><span class="p">:</span> <span class="p">[</span><span class="ne">Input</span> <span class="n">the</span> <span class="k">export</span> <span class="n">password</span> <span class="n">of</span> <span class="n">the</span> <span class="n">PFX</span> <span class="ne">File</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">MAC</span> <span class="n">verified</span> <span class="n">OK</span>
</span></span><span class="line"><span class="cl"><span class="n">Enter</span> <span class="n">PEM</span> <span class="k">pass</span> <span class="n">phrase</span><span class="p">:</span> <span class="p">[</span><span class="n">Min</span> <span class="mi">5</span> <span class="n">Char</span> <span class="n">New</span> <span class="n">Temp</span> <span class="n">Password</span><span class="p">]</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="remove-the-passphrase-from-the-private-key"><a href="#remove-the-passphrase-from-the-private-key" class="header-mark" aria-label="Header mark for 'Remove the passphrase from the private key'"></a>
    Remove the passphrase from the private key
</h3>

<p>The previous step created a new password protected file, which we called <code>PrivateKeyWithPassword.pem</code> that contains only the certificates private key. In many cases, we may need to use this file, without the password protection, so the following step will generate a new private key file <code>key.pem</code></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl rsa -in PrivateKeyWithPassword.pem -out Private.key</span></span></code></pre>
  </details>
</div>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">output</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">Enter pass phrase for c:\temp\SSL\key.pem: [Min 5 Char New Temp Password]
</span></span><span class="line"><span class="cl">writing RSA key</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="export-the-public-certificate-from-the-pfx-file" class="absolute -top-28"></div>
  Export the public certificate from the PFX file
</h2>
<p>The final requirement in this typical configuration is to export the public certificate as an independent file from the PFX without the private key.</p>
<p>Similar to the previous steps, we will provide the name of the PFX and the new certificate file, for example <code>cert.pem</code>. Again as the PFX contains the private key, you need to provide the export password to allow this process to complete.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem</span></span></code></pre>
  </details>
</div>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">output</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">Enter</span> <span class="n">Import</span> <span class="n">Password</span><span class="p">:</span> <span class="p">[</span><span class="ne">Input</span> <span class="n">the</span> <span class="k">export</span> <span class="n">password</span> <span class="n">of</span> <span class="n">the</span> <span class="n">PFX</span> <span class="ne">File</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">MAC</span> <span class="n">verified</span> <span class="n">OK</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="exporting-all-cerificates-in-the-chain"><a href="#exporting-all-cerificates-in-the-chain" class="header-mark" aria-label="Header mark for 'Exporting all cerificates in the chain'"></a>
    Exporting all cerificates in the chain
</h3>

<p>When your PFX contains all the certificates in the chain, you can also export all these to the certificate file, <code>cert.pem</code> using the following command syntax.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl.exe pkcs12 -in filename.pfx -out cert.pem -nodes</span></span></code></pre>
  </details>
</div>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">output</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-8afc65201985269f44f85f2c9fd082b8-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-8afc65201985269f44f85f2c9fd082b8-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">Enter</span> <span class="n">Import</span> <span class="n">Password</span><span class="p">:</span> <span class="p">[</span><span class="ne">Input</span> <span class="n">the</span> <span class="k">export</span> <span class="n">password</span> <span class="n">of</span> <span class="n">the</span> <span class="n">PFX</span> <span class="ne">File</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">MAC</span> <span class="n">verified</span> <span class="n">OK</span></span></span></code></pre>
  </details>
</div>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/extracting-certificates-from-a-pfx/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/extracting-certificates-from-a-pfx.gif" width="1" height="1" alt="" />]]></description></item><item><title>Export a PFX from the Windows Certificate Store (MMC and PowerShell)</title><link>https://damianflynn.com/posts/creating-a-pfx-from-a-certificate-in-windows/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Thu, 04 Mar 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/creating-a-pfx-from-a-certificate-in-windows/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/creating-a-pfx-from-a-certificate-in-windows/hero.png" referrerpolicy="no-referrer">
            </div>
<p>A <code>.pfx</code> file is in essence an archive which can contain multiple objects, and can also be password protected; The format of this file is known as <em>PKCS#12</em></p>
<p>Typically, a <code>.pfx</code> usually contains one or more certificate, typically the chain of upstream authorities, and the corresponding private key. The most common usage of a PFX file is simplify certificate distribution to alternate systems or deployed to services.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="logical-stores" class="absolute -top-28"></div>
  Logical stores
</h2>
<p>Within Windows, all certificates exist in logical storage locations referred to as <strong>certificate stores</strong>.</p>
<p>Logical stores are virtual locations that map to certificate physical paths. Powershell uses the <strong>Cert</strong> PSDrive to map certificates to the physical stores.</p>
<p>Just to keep things nice and simple, Microsoft Style <em>(yes I am being sarcastic)</em> The <strong>Certificates</strong> Microsoft Management Console (MMC) logical store labeling is different from the <strong>Cert</strong> PSDrive store labeling. The table below shows the comparison between both:</p>
<table>
  <thead>
      <tr>
          <th>PS CERT: Drive</th>
          <th>Certificates MMC</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>My</td>
          <td>Personal</td>
      </tr>
      <tr>
          <td>Remote Desktop</td>
          <td>Remote Desktop</td>
      </tr>
      <tr>
          <td>Root</td>
          <td>Trusted Root Certification Authorities</td>
      </tr>
      <tr>
          <td>CA</td>
          <td>Intermediate Certification Authorities</td>
      </tr>
      <tr>
          <td>AuthRoot</td>
          <td>Third-Party Root Certification Authorities</td>
      </tr>
      <tr>
          <td>TrustedPublisher</td>
          <td>Trusted Publishers</td>
      </tr>
      <tr>
          <td>Trust</td>
          <td>Enterprise Trust</td>
      </tr>
      <tr>
          <td>UserDS</td>
          <td>Active Directory User Object</td>
      </tr>
  </tbody>
</table>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="exporting-the-certificates" class="absolute -top-28"></div>
  Exporting the Certificates
</h2>
<p>This article will guide the relatively simple steps required to extract a certificate from the logical store, and create a PFX that we can use to transport the certificate to other systems. PFX support the containment of Private Keys, and should typically be password protected to assist in securing the certificate</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="windows-certificates-mmc"><a href="#windows-certificates-mmc" class="header-mark" aria-label="Header mark for 'Windows Certificates MMC'"></a>
    Windows Certificates MMC
</h3>

<p>Using the <em>Certificates</em> Snap-In the following steps will guide to exporting the certificate to a PFX file, which we can later process with the OpenSSL tools.</p>
<ul>
<li>Start the Microsoft Management Console &gt; Run <code>mmc.exe</code></li>
<li>Click the <strong>Console</strong> menu and then click <strong>Add/Remove Snap-in</strong>.
<ul>
<li>Click the <strong>Add</strong> button and then choose the <strong>certificates</strong> snap-in and click on <strong>Add</strong>.</li>
<li>Select <strong>Certificates</strong> and click <strong>Add</strong>.</li>
<li>Select <strong>Computer Account</strong> then click <strong>Next</strong>.</li>
<li>Select <strong>Local Computer</strong> and then click <strong>OK</strong>.</li>
<li>Click <strong>Close</strong> and then click <strong>OK</strong>.</li>
</ul>
</li>
</ul>
<p>With the Snap in now loaded and focused on the <em>Local Computer Certificate Store</em>, we can locate a target <em>Certificate</em> to export.</p>
<ul>
<li>Expand the menu for <strong>Certificates</strong> and click on the <strong>Personal</strong> folder.</li>
<li>Right click on the certificate that you want to export and select <strong>All tasks</strong> &gt; <strong>Export</strong>.</li>
<li>A wizard will appear - <strong>Export Certificate</strong>
<ul>
<li>Make sure you <strong>check</strong> the box to include the <strong>private key</strong></li>
<li>You will be asked to password protect the PFX for importing</li>
<li>Continue through with this wizard until you have a <code>.PFX</code> file.</li>
</ul>
</li>
</ul>
<p>Rather simple right. You now have a <code>.pfx</code> file, which is password protected, containing your Certificate and its private key</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="powershell"><a href="#powershell" class="header-mark" aria-label="Header mark for 'Powershell'"></a>
    Powershell
</h3>

<p>The Powershell <code>PKI</code> module can be used to export or import PFX files. The following are some examples of the process</p>

<h4 class="heading heading-4" id="export-pfxcertificate">Export-PfxCertificate</h4><a href="#export-pfxcertificate" class="header-mark" aria-label="Header mark for 'Export-PfxCertificate'"></a>

<p>The <code>Export-PfxCertificate</code> cmdlet exports a certificate or to a Personal Information Exchange <code>.pfx</code> file. By default, extended properties and the entire chain are exported.</p>
<p>To export a <code>.pfx</code> certificate a password is needed for encrypting the private key.</p>
<p>In the example below, we use the <strong>Subject</strong> property to find the certificate to be exported by selecting the certificate whose Subject value equals <em>myCertificate</em></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f55356d727130aa104497ae52663d2b0-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f55356d727130aa104497ae52663d2b0-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nv">$certificate</span> <span class="p">=</span> <span class="nb">Get-ChildItem</span> <span class="n">-Path</span> <span class="n">Cert</span><span class="err">:</span><span class="p">\</span><span class="n">LocalMachine</span><span class="p">\</span><span class="n">My</span><span class="p">\</span> <span class="p">|</span> <span class="nb">Where-Object</span> <span class="p">{</span><span class="nv">$_</span><span class="p">.</span><span class="py">Subject</span> <span class="o">-match</span> <span class="s2">&#34;myCertificate&#34;</span><span class="p">}</span></span></span></code></pre>
  </details>
</div>
<p>After selecting the certificate it can be exported from its store location to a folder with the command below:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f55356d727130aa104497ae52663d2b0-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f55356d727130aa104497ae52663d2b0-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nv">$password</span><span class="p">=</span> <span class="s2">&#34;P@ssw0rd&#34;</span> <span class="p">|</span> <span class="nb">ConvertTo-SecureString</span> <span class="n">-AsPlainText</span> <span class="n">-Force</span>
</span></span><span class="line"><span class="cl"><span class="nb">Export-PfxCertificate</span> <span class="n">-Cert</span> <span class="nv">$certificate</span> <span class="n">-FilePath</span> <span class="nv">$env:USERPROFILE</span><span class="p">\</span><span class="n">Documents</span><span class="p">\</span><span class="n">myCertificate</span><span class="p">.</span><span class="py">pfx</span> <span class="n">-Password</span> <span class="nv">$password</span></span></span></code></pre>
  </details>
</div>

<h4 class="heading heading-4" id="importing-a-certificate">Importing a Certificate</h4><a href="#importing-a-certificate" class="header-mark" aria-label="Header mark for 'Importing a Certificate'"></a>

<p>The Powershell Cmdlet <code>Import-PfxCertificate</code> is used to install a <code>.pfx</code> certificate.</p>
<p>To install a PFX certificate to the current user&rsquo;s personal store, use the command below:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-f55356d727130aa104497ae52663d2b0-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-f55356d727130aa104497ae52663d2b0-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">Import-PfxCertificate</span> <span class="n">-FilePath</span> <span class="p">./</span><span class="n">PFXCertificate</span><span class="p">.</span><span class="py">pfx</span> <span class="n">-CertStoreLocation</span> <span class="n">Cert</span><span class="err">:</span><span class="p">\</span><span class="n">CurrentUser</span><span class="p">\</span><span class="n">My</span> <span class="n">-Password</span> <span class="n">P</span><span class="nv">@ssw0rd</span> </span></span></code></pre>
  </details>
</div>
<p>To install into the system personal location change the store location in the command above from <code>Cert:\CurrentUser\My</code> to <code>Cert:\LocalMachine\My</code>.</p>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/creating-a-pfx-from-a-certificate-in-windows/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/creating-a-pfx-from-a-certificate-in-windows.gif" width="1" height="1" alt="" />]]></description></item><item><title>Issue a Windows PKI Certificate to a Linux Server with OpenSSL</title><link>https://damianflynn.com/posts/create-pki-certificate-for-linux-server/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Wed, 03 Mar 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/create-pki-certificate-for-linux-server/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/create-pki-certificate-for-linux-server/hero.png" referrerpolicy="no-referrer">
            </div>
<p>It is enevitable, that at some point in time, you will need to issue a certificate for your system. There are a couple of relativly simple steps to acheive this, begining with the creation of a certificate request, then submitting this to an online certificate authority, which will process the request and issue you a certificate with both a Public and Private Key.</p>
<p>In this post, we will use the <strong><a href="https://damianflynn.com/posts/installing-the-latest-openssl-release/" rel="">OpenSSL</a></strong> utility to create such a request file, and walk trough the steps of issuing a certificate from a Windows PKI Server.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="creating-our-certificate-request" class="absolute -top-28"></div>
  Creating our Certificate Request
</h2>
<p>We will create a Certificate Request template file which defines the requirements or purpose of the certificate, optional data can be encoded into the certificate, for illustrative purposes. I will include Subject Alternate Name in the issued certificate.</p>
<blockquote class="blockquote">
    <p>In this article, the certificates we are working with are to be used in validating a computers identity. This is a common requirement when authenticating with WiFi or VPN services within the organisation</p>
</blockquote><p>The request file we create can be named as you wish, I will be using  <code>~/san.cnf</code></p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 14 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="k">[ req ]</span>
</span></span><span class="line"><span class="cl"><span class="na">default_bits</span> <span class="o">=</span> <span class="s">2048</span>
</span></span><span class="line"><span class="cl"><span class="na">distinguished_name</span> <span class="o">=</span> <span class="s">req_distinguished_name</span>
</span></span><span class="line"><span class="cl"><span class="na">req_extensions</span> <span class="o">=</span> <span class="s">req_ext</span>
</span></span><span class="line"><span class="cl"><span class="k">[ req_distinguished_name ]</span>
</span></span><span class="line"><span class="cl"><span class="na">countryName</span> <span class="o">=</span> <span class="s">Country Name (2 letter code)</span>
</span></span><span class="line"><span class="cl"><span class="na">stateOrProvinceName</span> <span class="o">=</span> <span class="s">State or Province Name (full name)</span>
</span></span><span class="line"><span class="cl"><span class="na">localityName</span> <span class="o">=</span> <span class="s">Locality Name (eg, city)</span>
</span></span><span class="line"><span class="cl"><span class="na">organizationName</span> <span class="o">=</span> <span class="s">Organization Name (eg, company)</span>
</span></span><span class="line"><span class="cl"><span class="na">commonName</span> <span class="o">=</span> <span class="s">Common Name (e.g. server FQDN or YOUR name)</span>
</span></span><span class="line"><span class="cl"><span class="k">[ req_ext ]</span>
</span></span><span class="line"><span class="cl"><span class="na">subjectAltName</span> <span class="o">=</span> <span class="s">@alt_names</span>
</span></span><span class="line"><span class="cl"><span class="k">[alt_names]</span>
</span></span><span class="line"><span class="cl"><span class="na">DNS.1</span> <span class="o">=</span> <span class="s">radius.diginerve.ie</span></span></span></code></pre>
  </details>
</div>
<p>The above is a working template - the only changes you should make to this file is the <strong>atl_names</strong> at the bottom, where these  should represent the name of the system you wish to have the certificate issued on behalf of; In my example this is <em>radius.diginerve.ie</em></p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="create-the-private-key" class="absolute -top-28"></div>
  Create the Private Key
</h2>
<p>From the computer you are wishing to create the certificate for (for example a <a href="https://damianflynn.com/posts/installing-freeradius/" rel="">Linux FreeRadius server</a>, we will generate the request for private key using the template as follows.</p>
<blockquote class="blockquote">
    <p>OpenSSL will ask some additional questions during execution</p>
</blockquote><p>The following command parameters instruct <a href="https://damianflynn.com/posts/installing-the-latest-openssl-release/" rel="">OpenSSL</a> to generate a certificate request</p>
<ul>
<li><code>req</code>: OpenSSL should generate a Certificate Request</li>
<li><code>-newkey rsa:2048</code>: The Request should be encrypted using <strong>RSA 2048</strong></li>
<li><code>-nodes</code>:</li>
<li><code>-keyout server.key</code>: The Private Key should be saved as <code>server.key</code>. This file should be protected</li>
<li><code>-out server.csr</code>: The name of the output file which containes the public shareable, encoded request we will send to the issuing server.</li>
<li><code>-config san.cnf</code>: The name of the file which we previosuly saved as the [[#Creating our Certificate Request|request template]]</li>
</ul>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 22 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl req -newkey rsa:2048 -nodes -keyout server.key -out server.csr -config san.cnf
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Generating a RSA private key
</span></span><span class="line"><span class="cl">............................+++++
</span></span><span class="line"><span class="cl">........................................................+++++
</span></span><span class="line"><span class="cl">writing new private key to <span class="s1">&#39;server.pem&#39;</span>
</span></span><span class="line"><span class="cl">-----
</span></span><span class="line"><span class="cl">You are about to be asked to enter information that will be incorporated
</span></span><span class="line"><span class="cl">into your certificate request.
</span></span><span class="line"><span class="cl">What you are about to enter is what is called a Distinguished Name or a DN.
</span></span><span class="line"><span class="cl">There are quite a few fields but you can leave some blank
</span></span><span class="line"><span class="cl">For some fields there will be a default value,
</span></span><span class="line"><span class="cl">If you enter <span class="s1">&#39;.&#39;</span>, the field will be left blank.
</span></span><span class="line"><span class="cl">-----
</span></span><span class="line"><span class="cl">Country Name <span class="o">(</span><span class="m">2</span> letter code<span class="o">)</span> <span class="o">[</span>AU<span class="o">]</span>:ie
</span></span><span class="line"><span class="cl">State or Province Name <span class="o">(</span>full name<span class="o">)</span> <span class="o">[</span>Some-State<span class="o">]</span>:Mayo
</span></span><span class="line"><span class="cl">Locality Name <span class="o">(</span>eg, city<span class="o">)</span> <span class="o">[]</span>:Ballina
</span></span><span class="line"><span class="cl">Organization Name <span class="o">(</span>eg, company<span class="o">)</span> <span class="o">[</span>Internet Widgits Pty Ltd<span class="o">]</span>:DigiNerve
</span></span><span class="line"><span class="cl">Organizational Unit Name <span class="o">(</span>eg, section<span class="o">)</span> <span class="o">[]</span>:IT
</span></span><span class="line"><span class="cl">Common Name <span class="o">(</span>e.g. server FQDN or YOUR name<span class="o">)</span> <span class="o">[]</span>:radius.diginerve.ie
</span></span><span class="line"><span class="cl">Email Address <span class="o">[]</span>:support@diginerve.ie</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="validate-the-request-file"><a href="#validate-the-request-file" class="header-mark" aria-label="Header mark for 'Validate the Request File'"></a>
    Validate the Request File
</h3>

<p>Before we take the Certificate to the PKI server to issue the certificate for the server, we can double check the request to ensure that the SAN is included as per the Template.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl x509 -in server.crt -text -noout</span></span></code></pre>
  </details>
</div>
<p>This command will read in the new certificate request file, and dump its content in a readable text format so we can validate the request is correct.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="present-the-certificate-request-to-windows-pki" class="absolute -top-28"></div>
  Present the Certificate Request to Windows PKI
</h2>
<p>With our Certificate Request file (<code>.csr</code>) now created, we will proceed to submit the request to the PKI Infrastructure which we will be requesting to issue us the certificate.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="windows-pki-infrastructure"><a href="#windows-pki-infrastructure" class="header-mark" aria-label="Header mark for 'Windows PKI Infrastructure'"></a>
    Windows PKI Infrastructure
</h3>

<blockquote class="blockquote">
    <p>This portion of the Article focuses on using a Windows PKI deployed to provide a Private Key Infrastructure within an Organisation to process the request and issue the certificate.</p>
</blockquote><p>As this article is focusing on the use of a Private Enterprise Certificate to authenticate a trusted computer access the organisations WiFi or VPN environment, we will concentrate on working with this technology to process and issue a certificate fit for purpose from the organisations infrastructure.</p>
<p>Before we begin, we do need to have a copy of the certicate request we created,  <code>server.csr</code> transferred to the system we will be operating on to process the request.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="check-the-windows-pki-server-templates"><a href="#check-the-windows-pki-server-templates" class="header-mark" aria-label="Header mark for 'Check the Windows PKI Server Templates'"></a>
    Check the Windows PKI Server Templates
</h3>

<p>Despite the fact that we created a template earlier for our certicicate to indicate that we going to concentrate on a <em>Computer</em> certificate, the Windows PKI environment premits the System Adminstrators to name the templates which it will issue certificates using to match the organisations governance standard.</p>
<p>Therefore, before we present the certificate to the Issuing server to process our request, we should first ask the Issuing Server what are the templates which it is willing to allow us to request, and what name has been associated with the various templates.</p>
<blockquote class="blockquote">
    <p>Windows PKI services follow an RBAC architecture, in which the templates that are offered will depend on the context of the request, for example its quite common to find that users are not premitted to request machine or computer certificates. These will typically be resticted to a computer or service identity.</p>
</blockquote><p>Users looking to issue a computer or machine certificate, typically are using the certicicates to protect a web site using HTTPS for transport, therefore, it is common that the only suitable template that we can choose maybe a <em>web server</em> or <em>server</em> template, from the list offered by the Issuing CA</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 11 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">certutil</span> <span class="n">-CATemplates</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">IPSECIntermediateOffline</span><span class="err">:</span> <span class="n">IPSec</span> <span class="p">(</span><span class="n">Offline</span> <span class="n">request</span><span class="p">)</span> <span class="p">--</span> <span class="nb">Auto-Enroll</span><span class="err">:</span> <span class="n">Access</span> <span class="n">is</span> <span class="n">denied</span><span class="p">.</span>
</span></span><span class="line"><span class="cl"><span class="n">CEPEncryption</span><span class="err">:</span> <span class="n">CEP</span> <span class="n">Encryption</span> <span class="p">--</span> <span class="nb">Auto-Enroll</span><span class="err">:</span> <span class="n">Access</span> <span class="n">is</span> <span class="n">denied</span><span class="p">.</span>
</span></span><span class="line"><span class="cl"><span class="n">EnrollmentAgentOffline</span><span class="err">:</span> <span class="n">Exchange</span> <span class="n">Enrollment</span> <span class="n">Agent</span> <span class="p">(</span><span class="n">Offline</span> <span class="n">request</span><span class="p">)</span> <span class="p">--</span> <span class="nb">Auto-Enroll</span><span class="err">:</span> <span class="n">Access</span> <span class="n">is</span> <span class="n">denied</span><span class="p">.</span>
</span></span><span class="line"><span class="cl"><span class="n">Administrator</span><span class="err">:</span> <span class="n">Administrator</span> <span class="p">--</span> <span class="nb">Auto-Enroll</span><span class="err">:</span> <span class="n">Access</span> <span class="n">is</span> <span class="n">denied</span><span class="p">.</span>
</span></span><span class="line"><span class="cl"><span class="n">WebServer</span><span class="err">:</span> <span class="n">Web</span> <span class="n">Server</span> <span class="p">--</span> <span class="nb">Auto-Enroll</span><span class="err">:</span> <span class="n">Access</span> <span class="n">is</span> <span class="n">denied</span><span class="p">.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">CertUtil</span><span class="err">:</span> <span class="n">-CATemplates</span> <span class="n">command</span> <span class="n">completed</span> <span class="n">successfully</span><span class="p">.</span></span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="requesting-the-certificate"><a href="#requesting-the-certificate" class="header-mark" aria-label="Header mark for 'Requesting the Certificate'"></a>
    Requesting the Certificate
</h3>

<blockquote class="blockquote">
    <p>From the list of offered Certificate templates, we are technially looking tof the template which include&rsquo;s the <strong>Server Authentication</strong> OID.
For systems which do not include templates with the <strong>Server Authentication</strong> OID in the available list, refer to the topic [[#Optional - Manually Adding the OID to the Certificate Request|Manually adding the Server Authentication OID]]</p>
</blockquote><p>In this context I will use <strong>&lsquo;Web Server&rsquo;</strong> in the request the certificate</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">certreq</span><span class="p">.</span><span class="py">exe</span> <span class="n">-attrib</span> <span class="s2">&#34;CertificateTemplate:Web Server&#34;</span> <span class="n">server</span><span class="p">.</span><span class="n">csr</span></span></span></code></pre>
  </details>
</div>
<p>A window will popup asking you to select the Certificate Authority (CA) where your request is to be submitted to, typically any of the presented servers will work fine, as long as they are approved to issue certificates based on the selected template. If the selected Certificate Authority has a problem with processing the request, try selecting an alternative, or checking within the organisation PKI support team to identify the correct server to utilize.</p>
<p>On a sucessful presentation, the <code>certreq</code> tool will present a dialog asking for where to save the new certificate. Provide a filename (for this simple example, Ill just call it <code>server</code>) and complete the wizard.</p>
<p>At this point we now have our issued certificate with ONLY its public key, stored in a file called <code>server.cer</code> which we will next need to transfer back to the system we orginally created the request on.</p>
<blockquote class="blockquote">
    <p>The Certificate we just received from the PKI server only contains the Public Key, the matching Private Key (the main secret for decrypting) is stored on the machine we created the request from initially, which in this article was called <code>server.key</code></p>
</blockquote><p>Copy the public key certificate file, &lsquo;server&rsquo; back to the machine we created the request on, in this case, it was our FreeRadius server.</p>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="optional---manually-adding-the-oid-to-the-certificate-request"><a href="#optional---manually-adding-the-oid-to-the-certificate-request" class="header-mark" aria-label="Header mark for 'Optional - Manually Adding the OID to the Certificate Request'"></a>
    Optional - Manually Adding the OID to the Certificate Request
</h3>

<blockquote class="blockquote">
    <p>This following step is only relevant if the issueing server, will not offer a template which includes the property for Server Authentication</p>
</blockquote><p>When generating certificates for use by <strong>FreeRadius EAP-TLS</strong>, This has two requirements so that the service will successfully validate the certificate.</p>
<ul>
<li>Include the &ldquo;Server Authentication&rdquo; (OID 1.3.6.1.5.5.7.3.1)</li>
<li>Include a Subject Alternate Name</li>
</ul>
<blockquote class="blockquote">
    <p><strong>802.1x</strong></p>
<p>When a client uses PEAP-EAP-MS-Challenge Handshake Authentication Protocol (CHAP) version 2 authentication, PEAP with EAP-TLS authentication, or EAP-TLS authentication, Microsoft specifies that certificates must have the &ldquo;Enhanced Key Usage&rdquo; attribute with the value &ldquo;Server Authentication&rdquo; (OID 1.3.6.1.5.5.7.3.1). [Ref.: http://support.microsoft.com/kb/814394/en-us ]</p>

</blockquote><p>If these extension are not present in your FreeRadius certificate, the auth process will fail, because the client will stop communicating with your server due that it can&rsquo;t validate your cert.</p>
<p>Since the certificate request generated in openssl according to the procedure above does not provide this attribute, it is necessary to add it to the pending request with the Windows CLI command <code>certutil</code>.</p>
<p>The general syntax is <code>certutil -setextension RequestID ExtensionOID Flags @InFile</code></p>
<ul>
<li>The <em>RequestID</em> is the sequence ID for our requested certificate from the issueing Certificate Authority</li>
<li>The <em>ExtensionOID</em> for the attribute &ldquo;Enhanced Key Usage&rdquo; is <strong>2.5.29.37</strong></li>
</ul>
<ul>
<li>The <em>flags</em> value is set to <em>0</em>.</li>
<li>For the <em>@InFile</em>, we will create an input text file <code>eku.txt</code> as follows
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">echo </span><span class="mf">30</span> <span class="n">0a</span> <span class="mf">06</span> <span class="mf">08</span> <span class="n">2b</span> <span class="mf">06</span> <span class="mf">01</span> <span class="mf">05</span>  <span class="mf">05</span> <span class="mf">07</span> <span class="mf">03</span> <span class="mf">01</span> <span class="p">&gt;</span> <span class="n">eku</span><span class="p">.</span><span class="n">txt</span></span></span></code></pre>
  </details>
</div>
</li>
</ul>
<p>Now, with all the information required, we can run the following command, Remember to replace <code>[RequestID]</code> with the actual numeric request ID</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">powershell</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="n">certutil</span> <span class="n">-setextension</span> <span class="p">[</span><span class="no">RequestID</span><span class="p">]</span> <span class="mf">2.5</span><span class="p">.</span><span class="py">29</span><span class="p">.</span><span class="py">37</span> <span class="mf">0</span> <span class="nv">@eku</span><span class="p">.</span><span class="n">txt</span></span></span></code></pre>
  </details>
</div>
<p>Once the command has completed, launch the Windows  Certification Authority application</p>
<ul>
<li>Open <strong>Pending request</strong>
<ul>
<li>Right click on the request we just modified (RequestID)</li>
<li>Select <strong>All tasks</strong> &ndash;&gt;  <strong>Issue</strong></li>
</ul>
</li>
<li>Go to <strong>Issued certificates</strong>
<ul>
<li>Locate and double-click on the one you just issued <em>[RequestID]</em>.
<ul>
<li>A window will open displaying cert&rsquo;s info.</li>
<li>Go to the tab <strong>Details</strong> and check that the field <strong>Enhanced Key Usage</strong> is present and its value is <strong>Server Authentication (1.3.6.1.5.5.7.3.1)</strong>.</li>
<li>Click on the button <strong>Copy to file&hellip;</strong> and save it as either DER encoded or Base-64 encoded
<ul>
<li>Provide a filename (let&rsquo;s call it <code>server</code>) and finish the wizard.</li>
<li>This will give you a file <code>server.cer</code>.</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Copy the public key certificate file, &lsquo;server&rsquo; back to the machine we created the request on, in this case, it was our FreeRadius server.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="verify-the-servers-certificate" class="absolute -top-28"></div>
  Verify the Servers Certificate
</h2>
<p>Back on our Linux node, with a copy of our new certificate on hand <code>server.cer</code>, we can now check that the certificate matches all the requirements we outlined at the beginning of this process</p>
<ul>
<li>Include the Servers <strong>Common name</strong>, eg <code>radius.diginerve.ie</code></li>
<li>Include the <strong>Server Authentication</strong> (OID 1.3.6.1.5.5.7.3.1)</li>
<li>Include a <strong>Subject Alternate Name</strong></li>
</ul>
<blockquote class="blockquote">
    <p>FreeRaidus expects that the public certificates be placed in the folder <code>/etc/freeradius/certs</code></p>
</blockquote><p>Using OpenSSL can view the certificate</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details">
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 50 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">root@p-nps-radius01:/etc/freeradius/certs# openssl x509 -in server.pem -text -noout
</span></span><span class="line"><span class="cl">Certificate:
</span></span><span class="line"><span class="cl">    Data:
</span></span><span class="line"><span class="cl">        Version: <span class="m">3</span> <span class="o">(</span>0x2<span class="o">)</span>
</span></span><span class="line"><span class="cl">        Serial Number:
</span></span><span class="line"><span class="cl">            51:~~~~:33
</span></span><span class="line"><span class="cl">        Signature Algorithm: sha256WithRSAEncryption
</span></span><span class="line"><span class="cl">        Issuer: <span class="nv">DC</span> <span class="o">=</span> IE, <span class="nv">DC</span> <span class="o">=</span> diginerve, <span class="nv">DC</span> <span class="o">=</span> ie, <span class="nv">CN</span> <span class="o">=</span> MY Domain CA Issuer
</span></span><span class="line"><span class="cl">        Validity
</span></span><span class="line"><span class="cl">            Not Before: Apr  <span class="m">7</span> 11:34:18 <span class="m">2021</span> GMT
</span></span><span class="line"><span class="cl">            Not After : Feb  <span class="m">1</span> 12:16:46 <span class="m">2022</span> GMT
</span></span><span class="line"><span class="cl">        Subject: <span class="nv">C</span> <span class="o">=</span> IE, <span class="nv">ST</span> <span class="o">=</span> Mayo, <span class="nv">L</span> <span class="o">=</span> Ballina, <span class="nv">O</span> <span class="o">=</span> MIS, <span class="nv">CN</span> <span class="o">=</span> radius.diginerve.ie
</span></span><span class="line"><span class="cl">        Subject Public Key Info:
</span></span><span class="line"><span class="cl">            Public Key Algorithm: rsaEncryption
</span></span><span class="line"><span class="cl">                RSA Public-Key: <span class="o">(</span><span class="m">2048</span> bit<span class="o">)</span>
</span></span><span class="line"><span class="cl">                Modulus:
</span></span><span class="line"><span class="cl">                    00:d0:6d:0d:14:5b:01:a9:4a:8a:ec:51:84:5b:6c:
</span></span><span class="line"><span class="cl">                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</span></span><span class="line"><span class="cl">                    53:87:86:a5:47:f0:81:e6:85:06:c6:96:10:ed:68:
</span></span><span class="line"><span class="cl">                    31:9d
</span></span><span class="line"><span class="cl">                Exponent: <span class="m">65537</span> <span class="o">(</span>0x10001<span class="o">)</span>
</span></span><span class="line"><span class="cl">        X509v3 extensions:
</span></span><span class="line"><span class="cl">            X509v3 Subject Alternative Name: 
</span></span><span class="line"><span class="cl">                DNS:radius.diginerve.ie
</span></span><span class="line"><span class="cl">            X509v3 Subject Key Identifier: 
</span></span><span class="line"><span class="cl">                43:35:46:D4:ED:00:89:83:F2:73:B5:6B:51:15:BB:B6:AE:7D:49:8E
</span></span><span class="line"><span class="cl">            X509v3 Authority Key Identifier: 
</span></span><span class="line"><span class="cl">                keyid:0C:21:7E:6B:1D:D6:93:BB:17:7A:55:53:88:CD:5F:5F:64:A3:83:0E
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">            X509v3 CRL Distribution Points: 
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">                Full Name:
</span></span><span class="line"><span class="cl">                  URI:ldap:///CN<span class="o">=</span>My%20Issuer,CN<span class="o">=</span>p-ie1ca-ca01,CN<span class="o">=</span>CDP,CN<span class="o">=</span>Public%20Key%20Services,CN<span class="o">=</span>Services,CN<span class="o">=</span>Configuration,DC<span class="o">=</span>pki,DC<span class="o">=</span>diginerve,DC<span class="o">=</span>ie?certificateRevocationList?base?objectClass<span class="o">=</span>cRLDistributionPoint
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">            Authority Information Access: 
</span></span><span class="line"><span class="cl">                CA Issuers - URI:ldap:///CN<span class="o">=</span>My%20Issuer,CN<span class="o">=</span>AIA,CN<span class="o">=</span>Public%20Key%20Services,CN<span class="o">=</span>Services,CN<span class="o">=</span>Configuration,DC<span class="o">=</span>pki,DC<span class="o">=</span>diginerve,DC<span class="o">=</span>ie?cACertificate?base?objectClass<span class="o">=</span>certificationAuthority
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">            X509v3 Key Usage: critical
</span></span><span class="line"><span class="cl">                Digital Signature, Key Encipherment
</span></span><span class="line"><span class="cl">            1.3.6.1.4.1.311.21.7: 
</span></span><span class="line"><span class="cl">                0..<span class="p">&amp;</span>+.....7.....j...#...........,<span class="p">&amp;</span>...?......d...
</span></span><span class="line"><span class="cl">            X509v3 Extended Key Usage: 
</span></span><span class="line"><span class="cl">                TLS Web Server Authentication
</span></span><span class="line"><span class="cl">            1.3.6.1.4.1.311.21.10: 
</span></span><span class="line"><span class="cl">                0.0
</span></span><span class="line"><span class="cl">..+.......
</span></span><span class="line"><span class="cl">    Signature Algorithm: sha256WithRSAEncryption
</span></span><span class="line"><span class="cl">         ab:7f:d6:12:80:f7:fe:d6:d9:44:f8:1a:fc:fb:91:2d:eb:05:
</span></span><span class="line"><span class="cl">         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</span></span><span class="line"><span class="cl">         b1:f2:ae:a5</span></span></code></pre>
  </details>
</div>
<p>Search for the following to be present and correct</p>
<ul>
<li><strong>Subject:</strong> and check it,</li>
<li>Next, Locate the <strong>X509v3 Subject Alternative Name:</strong> and ensure it exists and is correct,</li>
<li>Finally, <strong>X509v3 Extended Key Usage</strong> should contain <em>TLS Web Server Authentication  1.3.6.1.4.1.311.21.10</em></li>
</ul>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="freeradius-compatability"><a href="#freeradius-compatability" class="header-mark" aria-label="Header mark for 'FreeRadius Compatability'"></a>
    FreeRadius Compatability
</h3>

<blockquote class="blockquote">
    <p>FreeRadius does not work with <strong>DER Encoded Certificates</strong>, these must be instead in <strong>Base64</strong> format to function</p>
</blockquote><p>If necessary, we may have to convert our certifcate from <strong>DER Encoding</strong> to <strong>Base64 Encoding</strong>. This can be completed using the <code>openssl</code> tool with the following syntax:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-71402ab2e65035fdb8f3838032199545-8" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-71402ab2e65035fdb8f3838032199545-8"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl x509 -inform DER -in server.cer -outform PEM -out server.pem</span></span></code></pre>
  </details>
</div>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/create-pki-certificate-for-linux-server/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/create-pki-certificate-for-linux-server.gif" width="1" height="1" alt="" />]]></description></item><item><title>Build and Install the Latest OpenSSL on Ubuntu</title><link>https://damianflynn.com/posts/installing-the-latest-openssl-release/?utm_source=rss&amp;utm_medium=feed</link><pubDate>Tue, 02 Mar 2021 00:00:00 +0000</pubDate><author><name>damian</name></author><guid>https://damianflynn.com/posts/installing-the-latest-openssl-release/</guid><description><![CDATA[<div class="featured-image">
                <img src="https://damianflynn.com/posts/installing-the-latest-openssl-release/hero.png" referrerpolicy="no-referrer">
            </div>
<p>Being over 25 years old, OpenSSL can be found on just about any system you work with today; but this does not imply that the version installed is current (or even close).</p>
<p>During its life, there have been many instances where OpenSSL has been in the news, where some new vulnerability has being discovered, and quickly after, patched.</p>
<p>The Swiss Army Knive of SSL Certificate&rsquo;s, this is a tool that everyone should have at least used once in their administrative duties.</p>
<p>To check if OpenSSL is on your system, and more importantly, the version installed, we can use the following simple command.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-0" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-0"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">openssl version</span></span></code></pre>
  </details>
</div>
<p>In my case “OpenSSL 1.1.1 ” was the result.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="installing-the-current-release" class="absolute -top-28"></div>
  Installing the Current Release
</h2>
<p>We will go directly to the <a href="https://openssl.org" target="_blank" rel="noopener noreferrer">OpenSSL</a> distribution source, and download the current stable version, which at the time of writing is now <strong>openssl-1.1.1k</strong>  and save it into <code>~/Downloads</code> directory:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-1" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-1"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="nb">cd</span> ~/Downloads
</span></span><span class="line"><span class="cl">wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz</span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="create-working-folder"><a href="#create-working-folder" class="header-mark" aria-label="Header mark for 'Create Working Folder'"></a>
    Create Working Folder
</h3>

<p>We will install the new version at <code>/opt/openssl</code>. To do that we need to create and change directory</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-2" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-2"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo mkdir /opt/openssl
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> /opt/openssl</span></span></code></pre>
  </details>
</div>
<p>Extract the downloaded compressed file into this directory:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-3" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-3"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo tar xfzv ~/Downloads/openssl-1.1.1k.tar.gz --directory /opt/openssl
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> /opt/openssl</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="configure-the-build" class="absolute -top-28"></div>
  Configure the Build
</h2>
<p>Before we proceed to compile the utility, we first must set some of the configuration settings, which will be used to let OpenSSL know where it is to be installed, and what folder it can use for its working space.</p>
<p>The is quite trivial, as we use the provide <code>config</code> script and pass in the parameters required. We are running this with <em>sudo</em> to ensure the script can check the system for dependencies and create any folders necessary.</p>
<p>The folders I will be using for the installation include</p>
<ul>
<li><code>/opt/openssl</code> as the home directory and</li>
<li><code>/opt/openssl/ssl</code> as the directory where OpenSSL will store certificates and private keys.</li>
</ul>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-4" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-4"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo ./config --prefix<span class="o">=</span>/opt/openssl --openssldir<span class="o">=</span>/opt/openssl/ssl </span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="building-and-installing-openssl" class="absolute -top-28"></div>
  Building and Installing OpenSSL
</h2>
<p>With the configuration complete, we now can use the <em>Makefile</em> which has just being customized, to build, and then install the new version of OpenSSL. Depending on the speed of your system this can take some time to complete.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-5" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-5"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo make 
</span></span><span class="line"><span class="cl">sudo make install</span></span></code></pre>
  </details>
</div>
<p>Congratulations, OpenSSL current version is installed.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="multiple-instances" class="absolute -top-28"></div>
  Multiple Instances
</h2>
<p>Wait - we do have a small issue. Right now there are two installations of OpenSSL on your system:</p>
<ul>
<li>The original installation</li>
<li>and this New Current release we built from source.</li>
</ul>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="swapping-the-binaries" class="absolute -top-28"></div>
  Swapping the Binaries
</h2>
<p>I won’t delete the original version, instead I will simply rename it to <em>openssl.old</em>, keeping this in the original installation path location.</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-6" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-6"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo mv /usr/bin/openssl /usr/bin/openssl.old </span></span></code></pre>
  </details>
</div>
<blockquote class="blockquote">
    <p>In the literature there are references to applications that expect openssl to be at the original directory. To maintain compatibility, and avoiding the need to alter the environment variable PATH, we will create a symbolic link <code>/usr/bin/openssl</code> pointing to <code>/opt/openssl/bin/openssl</code></p>
</blockquote><p>We simply link the new build to the original folder, as follows:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 2 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-7" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-7"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo ln -s /opt/openssl/bin/openssl /usr/bin/openssl
</span></span><span class="line"><span class="cl">ls -lisah /usr/bin/openssl</span></span></code></pre>
  </details>
</div>
<p>The <code>ls</code> command above, just offers up a view to ensure that the symbolic link was established from the original path to our new installation.</p>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="setting-the-module-library" class="absolute -top-28"></div>
  Setting the Module Library
</h2>
<blockquote class="blockquote">
    <p>OpenSSL is a dependency for a lot of different applications, therefore we should complete the installation, by updating the module library configuration to ensure any application we deploy will find and use this release.</p>
</blockquote><p>Modify the module loader configuration in <code>/etc/ld.so.conf.d/openssl.conf</code>, open the file and edit it using <code>vi /etc/ld.so.conf.d/openssl.conf</code> so that it reads as follows</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">ini</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-8" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-8"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl"><span class="na">/opt/openssl/lib</span></span></span></code></pre>
  </details>
</div>
<p>Now, reload the modules</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-9" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-9"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo ldconfig </span></span></code></pre>
  </details>
</div>
<h3 class="text-xl font-bold text-secondary-500 leading-tight mb-2" id="sanity-check"><a href="#sanity-check" class="header-mark" aria-label="Header mark for 'Sanity Check'"></a>
    Sanity Check
</h3>

<p>And finally, we can verify that everything is correct</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 3 lines</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-10" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-10"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">which openssl
</span></span><span class="line"><span class="cl">openssl version
</span></span><span class="line"><span class="cl">openssl</span></span></code></pre>
  </details>
</div>
<h2 class="relative text-3xl font-bold leading-tight text-secondary-500 mb-2 mt-12 -ml-px">
  <div id="clean-up" class="absolute -top-28"></div>
  Clean up
</h2>
<p>Reboot your system to make things permanent and execute the last three commands again, targeting, obviously, the same outcome.</p>
<p>By now you have OpenSSL new version installed and working correctly. But if you try to download any of the previous files, for instance <code>openssl-1.1.1k.tar.gz</code>, you will get the following error:</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">error</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-11" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-11"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">The Certificate Authority “Let’s Encrypt Authority X3” that issued the server certificate is not in OpenSSL certificate and private key directory */opt/openssl/ssl*.</span></span></code></pre>
  </details>
</div>
<p>If this is the desired behavior skip what follows and you have <strong>OpenSSL 1.1.1k</strong> completely installed.</p>
<p>If this is not your desired behavior, you can copy all certificates in <code>/etc/ssl/certs/</code> to <code>/opt/openssl/ssl/certs</code>. However I prefer a slightly different approach, simply linking by making <code>/opt/openssl/ssl/certs</code> a symbolic link pointing <code>/etc/ssl/certs/</code> files.</p>
<p>To Implement the preferred approach, issue the following command</p>
<div class="code-block highlight show-line-numbers  my-2">
  <details class="code-block-details" open>
    <summary class="code-block-title ">
      <span class="code-block-label">bash</span>
      <span class="code-block-toggle"><span class="code-block-show">Show</span><span class="code-block-hide">Hide</span> 1 line</span>
      <span class="code-block-status" role="status" aria-live="polite"></span>
      <button type="button" class="code-block-copy" data-code-target="codeblock-id-c6323f9dbd6afaf179440fa275d302da-12" hidden>Copy code</button>
      <span class="code-block-chevron" aria-hidden="true">⌄</span>
    </summary>
    <pre style="counter-reset: codeblock;" class="block"><code
      id="codeblock-id-c6323f9dbd6afaf179440fa275d302da-12"
      class="chroma block code-block-content ease-in-out"><span class="line"><span class="cl">sudo ln -s /etc/ssl/certs/. /opt/openssl/ssl/certs/</span></span></code></pre>
  </details>
</div>
<hr>
<!-- enrich:containment -->
<p><em>Part of: damianflynn</em></p>
<p><a href="https://damianflynn.com/posts/installing-the-latest-openssl-release/?utm_source=rss&amp;utm_medium=feed">Read the full post on Incredible Technology, Incredibly Simple</a></p><img src="https://damianflynn.com/pulse/p/installing-the-latest-openssl-release.gif" width="1" height="1" alt="" />]]></description></item></channel></rss>