, Mark Joseph Colibao, home

What OIDC federation is, and why it removes deploy secrets

How a trust between GitHub and Microsoft Entra ID replaces a client secret with short-lived tokens, which objects hold that trust, and how long the tokens last.

Written 3 min read

A CI/CD pipeline has to sign in to the cloud before its deploy step can run. The old way is a client secret: a long-lived password for a service principal, saved in the pipeline's secrets. It works from anywhere, for anyone who has it, until it expires.

OIDC federation (workload identity federation, in Microsoft's words) swaps that password for trust between two identity systems, so there is no password to leak.

A GitHub token traded for an Azure token
  1. 1GitHub OIDC tokenGitHub, once per job

    iss
    https://token.actions.githubusercontent.com
    aud
    api://AzureADTokenExchange
    sub
    repo:<owner>@<owner-id>/<repo>@<repo-id>:ref:refs/heads/main

    A short expiry in its exp claim. It only proves who is asking.

  2. 2Federated credentialMicrosoft Entra ID

    signature
    Checked against GitHub's published keys
    issuer
    The same
    audience
    The same
    subject
    The same, exactly

    One exact issuer, subject and audience. No wildcards.

  3. 3Azure access tokenMicrosoft Entra ID

    lives
    60 to 90 minutes by default (75 on average)
    used by
    The Azure CLI, for the rest of the job

    GitHub describes it as valid for one job only.

The token flow

  1. The job asks GitHub. A job with id-token: write requests a token from GitHub's OIDC provider, https://token.actions.githubusercontent.com.
  2. GitHub signs a JWT. It describes the run: repository, branch or environment, workflow.
  3. The login action hands it to Microsoft Entra ID. Entra ID checks the signature against GitHub's published keys, then compares the issuer, audience and subject with a federated credential. The match is exact.
  4. Entra ID returns an Azure access token. The Azure CLI uses it for the rest of the job.

How long each token lives

TokenMade byLives
GitHub OIDC token (JWT)GitHub, once per jobA short expiry in its exp claim. It only proves who is asking.
Azure access tokenMicrosoft Entra ID60 to 90 minutes by default (75 on average). GitHub describes it as valid for one job only.

What's in the token

ClaimExampleMeaning
isshttps://token.actions.githubusercontent.comWho issued it
audapi://AzureADTokenExchangeWho it's meant for
subrepo:<owner>@<owner-id>/<repo>@<repo-id>:ref:refs/heads/mainWhich run is asking

The sub (subject) is the one that matters. It's what stops a workflow in another repository, or on another branch, from using your trust. Since 15 July 2026, new repositories (and, per Microsoft, renamed or transferred ones) put the owner and repository IDs in it. Those IDs are never reused, so a new repository with an old name can't match an old trust. Older repositories send names only (repo:<owner>/<repo>:...) until they opt in.

The objects that hold the trust

  • App registration (application object): the app's definition and its client ID. The federated credential lives here.
  • Service principal: the app's instance in your tenant, listed under Enterprise applications. Azure roles are given to it.
  • Federated credential: one exact issuer, subject and audience. Up to 20 per app, no wildcards.

You can put the federated credential on a user-assigned managed identity instead:

App registrationUser-assigned managed identity
Lives inMicrosoft Entra IDAn Azure resource group
To set it up you needApplication Developer to register it; app owner, Application Administrator or Cloud Application Administrator to add the credentialContributor or Owner
Federated credentialsUp to 20Up to 20
In the workflowIts client IDIts client ID

Rights decide it more than features do: pick the managed identity if you can create Azure resources but not register apps in Entra ID.

What it fixes, and what it doesn't

  • No password is stored in GitHub or anywhere else.
  • Both tokens are made for one job and expire long before a secret would.
  • The trust names one repository and one branch or environment, so a copy of the workflow somewhere else is refused.
  • There's no secret to rotate and no expiry date to remember.

The identity still needs roles, as narrow as the deploy allows, and anyone who can push to the trusted branch can deploy. Protect that branch.

The same pattern (a trusted issuer, a matching subject, a token exchange) also connects GitHub to AWS and Kubernetes workloads to Azure. For the hands-on steps, see Passwordless deploys with GitHub Actions and OIDC.

Sources