Skip to content

Platform automation and DevOps

Microsoft's design area: Platform automation and DevOps.

What this area is

How platform changes get into Azure. The landing zone is a product. It has a backlog, a pipeline, a test, and a way to preview a change. Subscription vending is one of those pipelines. So is policy.

What an enterprise does

  • One repository (or a small set) for the platform. Application teams do not edit the hub.
  • Pull requests. CI compiles the templates and runs policy what-if. A protected branch deploys with a workload identity: federated credential from GitHub Actions or Azure DevOps to Entra, no client secret stored in the forge.
  • Separate pipelines, or at least separate jobs, for management groups, connectivity, and vending. The identity that can edit connectivity cannot create subscriptions, and the identity that vends subscriptions cannot edit the firewall.
  • What-if on every apply. Deployment stacks or an equivalent when the team wants a delete of a removed resource to be intentional.
  • The accelerator (Bicep AVM or Terraform) is the starting point, with the organisation's parameter file on top, not a fork of every module.

What this lab implements

  • This repository is the source of truth. If it is not in Git, it is not part of the lab, including a resource created in the portal.
  • Pull requests are required by CONTRIBUTING. CI (.github/workflows/bicep-ci.yml) installs Bicep 0.49.2, runs scripts/build-and-lint.sh, and prints the what-if commands. It does not log on to Azure and it has no secrets.
  • scripts/print-what-if.sh is the list of az deployment commands. Run what-if, read it, then create.
  • Parameter files are checked in. CI fails if they set deployAzureFirewall, deployVpnGateway, deployBastion, deployDdosPlan, or confirmExpensiveSpend to true.
  • The vending module is the shape of a vending pipeline. It is not a pipeline.

What this lab simplifies

  • No deploy workflow is active. The example at .github/workflows/deploy-oidc.yml.example is not run by GitHub because the filename ends in .example. Move it to a .yml name only after the federated credential exists.
  • No deployment stacks, no approvals environment, no policy exemption workflow.
  • No module restored from br/public. ADR 006.

Federated credential, when you want a deploy workflow later

Do this in the tenant. Do not commit a secret. Client id, tenant id, and subscription id are identifiers. Put them in GitHub Actions variables, not secrets.

  1. Entra app registration, single tenant. No client secret. No certificate.
  2. Federated credential: issuer https://token.actions.githubusercontent.com, audience api://AzureADTokenExchange, subject repo:<org>/<repo>:ref:refs/heads/main (or an environment subject if you add a protected environment).
  3. Azure RBAC for that app's service principal, on Azure subscription 1 only. Contributor is wider than this lab's pipeline needs and is the wrong habit to take to a client. For a future lab deploy of infra/main.bicep, a custom role close to "ALZ Lab Landing Zone Operator" plus rights to assign the lab's own policy and budgets is the discussion to have in a PR. Do not grant Owner, and do not grant User Access Administrator, unless that pipeline must assign roles.
  4. Management group deploys need a role on the alz group (Management Group Contributor is the built-in that fits), not Contributor on the subscription.
  5. azure/login@v2 with client-id, tenant-id, and subscription-id from variables, permissions: id-token: write on the job. Then az deployment sub what-if. Add create only after what-if has been boring for a while.

The example workflow file shows the login and the what-if. It does not show a create step, on purpose.

Where the code is

  • .github/workflows/bicep-ci.yml
  • .github/workflows/deploy-oidc.yml.example
  • scripts/build-and-lint.sh
  • scripts/print-what-if.sh
  • ADR 001, ADR 006