workload identity federation
In an OIDC-based setup, workload identity federation replaces a stored credential with an exchange. It has four parts:
- A platform identity token, signed by the platform the workload runs on, such as GitHub Actions or a Kubernetes cluster.
- A trust relationship, configured once, that tells the receiving service which platform to trust and which workloads on it to admit.
- A token exchange, in which the workload trades its platform token for an access token.
- A short-lived access token, which expires on its own and can be replaced with another exchange.
Software needs credentials to call other software. A CI workflow that deploys to a cloud provider, for example, usually presents a stored secret every time it runs. Workload identity federation removes that secret. Google Cloud describes it as giving on-premises or multicloud workloads access to its resources “by using federated identities instead of a service account key.” Microsoft Entra frames it as access to protected resources “without managing secrets,” for GitHub Actions, Kubernetes, and compute outside Azure. AWS strongly recommends against storing AWS credentials long-term in applications outside AWS and points to OpenID Connect (OIDC) federation instead.
AI agents can run in CI pipelines, pods, and chat assistants, and they need credentials for the protected tools they call. The Speakeasy AI Control Plane applies federation to that case: an agent’s workload exchanges its platform token for a 15-minute access token to MCP servers, with no stored secret, and acts as an agent whose access never exceeds that of its human owner.
How does workload identity federation work?
One common approach uses OIDC tokens; other federation mechanisms also exist. Google Cloud, for example, supports SAML assertions and other credentials. In the OIDC flow, the details differ by vendor. The following example combines trust setup and token exchange into four steps:
- Trust the platform once. An administrator tells the receiving service which external identity provider to trust, such as GitHub, and which workloads on it may sign in. This step involves no secret.
- The platform issues the workload a signed token. On GitHub Actions, each job requests a token from GitHub’s OIDC provider and receives a JSON Web Token (JWT) that is unique to that job.
- The workload exchanges the token. It sends the platform token to the receiving service, which checks the trust relationship and validates the token against the OIDC issuer URL. Google Cloud’s implementation follows the OAuth 2.0 token exchange specification.
- The workload receives a short-lived access token. AWS describes the result as temporary security credentials that map to an IAM role with permissions to specific resources. The workload uses that token to call the service until it expires.
The diagram shows an example using GitHub’s legacy subject format.
The token in step 2 carries claims that describe the workload. The one that matters most is the subject, sub. In GitHub’s legacy format, a job that runs in the prod environment of one repository carries this subject:
{ "sub": "repo:octo-org/octo-repo:environment:prod"}Repositories created after July 15, 2026 use a subject format that includes immutable owner and repository IDs by default; see GitHub’s subject claim documentation.
When the token arrives, the cloud provider checks whether its subject and other claims match the conditions configured in the trust relationship. A job in another repository, or in the same repository but a different environment, carries a different subject and is refused when the rule requires this exact value.
Why replace stored secrets with federated identity?
A stored secret works for whoever holds a copy, until it is revoked or expires. The OWASP Non-Human Identities Top 10 lists long-lived secrets as a risk in their own right: API keys, tokens, encryption keys, and certificates “with expiration dates that are too far in the future or that don’t expire at all.” In its 2024 report, Datadog found that among AWS IAM users with an active access key, 60% had one older than a year.
Keeping keys safe is ongoing work. Google Cloud calls service account keys “powerful credentials” that “can present a security risk if they are not managed correctly,” and says federation “eliminates the maintenance and security burden” that comes with them. OWASP’s prevention guidance includes implementing short-lived credentials that expire on their own.
Federation changes what there is to protect:
- No long-lived cloud secret to store. GitHub notes that with OIDC, you no longer duplicate cloud credentials as long-lived GitHub secrets.
- No manual rotation. The cloud provider issues temporary credentials that expire automatically; their lifetime depends on the provider and configuration.
- A smaller window. A short-lived access token can still be stolen, but it stops working soon after, and the next run gets a new one.
For a broader view of the credentials machines hold, see what is non-human identity, and for keeping each credential narrow, see task-scoped credentials.
What decides which workloads get in?
The signature on a platform token proves which platform issued it. It does not prove the workload is yours. Large platforms issue tokens to workloads across customers: GitHub issues a signed token to every workflow job that requests one, in any repository. If a trust relationship admitted every token GitHub signs, any GitHub user could write a workflow that gets in.
The trust policy must restrict which token claims are accepted and map the accepted workload to an identity on your side. The administrator must also control who can run that workload.
Two practices keep that rule tight:
- Match exactly. Microsoft Entra checks the token against the configured issuer, subject, and audience. An exact subject such as
repo:octo-org/octo-repo:environment:prodadmits one environment in one repository. - Check what a wildcard admits. A rule that ends in
*admits every subject that starts with the text before it, including subjects created later. Check which workloads the whole pattern admits, how the issuer assigns subjects, and who can run those workloads.
The GitHub case shows the trap. A legacy-format rule for repo:acme/deploy:* looks like it admits one repository, but it can admit tokens for every branch in it. Someone who can run a workflow on such a branch and request an OIDC token could sign in with the identity the rule grants, unless other restrictions prevent it. Before approving a wildcard, ask who controls the text the asterisk matches.
How does it compare with service account keys, managed identities, and OIDC?
Workload identity federation sits next to several related terms. They solve parts of the same problem:
| Term | What it is | How it relates to workload identity federation |
|---|---|---|
| Service account key | A long-lived secret a workload stores and presents | The credential federation replaces |
| Managed identity | Credentials a cloud platform manages for workloads running inside it | Does the same job within one cloud |
| OIDC | An identity protocol that uses signed JWTs | One way for a workload to obtain an identity token |
| SPIFFE | An open standard for issuing identities to workloads | A way to issue the workload’s identity in the first place |
Service account keys. A key is a stored secret that works wherever it is copied. Google Cloud’s description of federation is defined against it: federated identities “instead of a service account key.”
Managed identities. Inside its own cloud, a provider can issue credentials to a workload directly. Microsoft notes that on Azure “you can use managed identities and the Azure platform manages the credentials for you.” Federation extends the same idea to workloads that run elsewhere, such as GitHub Actions or a Kubernetes cluster outside Azure.
OIDC. OIDC defines an identity protocol that uses JWTs; federation is the trust and exchange around the identity credential. AWS describes workloads that receive a JWT and exchange it for temporary credentials mapped to a role. OIDC federation is one way to implement workload identity federation.
SPIFFE. SPIFFE, the Secure Production Identity Framework for Everyone, is a set of open-source standards for identifying software systems in dynamic environments. It defines short-lived cryptographic identity documents called SVIDs. Where GitHub or a cloud provider issues the workload’s identity for you, SPIFFE is a way to issue it yourself across heterogeneous infrastructure.
Why do AI agents need workload identity federation?
AI agents are workloads. Some run without a person at the keyboard, such as an agent in a CI job or a Kubernetes pod; others respond to messages in a chat channel. These background agents need credentials for the protected tools they access, and one common approach is a pasted API key. Developers wiring agents to APIs still describe putting a key in an .env file and hoping nothing goes wrong.
The Model Context Protocol (MCP), which connects agents to tools, is moving to address this. Its 2026 roadmap, published on August 22, 2026, observes that MCP authorization “today is built around a person approving access in a browser,” while “more and more of the callers are agents running as cloud workloads with their own identity, acting on behalf of a user who isn’t present.” The roadmap names the work as “defining an opinionated path for agent identity and delegation through Workload Identity Federation,” alongside the ID-JAG grant and standard token exchange. The work is under way in a proposal to the specification, so treat it as a direction rather than a finished standard.
Federation answers one question for agents: which workload is running. A token whose subject names a repository, a pod’s service account, or a platform-assigned agent ID says nothing about which person is accountable for what the agent does. Assigning an owner as well as a workload identity can make the agent’s access accountable to a person.
One way to govern access is to map each workload to an agent identity with a human owner. In Speakeasy, that model works as follows:
- The workload has no permissions of its own. It acts as the agent the trust rule assigns it to.
- The agent’s policy caps what it can do. The policy limits which tools and servers the agent can reach.
- The owner’s access bounds the agent. The agent can never do more than its owner, so when the owner loses access to a system, the agent loses it too.
How does Speakeasy support workload identity federation?
In the Speakeasy AI Control Plane, workload identity lets a CI job, Kubernetes pod, Claude Tag channel, or other workload connect to MCP servers without a stored secret. The workload presents the identity token its own platform already issues, such as a GitHub Actions OIDC token, and exchanges it for a short-lived Speakeasy access token. It then acts as the agent assigned to it.
Cloud federation admits a workload to one provider’s resources and maps it to a role there. It doesn’t cover the MCP servers an agent calls across vendors, and the role’s permissions aren’t tied to any person’s current access. Speakeasy runs the same exchange in front of those MCP servers and ties each workload to an owned agent:
- Access is bounded by the owner. Each agent has one human owner and a policy that caps what it can do. The workload holds no permissions of its own and reaches only what both the agent’s policy and the owner’s current permissions allow. If the owner loses access to a server, the workload loses it on its next request.
- Tokens last 15 minutes, with no refresh token. An API key can last up to a year. When a workload’s access token expires, it exchanges a fresh platform token, and a platform token with a
jticlaim is accepted only once. - Each access rule names an agent. A rule names the
subclaim allowed to sign in and the agent it acts as, matched exactly or by a prefix. Wildcards fit platforms that mint the varying part, as Anthropic does with agent IDs inwimse://identity.anthropic.com/org/ORG_ID/agent/*. Trust-policy refusals returninvalid_grant, so callers can’t probe the trust policy. - Trust changes are audited. Every change to trusted platforms and access rules is recorded in the organization’s audit logs. To stop a workload immediately, revoke its sessions or suspend the agent.
Claude Tag, GitHub Actions, and GKE are verified platforms, with the issuer and signing keys filled in; see the guides for Claude Tag, GitHub Actions, and GKE. Any other platform that already signs OIDC tokens for its workloads, such as another CI provider or a cluster, can connect as a custom OIDC issuer.
To see a CI job or a Claude Tag channel reach MCP servers as an owned agent with no stored key, talk to us.