AI agents are spreading across clouds faster than identity teams can track them. One agent runs on Amazon Bedrock AgentCore, another on Google Cloud Run, and both need to call Microsoft Graph or your own APIs. The fastest way to wire that up is a client secret pasted into an environment variable. It is also the way most agent breaches start.
Workload identity federation (WIF) removes the secret. The cloud your agent already runs on vouches for it with a short-lived signed token, and Microsoft Entra trades that token for one issued to the agent’s own Entra Agent ID. Nothing long-lived is stored, nothing needs rotating, and every token can be traced to one identity.
This article covers two scenarios that come up again and again in Agent 365 rollouts:
- Agent ID WIF. An agent hosted on AWS or GCP authenticates as its Entra Agent ID with no secret. This is fully supported today.
- Connected Platforms. Agent 365 reaches into your AWS or GCP account to discover the agents running there. This still needs a key today, and I’ll show how to contain it and get ready for keyless.
How WIF works, in one picture
Federation is a trust between two token issuers. One side signs a short-lived OIDC token; the other accepts it only when three claims match a rule you registered in advance:
- Issuer (
iss) — who signed it. Pins the AWS account, the Google platform or the Entra tenant. - Subject (
sub) — who it is about. Pins one IAM role, one Google service account or one Entra identity. - Audience (
aud) — who it is for. Stops a token minted for one service from being replayed to another.
The signature is checked against the issuer’s published keys, so none of the three can be faked. For Agent ID, the exchange takes three hops:

The runtime asks its own cloud for a five-minute token addressed to Entra. The agent’s blueprint presents that token with fmi_path naming the agent identity, and gets back T1, a token good only for exchange. The agent identity redeems T1 for a real access token. Only that last token ever reaches an API.
Agent ID WIF on AWS
On AWS, the agent’s IAM role mints the token. Five steps get you there.
1. Create the blueprint and agent identity. Use a365 setup all or the Entra admin center. Note the blueprint’s client ID, the agent identity’s client ID and its object ID. Remove any client secret on the blueprint; you won’t need it.
2. Turn on outbound identity federation once per AWS account. The command returns an issuer URL that is unique to your account. Keep it.
aws iam enable-outbound-web-identity-federation
3. Let the agent’s role mint tokens for Entra only. Give each agent its own role:
{ "Effect": "Allow", "Action": "sts:GetWebIdentityToken", "Resource": "*",
"Condition": {
"StringEquals": { "sts:IdentityTokenAudience": "api://AzureADTokenExchange" },
"NumericLessThanEquals": { "sts:DurationSeconds": 300 } } }
4. Trust that role on the blueprint. In Entra, open the blueprint → Credentials → Federated credentials → Add credential → Other issuer:
| Field | Value |
|---|---|
| Issuer | The URL from step 2 |
| Subject | arn:aws:iam::<ACCOUNT_ID>:role/<ROLE_NAME> |
| Audience | api://AzureADTokenExchange |
5. Exchange tokens at runtime.
Show codeHide code
import boto3, requests
TOKEN_URL = "https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token"
JWT = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
aws_token = boto3.client("sts", region_name="us-east-1").get_web_identity_token(
Audience=["api://AzureADTokenExchange"], SigningAlgorithm="RS256",
DurationSeconds=300)["WebIdentityToken"]
t1 = requests.post(TOKEN_URL, data={
"client_id": "<BLUEPRINT_CLIENT_ID>", "grant_type": "client_credentials",
"scope": "api://AzureADTokenExchange/.default", "fmi_path": "<AGENT_ID_CLIENT_ID>",
"client_assertion_type": JWT, "client_assertion": aws_token}).json()["access_token"]
agent_token = requests.post(TOKEN_URL, data={
"client_id": "<AGENT_ID_CLIENT_ID>", "grant_type": "client_credentials",
"scope": "https://graph.microsoft.com/.default",
"client_assertion_type": JWT, "client_assertion": t1}).json()["access_token"]Two gotchas: GetWebIdentityToken needs a regional STS endpoint, and permissions must be granted to the agent identity, not the blueprint. The federated credential only proves who is asking; it grants nothing.
Agent ID WIF on GCP
On Google Cloud, the agent’s service account mints the token through the metadata server. The flow on the Entra side is identical to AWS; only the first hop changes.
1. Create the blueprint and agent identity, exactly as on AWS.
2. Give the agent its own service account, never the default Compute Engine one, and create no keys for it. Grab its numeric ID:
gcloud iam service-accounts create agent-x --project <PROJECT_ID>
gcloud iam service-accounts describe agent-x@<PROJECT_ID>.iam.gserviceaccount.com \
--format='value(uniqueId)'
Deploy the agent to run as that account on Cloud Run, GKE or Vertex AI Agent Engine.
3. Trust that service account on the blueprint with Other issuer:
| Field | Value |
|---|---|
| Issuer | https://accounts.google.com |
| Subject | The 21-digit uniqueId, not the email |
| Audience | api://AzureADTokenExchange |
4. Exchange tokens at runtime. Fetch the Google ID token, then run the same two Entra calls as in the AWS example, passing this token as the first client_assertion:
Show codeHide code
import requests
google_token = requests.get(
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity",
params={"audience": "api://AzureADTokenExchange"},
headers={"Metadata-Flavor": "Google"}).textOne difference worth knowing: Google ID tokens live for an hour, not five minutes. Exchange the token right away and never write it to a log.
Connected Platforms: not secretless yet, but containable
Connected Platforms lets Agent 365 sync agents from Amazon Bedrock and Google Vertex AI into the Microsoft 365 agent registry. The connection is read-only, and Agent 365 never invokes those agents. As of this writing, Microsoft’s documentation is explicit that every supported platform needs a key-based credential, and that workload identity federation isn’t supported for this feature yet.
So the job today is to make that key as harmless as possible.
On AWS:
- Use a dedicated IAM user with list and get actions only, such as
bedrock-agentcore:ListAgentRuntimesandbedrock:GetAgent. Never grant delete actions. - Add a
Denyonaws:SourceIpfor anything outside Agent 365’s published egress IPs. A leaked key then fails from anywhere else. - Rotate at least every 90 days, and alert on
CreateAccessKey.
On GCP:
- Use a dedicated service account with
roles/aiplatform.viewer, plus the BigQuery, Monitoring and Trace viewer roles only if you want activity data. - Set
constraints/iam.serviceAccountKeyExpiryHoursso the key expires on its own, and allow key creation in that one project only. - Delete the JSON file the moment it’s pasted into the admin center.
Getting ready for keyless. You can stage the reverse trust now: an Entra audience app with v2 tokens, an IAM OIDC provider or Google workload identity pool pointed at https://login.microsoftonline.com/<TENANT_ID>/v2.0, and a role bound to one specific subject. Test it with your own app. When Agent 365 adds keyless auth, you change one subject value and delete the key.
What stops a forged or borrowed token
A signed token can’t be forged, so the real risk is a valid token from the wrong caller. Here is what pins each side down:
| AWS → Entra | GCP → Entra | |
|---|---|---|
| Issuer | Unique per AWS account | https://accounts.google.com, shared by every Google customer |
| Subject | IAM role ARN | Service account’s numeric uniqueId |
| Subject survives delete-and-recreate? | Yes. Same name, same ARN, same trust | No. A new account gets a new ID |
| Token lifetime | Up to 5 minutes | 1 hour |
The GCP row has a sharp edge: because the issuer is shared, the subject is the only thing tying a token to your workload. AWS has the opposite quirk: a role recreated with the same name silently inherits the trust.
The mistakes I’d look for in any review:
- Trusting the audience without the subject. Going Entra → AWS or GCP, any identity in your tenant that can get a token for the audience could then get in. Always pin
sub, and turn on Assignment required on the Entra audience app. - Shared roles or service accounts. If two agents run as one identity, Entra can’t tell them apart. One role or service account per agent.
- Binding the whole GCP pool.
principalSet://…/*admits everyone who passes the provider. Bindprincipal://…/subject/<OBJECT_ID>instead. - Forgetting who can become the workload. On AWS, anyone who can assume the role. On GCP, anyone with
serviceAccountTokenCreatoron the account, or holding one of its keys. Each of them can mint a valid token and act as your agent. - Forgetting the tenant check. AWS can’t condition on
tid, so the issuer URL must name your tenant exactly. GCP can, so addassertion.tid=='<TENANT_ID>'as an attribute condition.
Wrapping up
If your agents run on AWS or GCP and call anything protected by Entra, there is no longer a good reason to give them a client secret. With Agent ID WIF, each agent gets an identity you can audit in Entra sign-in logs, govern with Conditional Access, and switch off in one place. For Connected Platforms, lock the key down today and stage the federation trust, so moving to keyless is a one-line change when it ships.
Further reading (Microsoft Learn):
- Use an AWS workload identity with Entra Agent ID
- Use a Google Cloud workload identity with Entra Agent ID
- Choose an integration path for an agent
- Connected platforms in Agent 365
- Connect Amazon Bedrock · Connect Google Vertex AI
Product details reflect Microsoft’s documentation as of December 2026. Check the links above before you build, as preview features change quickly.
¶ Discussion
Comments are powered by Giscus / GitHub Discussions. They appear here once configured — see
Configure Giscusin the project README and updateGISCUSinsrc/consts.ts.