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.
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.
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.
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.
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
- The job asks GitHub. A job with
id-token: writerequests a token from GitHub's OIDC provider,https://token.actions.githubusercontent.com. - GitHub signs a JWT. It describes the run: repository, branch or environment, workflow.
- 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.
- Entra ID returns an Azure access token. The Azure CLI uses it for the rest of the job.
How long each token lives
| Token | Made by | Lives |
|---|---|---|
| GitHub OIDC token (JWT) | GitHub, once per job | A short expiry in its exp claim. It only proves who is asking. |
| Azure access token | Microsoft Entra ID | 60 to 90 minutes by default (75 on average). GitHub describes it as valid for one job only. |
What's in the token
| Claim | Example | Meaning |
|---|---|---|
iss | https://token.actions.githubusercontent.com | Who issued it |
aud | api://AzureADTokenExchange | Who it's meant for |
sub | repo:<owner>@<owner-id>/<repo>@<repo-id>:ref:refs/heads/main | Which 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 registration | User-assigned managed identity | |
|---|---|---|
| Lives in | Microsoft Entra ID | An Azure resource group |
| To set it up you need | Application Developer to register it; app owner, Application Administrator or Cloud Application Administrator to add the credential | Contributor or Owner |
| Federated credentials | Up to 20 | Up to 20 |
| In the workflow | Its client ID | Its 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
- Workload identity federation (Microsoft Learn)
- OpenID Connect concepts (GitHub Docs)
- Immutable GitHub subjects (Microsoft Learn)
- Access tokens: default lifetime (Microsoft Learn)
- App and service principal objects (Microsoft Learn)
- Trust GitHub from an app registration (Microsoft Learn)
- Trust GitHub from a managed identity (Microsoft Learn)
- Federated credential limits (Microsoft Learn)