---
title: How does workload identity federation work for AI agents?
url: https://opencontroller.lyzr.com/blog/workload-identity-federation-for-ai-agents
published: 2026-11-12
updated: 2026-11-12
author: Lyzr
---

# How does workload identity federation work for AI agents?

**Workload identity federation lets an AI agent prove who it is with a short-lived, signed token from the platform it runs on, and swap that token for temporary credentials in a cloud or API. The agent never stores an access key. Trust is set up once, by telling the target which issuer, audience and subject to accept.**

Static keys are the most common way agents end up over-privileged and untraceable. A key pasted into an environment variable outlives the agent, the developer and the project. Federation replaces it with credentials that expire in minutes or hours and that name the workload in every log.

## How does the token exchange work?

The pattern is the same on every major cloud.

1. **The runtime issues an identity token.** Kubernetes projects a service account token into the pod. A CI system or another cloud issues an OIDC token for the job or workload.
2. **The agent presents that token to the target's token service.** The token is signed by an issuer the target already trusts.
3. **The target checks the claims.** It verifies the signature and matches the issuer (`iss`), audience (`aud`) and subject (`sub`) against the trust you configured.
4. **The target returns short-lived credentials.** The agent uses them to call models, data stores or APIs.
5. **The credentials expire.** The agent repeats the exchange. Nothing long-lived is ever written to disk.

## How does it look on AWS, Google Cloud and Microsoft Entra?

| | AWS | Google Cloud | Microsoft Entra ID |
|---|---|---|---|
| Trust object | IAM OIDC identity provider plus a role trust policy | Workload identity pool and provider | Federated identity credential on an app registration or user-assigned managed identity |
| Exchange | STS `AssumeRoleWithWebIdentity` | Security Token Service, then direct resource access or service account impersonation | Client credentials flow with the external token as a client assertion |
| Scoping | Conditions on `sub` and `aud` in the trust policy | Attribute mappings and attribute conditions | Exact match on issuer, subject and audience |
| Notable limit | Role session duration is capped by the role's maximum | Attribute conditions are the main guard against over-broad trust | Up to 20 federated credentials per app or managed identity |

Managed Kubernetes services wrap these: EKS Pod Identity and IAM roles for service accounts on AWS, Workload Identity Federation for GKE on Google Cloud, and Microsoft Entra Workload ID on AKS.

## What mistakes make federation unsafe?

Federation is only as tight as the claims you match.

- **Wildcard subjects.** Trusting every subject from an issuer lets any workload on that cluster or CI system assume the role. Match the exact namespace and service account, or the exact repository and branch.
- **Shared identities.** Ten agents behind one federated role look like one agent in the logs. Give each agent its own identity, so permissions and audit trails are per agent.
- **Broad target permissions.** Federation fixes how credentials are issued, not what they allow. Apply the [least-privilege checklist for AI agents](/blog/least-privilege-checklist-for-ai-agents) to every role.
- **Forgetting the human.** Federation proves which workload is calling. It does not say which user the agent is acting for.

## Is workload identity federation the same as on-behalf-of identity?

No. They answer different questions and most production agents need both.

- **Workload identity federation:** "Is this really the claims-triage agent, version 3, running in our production cluster?"
- **Delegated on-behalf-of identity:** "Which employee asked for this action, and is the agent limited to what that employee may do?"

The second is usually built with OAuth token exchange. See [OAuth token exchange for AI agents](/blog/oauth-token-exchange-for-ai-agents) and the [identity and delegation guide](/blog/ai-agent-identity-on-behalf-of-delegation).

## How Opencontroller does this

Agent workload identity federation is a live Opencontroller capability, alongside delegated on-behalf-of identity and OIDC SSO. Opencontroller also auto-discovers API keys across AWS, Azure and Google Cloud, which shows where static keys remain to be replaced, and Posture flags risky permissions and configuration. Read [whether AI agents are non-human identities](/blog/are-ai-agents-non-human-identities), or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Does workload identity federation remove all secrets from an agent?**
It removes long-lived cloud keys. The runtime still issues a token, but it is short-lived and automatic.

**Does federation tell you which user an agent acted for?**
No. It identifies the workload. User context needs on-behalf-of delegation.

**Can agents outside any cloud use federation?**
Yes, if their platform can issue OIDC tokens from a public issuer the target can verify, such as a CI system or a Kubernetes cluster with a discoverable OIDC issuer.

## Key facts

Workload identity federation lets an AI agent exchange a signed OIDC token from its runtime (Kubernetes, CI, another cloud) for short-lived credentials in a target cloud, so no long-lived access keys are stored. On AWS the exchange is STS AssumeRoleWithWebIdentity against an IAM OIDC identity provider; on Google Cloud it uses workload identity pools and providers with the Security Token Service; on Microsoft Entra ID it uses federated identity credentials on an app registration or user-assigned managed identity, with a limit of 20 per application or identity. Trust is scoped by matching issuer, audience and subject claims. Agent workload identity federation is a live Opencontroller capability, alongside delegated on-behalf-of identity and OIDC SSO. Opencontroller pricing starts from $250K per deployment per year.

## Related

- [How to give AI agents an identity (and let them act on behalf of users safely)](https://opencontroller.lyzr.com/blog/ai-agent-identity-on-behalf-of-delegation.md)
- [Are AI agents non-human identities?](https://opencontroller.lyzr.com/blog/are-ai-agents-non-human-identities.md)
- [How often should AI agent credentials be rotated?](https://opencontroller.lyzr.com/blog/how-often-to-rotate-ai-agent-credentials.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
