Home› Blog› Week 15 — The Golden Path: 64 Seconds From Push to…
Azure Weekly Lab Azure Terraform

Week 15 — The Golden Path: 64 Seconds From Push to Running, With No Credential Anywhere

Three handoffs between a commit and a running container normally carry three credentials. This week removes all of them, and the proof is not that the pipeline works — it is that the easy credential no longer exists.

Verified against current vendor documentation on 29 November 2026. Pricing, limits and API behaviour were checked against the official docs on that date. Cloud services change fast — if you are reading this much later, treat the specifics as a starting point and re-check the linked sources.
Container Apps Container Registry GitHub Actions OIDC Managed Identity Terraform
Azure Platform Engineering Lab · Week 15 of 52

📋 In This Post

Lab Overview

The problem. "Developers should self-serve" usually means a pipeline somebody wired up once, and that pipeline holds credentials: a service principal secret in repository secrets, a registry password in a login step, registry credentials in the application's own configuration. Each is a long-lived string that has to be stored, rotated and eventually explained to an auditor.

The objective. Build the path from commit to running container so that no credential exists at any of those three handoffs, measure how long the path takes, and — the part that actually matters — prove the alternative is closed rather than merely unused.

The outcome. Twelve Terraform resources, nine validation checks passing, and 64 seconds from git push to the new content being served. The registry's admin account does not exist, so there is no password for a pipeline to hold.

Cloud Services and Concepts

ServicePurpose hereWhat it is
Azure Container Registry (Basic) Stores the image the pipeline builds A private registry. Basic includes 10 GiB and supports Entra authentication; it bills a flat daily rate for existing
Azure Container Apps (Consumption) Runs the image and gives it an HTTPS endpoint Serverless containers billed per vCPU-second and per request, with a monthly free grant and no charge at zero replicas
Federated identity credential Lets GitHub authenticate without a stored secret A trust rule on an Entra app registration: "accept a token from GitHub, for this repository, on this branch". No password exists to leak
User-assigned managed identity Lets the running app pull its own image An Azure identity with no credential attached, granted only AcrPull
Repository variables Carry the client, tenant and subscription IDs Not secrets. A client ID grants nothing without a token Entra will mint only for this repo and branch

One distinction worth making early. A secret is something you hold that proves who you are. A token is something issued to you, on the spot, because of what you already are. Everything in this week replaces the first with the second.

Architecture and Workflow

Architecture diagram. On the left, a GitHub Actions workflow. On the right, an Azure boundary containing Microsoft Entra ID, an Azure Container Registry on the Basic tier with its admin account disabled, and the orders container app with a user-assigned managed identity attached. The workflow authenticates to Entra with a federated OIDC token minted per run for this repository and branch, holding no stored secret. It pushes the image it built to the registry using that same token, so no registry username or password is involved. The running container app pulls its image from the registry as its own managed identity, which holds only the AcrPull role, so the application cannot publish images.
Three arrows, no credentials. The app can pull but not push; the pipeline can push but is not the app.
  1. A developer pushes a change under app/.
  2. GitHub mints an OIDC token naming this repository and branch, and azure/login exchanges it with Entra.
  3. az acr login exchanges that same token for a registry refresh token — no docker login with a password.
  4. The image is built with the commit SHA baked into the page it serves, and pushed.
  5. az containerapp update points the app at the new tag.
  6. The app pulls that image as its own managed identity and the new revision starts serving.

Three design decisions.

Two identities, not one. The application's identity holds AcrPull and nothing else; the pipeline's holds AcrPush and Contributor on one container app. Collapsing them would mean anything that could read the running app's token could also publish images to the registry.

Terraform does not own the image. The app is created pointing at a bootstrap image, and ignore_changes on that field hands it to the pipeline. Without it every terraform apply would revert the app and the two systems would fight over one field forever. Platform owns the shell; the pipeline owns what runs in it.

The CI role is scoped to the single app, not to the resource group. Its job is to change an image, not to create resources next to one.

Prerequisites

  • An Azure subscription where you hold Owner, and a tenant where you can create an app registration.
  • Resource providers: Microsoft.App, Microsoft.ContainerRegistry, Microsoft.OperationalInsights, Microsoft.ManagedIdentity.
  • Terraform >= 1.10, azurerm ~> 5.2, azuread ~> 3.0, GitHub CLI.
  • A GitHub repository you can set variables on. No secrets are needed, which is the point.
  • Cross-week dependency, and a correction. Week 08's Log Analytics workspace was recorded as staying up; it is gone. This week creates its own, and would have had to anyway — see Troubleshooting.

Implementation

1. Enumerate what can bill, before deploying

Terminal card showing the price check for week 15 listing flat recurring meters including Basic Registry Unit at 0.1666 per day and three Container Apps meters at 0.10 per hour, all acknowledged in meters.json
The registry is the standing charge. The three $0.10/hour lines are the trap.

2. Build the platform, with no admin account on the registry

resource "azurerm_container_registry" "acr" {
  name          = "acrwk15devscus001"
  sku           = "Basic"
  admin_enabled = false        # half the claim, not a hardening detail
}

resource "azurerm_container_app" "app" {
  # ...
  registry {
    server   = azurerm_container_registry.acr.login_server
    identity = azurerm_user_assigned_identity.app.id   # no username, no password
  }

  lifecycle {
    ignore_changes = [template[0].container[0].image]  # the pipeline owns this
  }
}
Terminal card showing terraform apply for week 15 in two passes: twelve resources planned, nine created before the provider rejected the container app environment because logs_destination was not set, then a second apply adding the remaining three resources with Apply complete
Two passes. The provider refused the environment until logs_destination was stated alongside the workspace ID.

3. Trust GitHub, without giving it anything to hold

resource "azuread_application_federated_identity_credential" "branch" {
  application_id = azuread_application.ci.id
  audiences      = ["api://AzureADTokenExchange"]
  issuer         = "https://token.actions.githubusercontent.com"
  subject        = var.federated_subject   # built from GitHub's own IDs
}

There is no azuread_application_password in that file and there is not meant to be.

Terminal card showing the registry with adminUserEnabled false on the Basic tier, an empty gh secret list for the repository, and three repository variables for client ID, subscription ID and tenant ID
No admin account on the registry, no Actions secrets in the repo — three variables, none of them a credential.

4. Push a commit and let the path run

GitHub Actions run page showing the Golden path workflow triggered by a push on main from commit 317e8ed, status Success, total duration 41 seconds, with a single deploy job taking 37 seconds
Triggered by the push, not by hand: 41 seconds in GitHub, of which the deploy job is 37.

Validation and Evidence

TestExpectedActualStatus
Registry on BasicBasicBasic, $0.1666/dayPass
Registry admin account disabledfalsefalsePass
App identity holds AcrPullone assignmentAcrPullPass
App pulls by identity, no usernameusername emptyidentity set, username: ""Pass
CI app has no secrets0 passwords, 1 federatedsecrets=0, federated=1Pass
Repository holds no Actions secrets00Pass
Revision serves a pipeline-built imagethe pushed tagorders:317e8edPass
Page names its build committhe pushed SHAbuild: 317e8edPass
Admin credentials cannot be retrievedrefusedrefusedPass
Terminal card showing the container app running image orders colon 317e8ed, the matching registry digest, the served page reading build 317e8ed and deployed by a push with no human in the loop, and the app's registry configuration with an identity set and an empty username
Push at 14:24:52Z, new content at 14:25:56Z. The commit, the tag and the served page are one chain.

What that measures, precisely. 64 seconds is wall-clock from git push to the endpoint returning the new page, including the runner starting, a container build, a registry push and a revision rollout. It is one sample on a tiny image; a real application's build dominates it.

The control

Terminal card showing az acr credential show refusing with an instruction to enable admin first, and a docker login with the admin username being refused as unauthorized by the registry
The pipeline working shows one door opens. This shows the other is shut.

A pipeline that succeeds while the admin account is still enabled has demonstrated that one of two available doors was used. The demo looks identical either way. Only the refusal distinguishes them.

Security and Cost

What is closed. No stored secret authenticates GitHub to Azure, no registry password exists, and the application holds only AcrPull — it can run an image but cannot publish one. The federated credential names one repository and one branch, so a fork or another branch cannot assume the identity.

What production adds. Image provenance: nothing here signs the image or records what went into it, so "the pipeline built it" is an assertion about a mutable tag. A real golden path attaches an SBOM and a signature at build and verifies them at deploy. Also a retention policy on the registry — untagged manifests accumulate and bill beyond the included 10 GiB, and that policy is a Premium feature.

Cost, and it inverts the previous week. Week 14's risk was per-hour compute bounded only by a clock. This week has exactly one standing charge:

ComponentRate
Container Registry, Basic$0.1666/day, flat
Container Apps, Consumption$0.00 here — inside the monthly free grant, and zero at zero replicas
Log Analyticscapped at 0.5 GB/day in Terraform

The registry bills because it exists, not because an image is pushed or pulled — and about $5 a month is small enough never to be noticed on an invoice, which makes a missed teardown worse here than somewhere expensive. Charges to 29 November: $0.0457. The final measured figure is read from the bill a day after teardown and this post is updated then.

The $72/month mistake available this week. Three meters sit at $0.10/hour. A Consumption-only environment pays none of them — but Microsoft's billing page states that private endpoints and planned maintenance attract the Dedicated plan management charge regardless of plan. So keeping this environment public is a costed decision, and private networking belongs to its own week.

Troubleshooting and Lessons

GitHub refused the workflow as possibly malicious.

  • Problem. Every run, push and manual alike, completed in under a second with action_required and zero jobs.
  • Root cause. A step printed ${{ toJSON(secrets) }} through a shell command to show the context was empty. That is the shape used to exfiltrate secrets, and a scanner cannot distinguish a demonstration from the real thing.
  • Resolution. Removed. Absence is proved from outside, by asking GitHub for the repository's secret list.
  • Lesson. It was also wrong on its own terms: had a secret existed, that expression would have expanded its value onto a command line. Demonstrating the absence of a credential must not use the technique for stealing one.

AADSTS700213, and a check that asked the wrong question.

  • Problem. Login failed: no matching federated identity record found for presented assertion subject.
  • Root cause. GitHub sends an immutable subject carrying numeric IDs — repo:owner@63027619/repo@1342954118:ref:refs/heads/main — not the documented repo:owner/name form. The deploy script had checked whether a custom subject claim was configured, found none, and concluded the documented form applied.
  • Resolution. The subject is now built from gh api users/<owner> .id and gh api repos/<repo> .id, and the script refuses to guess if either lookup fails.
  • Lesson. The default is the immutable form, so the absence of a customisation proved nothing. A check that returns reassurance from the wrong question is worse than no check.

The provider refuses a workspace ID on its own. log_analytics_workspace_id can only be set when logs_destination is also set. That error also settled a cross-week question: this destination authenticates with the workspace's shared key, so week 08's workspace — built with local authentication disabled — could never have been reused here.

The teardown reported Azure empty while an identity was still live. terraform destroy hit Directory_ConcurrencyViolation removing the federated credential and exited 1. Every Azure resource count was zero; the Entra app registration was not, because it lives in the tenant rather than the resource group. A cleanup that trusted its own exit code, or counted only inside the group, would have called it finished.

Cleanup and Key Takeaways

Terminal card showing the week 15 teardown: all Azure counts zero but CI app registrations at one, the Directory ConcurrencyViolation error from terraform destroy, a retry destroying two resources, and a final run with every count including app registrations at zero
The first attempt looked clean from inside the resource group. It was not.

Takeaways.

  1. Prove the door is shut, not that a key works. The pipeline succeeding says nothing about credentials until the admin account is gone.
  2. Split the identities. Pull and push are different privileges; one identity for both hands a running workload the ability to publish.
  3. Decide who owns the image field. Terraform owning the platform and the pipeline owning the image is the whole mechanism behind "no platform engineer in the loop".
  4. Count outside the resource group. Entra objects outlive it, and a destroy's exit code is not evidence.
  5. A flat daily meter is the easy one to forget. $5 a month hides on an invoice in a way $300 a month does not.

Repository: week-15-golden-path

References

Comments

How was your experience?
Your feedback helps improve this site.
PoorExcellent