Workload Identity Federation: Kill Long-Lived Secrets
How workload identity federation lets GitHub, GitLab, AKS, AWS and GCP reach Azure via Entra with no stored secrets, plus guardrails and a 12-week plan.
Take any valid cloud secret that leaked into a public GitHub commit in 2022. The odds are that it still works. GitGuardian's State of Secrets Sprawl 2026 tracked the valid secrets it detected in 2022 and found that four years later 64% were still active and exploitable. In 2025 alone it counted 28,649,024 new secrets in public commits, up 34% on the year before. Most are not passwords people chose. They are keys machines use: cloud access keys, service principal secrets, tokens in pipeline variables.
The fix is now available everywhere you need it. Workload identity federation lets a GitHub job, a GitLab pipeline, a Kubernetes pod or an AWS role prove who it is with a token its own platform signs. Microsoft Entra ID exchanges that token for a short-lived access token, and nothing is stored. The last big gap closed in November 2025, when AWS shipped outbound identity federation. This article is for the people who decide whether to finish the job: CTOs, CISOs, platform leads and cloud architects. We show the trust graph, the configuration details that decide whether it is secure, and a 12-week plan to reach zero standing cloud secrets.
TL;DR / Key takeaways
- Secrets don't die on their own. GitGuardian found 64% of valid secrets leaked in 2022 still working four years later. A secret in a pipeline variable is a liability for its whole life.
- Federation is now universal. GitHub, GitLab, Azure DevOps, any Kubernetes cluster, Google Cloud and AWS can all present a signed token to Entra. "We can't federate from there" is no longer a valid exception.
- The subject claim is the new secret. Entra trusts exactly the issuer, subject and audience you configure. A subject that admits any branch or pull request is as dangerous as a leaked key.
- Block, migrate, revoke. Move pipelines and pods to federated credentials, block new client secrets with an application management policy, then revoke what remains. Without the block, secrets grow back.
- It is the cleanest evidence you can give an auditor. NIS2 Article 21, § 30 BSIG and DORA Article 9(4) ask for controlled access and strong authentication. No standing secret beats a rotated one.
Download: Editable draw.io file · Open in diagrams.net · Chart data (CSV)
Why this matters now
Stolen secrets became the payload. The 2026 npm worms in our npm supply-chain teardown went after AWS, Azure, GCP and Kubernetes credentials in environment variables, runner memory and CLI caches. GitGuardian's analysis of their predecessor, the Shai-Hulud 2.0 wave of November 2025, found that 59% of compromised machines were CI/CD runners, not laptops, and 44% held more than ten secrets. A long-lived deployment key in a pipeline variable is exactly what those payloads look for.
The vendors now say so plainly. Microsoft's guidance says client secrets "should not be used in production environments" and recommends that customers "move away from password or certificate-based authentication to token-based authentication". AWS tells you to prefer temporary credentials over access keys. Google Cloud blocks service account key creation by default for organisations created on or after 3 May 2024.
The platforms filled the gaps.
- AWS shipped IAM outbound identity federation on 19 November 2025. An IAM role calls
GetWebIdentityTokenand receives a signed JWT, valid for 5 minutes by default, that Entra accepts as a federated credential. - GitHub applies immutable subject claims to new, renamed and transferred repositories since 15 July 2026. The subject now carries owner and repository IDs, so a recycled name can't inherit your cloud trust.
- Microsoft added flexible federated identity credentials (preview) with wildcard matching, and AKS identity bindings so many clusters can share one credential.
- Azure DevOps recommends federation for every new Azure Resource Manager service connection, uses the Entra issuer by default and will retire its own issuer on 1 July 2027.
The question is no longer whether you can federate. It is whether you have finished.
The trust graph, hop by hop
The numbers match the callouts in the hero diagram. The mechanism is the same everywhere: a token from someone you already trust is exchanged for a token from Entra. The details at each hop decide whether you removed a risk or moved it.
① The issuer: your platform signs a short-lived token
Every serious workload platform already has an identity provider. You don't build one; you decide which of its tokens to trust.
- GitHub Actions issues a per-job OIDC token from
https://token.actions.githubusercontent.comwhen the job haspermissions: id-token: write. Thesubclaim names the repository plus an environment, branch or pull-request context, for examplerepo:octo-org/octo-repo:environment:prod. - GitLab CI/CD issues tokens through the
id_tokenskeyword, with a subject such asproject_path:my-group/my-project:ref_type:branch:ref:main. They expire with the job timeout, or after 5 minutes if none is set. - Azure DevOps handles federation inside the service connection.
- AKS and other Kubernetes clusters run their own OIDC issuer. The Workload ID webhook projects a service account token into pods labelled
azure.workload.identity/use: "true", valid for 3,600 seconds by default and refreshed in place. On AKS Automatic, issuer and Workload ID are on by default. - AWS workloads call
GetWebIdentityTokenwith a lifetime of 60 to 3,600 seconds and ES384 or RS256. Entra documents RS256 as supported, so pick that. - Google Cloud workloads present a Google-signed ID token; SPIFFE/SPIRE covers most of the rest.
② The federated credential: issuer + subject + audience
A federated identity credential (FIC) sits on a user-assigned managed identity or an app registration. It names the issuer, the subject and the audience, which should be api://AzureADTokenExchange. Entra accepts an external token only if all three match exactly and case-sensitively.
Four properties cause most production incidents:
- No wildcards in standard FICs. A repository with
dev,testandprodenvironments needs three credentials. - Twenty per identity, at most. Flexible FICs (preview) accept expressions such as
claims['sub'] matches 'repo:contoso/app:environment:*' and claims['repository_id'] eq '456789'. For GitHub, Microsoft requires an immutable claim (repository_idorrepository_owner_id) in the expression. - Mistakes fail silently. Per Microsoft, a FIC with the wrong subject is created "successfully without error" and the exchange fails later. Test with a canary job before deleting the old secret.
- Propagation takes minutes. A request right after creating a FIC can fail with
AADSTS70021. Build retries into the first run.
The subject is where security is won or lost. Prefer environment-scoped subjects over branch-scoped ones, and protect the environment with required reviewers. A subject that trusts every pull request lets anyone who can open one deploy to production.
③ The exchange: an Entra token instead of a secret
The workload sends its platform token to Entra as a client_assertion in the client credentials flow. Entra fetches the issuer's signing keys from its OIDC discovery document, validates signature and claims, and returns an access token. The Azure Identity libraries (WorkloadIdentityCredential or DefaultAzureCredential) and the azure/login action do this for you.
The access token lives for a random 60 to 90 minutes by default and is bound to one audience. Nobody stores it or rotates it.
Which identity should hold the FIC? We default to a user-assigned managed identity: you can't add a client secret to it, so it can't drift back. Use an app registration when you need app roles, multi-tenant access or Microsoft Graph application permissions, and block password credentials on it by policy.
④ The authorisation: RBAC scope per identity
Federation answers "who is this?". Azure RBAC still answers "what may it do?", and that is where most estates are weakest. The usual anti-pattern is one federated identity with Contributor on a subscription, shared by every pipeline.
Use one identity per workload and environment, scoped to the narrowest resource group that works. Prefer data-plane roles (Key Vault Secrets User, Storage Blob Data Contributor, AcrPush) over Contributor. Our Entra ID hardening guide covers the tenant baseline underneath.
⑤ The guardrails: stop secrets growing back
Migration without guardrails is temporary:
- Application management policies block new password credentials or cap their lifetime, tenant-wide or per app. They need Entra premium licensing.
- Azure Policy can deny the
Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentialsresource type, so only your platform pipeline creates FICs. - Conditional Access for workload identities restricts service principals to known IP ranges or blocks them on risk. It needs Workload Identities Premium licences.
- Sign-in logs for service principals and managed identities go to the SIEM, with an alert on any client-secret sign-in after cut-over.
⑥ The reverse direction: Entra as the issuer
"Everywhere" also means Azure workloads reaching other clouds without keys. Microsoft does not support Entra-issued tokens in federated credential flows into Entra, apart from letting an app registration trust a managed identity, but other clouds accept them. Google Cloud's workload identity federation trusts an Entra tenant with the issuer https://sts.windows.net/TENANT_ID and an app registration's Application ID URI as audience. Google warns that by default every identity in the tenant can request tokens for that app, so restrict it with app role assignments. AWS accepts Entra as an IAM OIDC identity provider for AssumeRoleWithWebIdentity, with the trust policy pinning audience and subject.
What the numbers say
Leaks grow faster than the developer population: GitGuardian reports 152% more leaked secrets since 2021, against 98% growth in active developers. Persistence is worse. The share of valid leaked secrets still valid at report time was 64% for 2022, 66% for 2023, 70% for 2024 and 77% for 2025. Detection without rotation is just a list. Internal repositories are six times more likely than public ones to contain hardcoded secrets, so public numbers are the floor.
This is the chart we put in front of boards. The scale is logarithmic because the gap is several orders of magnitude. AWS access keys and Google service account keys don't expire by default. An Entra client secret can live up to 24 months. Every federated token on the green side expires in minutes to an hour and is renewed by the platform, not a person. The burden shifts from rotation, which people forget, to configuration, which you can review as code.
Two caveats. These are documented defaults and maximums, not measurements of your estate. And a short lifetime doesn't help if the subject trusts too much: an attacker who can run a job in a trusted context gets fresh tokens whenever they like.
The part nobody demos
- Pull request triggers. A FIC that trusts
pull_requestsubjects, or apull_request_targetworkflow that runs untrusted code withid-token: write, gives cloud access to anyone who can open a pull request. Our GitHub Actions hardening controls cover the workflow side. - Renamed repositories. Since 15 July 2026, a rename or transfer switches a repository to the immutable subject format automatically, which silently breaks a FIC that expects the old subject. Opt repositories in deliberately and update the FICs in the same change.
- The 20-FIC ceiling. A central "deployer" identity trusted by 40 repositories breaks the limit and least privilege at once. That is a design smell, not a quota problem.
- Agents. AI agents are workloads too, and they often act for users. Federation gives an agent its own identity; delegation needs token exchange on top, as we describe in AI agent identity and token exchange.
In a recent engagement…
A European industrial group asked us why its secret-rotation programme kept failing audits. The team was diligent: quarterly rotation, a spreadsheet of owners, a Key Vault per business unit. The finding repeated anyway, because each quarter project teams under deadline pressure created new service principals with two-year secrets in the portal.
We stopped treating rotation as the goal. In the first fortnight we inventoried every app registration credential and every pipeline variable that looked like a cloud key, and grouped them by consumer. Most fell into two buckets: Azure DevOps service connections and AKS workloads. The service connections converted with Microsoft's tool in an afternoon per project. AKS took longer, mostly because a few teams had hard-coded the projected token path, which Microsoft now explicitly warns against.
The decisive change was not technical. Once most consumers ran on federation, the identity team turned on a policy blocking new client secrets, with a documented exception route. The exceptions register replaced the spreadsheet, and it was short enough to read in a meeting. The next audit asked a different question: who approves exceptions?
Decision table: which mechanism for which workload
| Workload | Mechanism | Subject to trust | Watch out for |
|---|---|---|---|
| GitHub Actions to Azure | FIC on a user-assigned managed identity, azure/login with OIDC | environment:prod, immutable subject format | pull_request_target, forks, 20-FIC limit across repos |
| GitLab CI/CD | FIC with GitLab as issuer; flexible FIC (preview) for many branches | Protected branch or environment, plus project_id | Self-managed issuer must be reachable for key discovery |
| Azure DevOps | Workload identity federation service connection | Created by Azure DevOps | Convert before the Azure DevOps issuer retires on 1 July 2027 |
| AKS, EKS, GKE, on-premises Kubernetes | Microsoft Entra Workload ID, one service account per workload | system:serviceaccount:<namespace>:<name> | Don't hard-code the token path; identity bindings at fleet scale |
| AWS workloads to Azure | IAM outbound federation, GetWebIdentityToken with RS256 | IAM role ARN pattern | Regional STS endpoint; cap sts:DurationSeconds in IAM policy |
| Azure workloads to AWS or GCP | Managed identity token to AWS OIDC provider or GCP workload identity pool | App audience plus managed identity object ID | Restrict which tenant identities can get tokens for the app |
| SaaS without OIDC | Secret in Key Vault, reached through federation | n/a | Exceptions register with owner and expiry |
Governance for European enterprises
Federation is not required by name. It is the easiest way to meet obligations most DACH enterprises already have.
NIS2 and § 30 BSIG. Article 21(2) of Directive (EU) 2022/2555 lists the minimum risk-management measures. Point (i) covers access control policies and asset management; point (j) covers multi-factor or continuous authentication where appropriate. In Germany, § 30 BSIG has applied the same list since 6 December 2025. Non-human identities are where both are hardest to evidence. A federated identity has no standing credential, a fixed subject, a scoped role and a sign-in log. Our NIS2 risk-management measures on Azure maps the rest of Article 21.
DORA. Article 9(4)(c) of Regulation (EU) 2022/2554 requires financial entities to limit logical access to what is legitimate and approved. Article 9(4)(d) requires strong authentication mechanisms based on relevant standards and protection of cryptographic keys. Pipelines that deploy to production hold some of the most powerful access in a bank, and environment-scoped federation answers both points directly.
BSI C5. If you rely on C5-attested cloud services, the Identity and Access Management (IDM) criteria still apply to your own configuration. An exceptions register with owners and expiry dates is the artefact auditors ask for.
A pragmatic adoption path
- Weeks 1–2: inventory and owners. Export every app registration credential with its expiry, every service connection with its scheme, and every pipeline variable or Kubernetes secret holding a cloud key. Anything without an owner is a candidate for deletion, not migration.
- Weeks 2–6: pipelines first. CI/CD holds the most powerful credentials and is the easiest to move. Convert Azure DevOps service connections, then move GitHub and GitLab to environment-scoped FICs. Keep the old secret disabled, not deleted, for one release.
- Weeks 4–9: Kubernetes and cross-cloud. Enable the OIDC issuer and Workload ID on AKS, give each workload its own service account, and replace AWS and GCP keys with outbound federation and workload identity pools.
- Weeks 7–9: block new secrets. Pilot an application management policy that blocks password credentials, with a written exception route. Add the Azure Policy deny and the SIEM alert.
- Weeks 10–12: revoke and report. Delete the remaining secrets and report two numbers to the board: standing cloud secrets outside the exceptions register (target zero) and the age of the oldest exception.
The verdict
Long-lived cloud secrets are a habit, not a necessity. Every platform in a typical European multi-cloud estate can now prove its identity with a short-lived signed token, and Entra can trust it without storing anything. What remains is not cryptography. It is subject design, RBAC scoping and the discipline to block the old way once the new one works.
Stop rotating secrets you could delete. Start with pipelines, because that is where attackers look first. Design subjects around protected environments, not branches. Then turn on the policy that stops new secrets, or you will be back here in two years.
If you want help getting to zero standing secrets, our Zero Trust team runs this migration as a fixed-scope engagement: inventory, trust design, guardrails and an exceptions register your auditor can read in one sitting.
FAQ
What is workload identity federation?
It lets a workload that already has an identity on another platform, such as a GitHub Actions job, a Kubernetes pod or an AWS role, exchange a short-lived token from that platform for a Microsoft Entra access token. A federated identity credential on a user-assigned managed identity or app registration names the trusted issuer, subject and audience. No client secret or certificate is stored.
Which platforms can federate with Microsoft Entra ID?
Microsoft documents GitHub Actions, any Kubernetes cluster (AKS, EKS, GKE or on-premises), Google Cloud, AWS via IAM outbound identity federation, SPIFFE/SPIRE, Azure DevOps service connections and other OpenID Connect providers that sign with RS256. GitLab works as an OIDC issuer and is also covered by flexible federated identity credentials, currently in preview.
How many federated identity credentials can one identity have?
Twenty per application or user-assigned managed identity. Standard credentials match exactly and case-sensitively, without wildcards. Flexible federated identity credentials (preview) allow wildcard matching for GitHub, GitLab and Terraform Cloud tokens, and AKS identity bindings let many clusters share one credential.
Is a federated token safer than a client secret if it gets stolen?
Safer, not invulnerable. A platform token lives minutes to an hour and is accepted only for the exact issuer, subject and audience you configured; the Entra access token it buys lasts 60 to 90 minutes by default. A stolen client secret works from anywhere for up to 24 months. The residual risk moves to configuration: a subject that trusts too much is the new leaked secret.
Do we still need Azure Key Vault after moving to federation?
Yes, for less. Federation removes the credentials workloads use to reach Azure, AWS and Google Cloud. Third-party API keys, passwords for systems without Entra authentication and signing keys still belong in a vault, and the workload should reach the vault itself through federation.
Does NIS2 or DORA require workload identity federation?
Neither names it. NIS2 Article 21(2), transposed in Germany by § 30 BSIG, requires access control policies and multi-factor or continuous authentication where appropriate. DORA Article 9(4) requires limited access and strong authentication. For non-human identities, federation is the simplest way to evidence both, because there is no standing secret to protect or rotate.
Sources
All sources checked on 15 November 2026. Lifetimes are documented defaults and maximums; your tenant or account configuration may differ.
Tier A: primary, vendor documentation and regulatory
- Microsoft Learn, Workload identity federation overview: https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation
- Microsoft Learn, Workload identity federation considerations (20-FIC limit, exact matching, RS256, propagation): https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-considerations
- Microsoft Learn, Flexible federated identity credentials (preview): https://learn.microsoft.com/en-us/entra/workload-id/workload-identities-flexible-federated-identity-credentials
- Microsoft Learn, Add and manage app credentials in Microsoft Entra ID: https://learn.microsoft.com/en-us/entra/identity-platform/how-to-add-credentials
- Microsoft Learn, Migrate applications away from secret-based authentication: https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/migrate-applications-from-secrets
- Microsoft Learn, Access tokens in the Microsoft identity platform: https://learn.microsoft.com/en-us/entra/identity-platform/access-tokens
- Microsoft Learn, Microsoft Entra Workload ID on AKS: https://learn.microsoft.com/en-us/azure/aks/workload-identity-overview
- Microsoft Learn, Azure Resource Manager service connections (Azure DevOps): https://learn.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure
- GitHub Docs, OpenID Connect in GitHub Actions: https://docs.github.com/en/actions/concepts/security/openid-connect
- GitHub Changelog, Immutable subject claims for GitHub Actions OIDC tokens (23 Apr 2026): https://github.blog/changelog/2026-04-23-immutable-subject-claims-for-github-actions-oidc-tokens/
- GitLab Docs, OpenID Connect (OIDC) authentication using ID tokens: https://docs.gitlab.com/ci/secrets/id_token_authentication/
- AWS IAM User Guide, Getting started with outbound identity federation: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_outbound_getting_started.html
- AWS IAM User Guide, Manage access keys for IAM users: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
- Google Cloud IAM, Service account credentials: https://docs.cloud.google.com/iam/docs/service-account-creds
- Google Cloud IAM, Workload identity federation with other clouds: https://docs.cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds
- Directive (EU) 2022/2555 (NIS2), Article 21: https://eur-lex.europa.eu/eli/dir/2022/2555/oj/eng
- Regulation (EU) 2022/2554 (DORA), Article 9: https://eur-lex.europa.eu/eli/reg/2022/2554/oj/eng
Tier B: research and analysis
- GitGuardian, State of Secrets Sprawl 2026: https://www.gitguardian.com/state-of-secrets-sprawl-report-2026
Tier C: vendor announcements, directional
- AWS News Blog, Simplify access to external services using AWS IAM outbound identity federation (19 Nov 2025): https://aws.amazon.com/blogs/aws/simplify-access-to-external-services-using-aws-iam-outbound-identity-federation/
Topics