A. B. Khan

Entra Workload ID Federation on AKS

The Mesh Series · Article 15

Microsoft Entra IDWorkload identityAzureSPIFFESecrets & certificatesAKSKubernetesAuthorizationPolicy

Cover: Entra Workload ID Federation on AKS

The Mesh Series · Article 15 · Where Entra meets Istio

Article 14 ended on a wall. A workload's SPIFFE certificate proves it to its neighbours inside the mesh — but Key Vault isn't in the mesh. Neither is Cosmos DB, or your database, or any Azure resource that lives behind Entra. Your service can't present a SPIFFE cert to Key Vault; Key Vault has never heard of your mesh's CA. So how does the same workload prove itself outward, to Azure, still without a secret in config?

This is the other half of Article 8's pair, built end to end. The mechanism is workload identity federation, and the one sentence that captures it: Kubernetes vouches for the pod, Entra trusts Kubernetes, and the pod gets an Entra token — no secret anywhere in between.

Diagram: federation

Two phases. You configure the trust once — a managed identity, a federated credential that describes which workload may act as it, and an annotation that wires a pod to that identity. Then at runtime, every token exchange happens on its own: Kubernetes mints a short-lived token for the pod's service account, Azure.Identity presents it to Entra, Entra checks it against the federated credential you defined, and hands back an access token. Nothing in that runtime path is a secret you stored.

Why regulated enterprises should care

This is where the credential-sprawl story the series opened on finally dies for workloads. The old way — a connection string in appsettings, a client secret copied into a pipeline variable, both aging in place because rotating them means an outage — is replaced by nothing in config to rotate. There's no secret to leak because there's no secret. That's the resolution of the second pain point this series named, made concrete on Azure.

And it's attributable. Every access to Key Vault or Cosmos resolves to a named managed identity with an object ID an auditor can point at — not an anonymous shared string that four services and three pipelines all happen to know. When CERT-In's six-hour clock starts, or a SAMA assessment asks "which principal touched this data," the answer is a specific identity, federated from a specific service account, in a specific cluster. That's the demo-to-audit gap closing on the outward path exactly as mTLS closed it on the inward one.

There's a 2026 forcing function too. The legacy AAD Pod Identity is deprecated; workload identity federation is its GA replacement. If you're still on Pod Identity, this isn't just an improvement — it's a migration with a clock on it. And the same federated-token mechanism is what let oauth2-proxy authenticate secretlessly in Article 11, so this pattern isn't a corner case; it's becoming the default way anything on AKS proves itself to Entra.

How the pieces come together

Three objects you create, and one exchange that then runs itself.

The managed identity is the workload's Entra principal — a first-class object with an object ID, created once. The federated credential is the trust statement: it tells the managed identity to accept tokens from your cluster's OIDC issuer, for one specific service account, with the audience api://AzureADTokenExchange. The match is exact and case-sensitive on all three fields — issuer, subject, audience — which is both the security property and the thing you'll typo first. The service-account annotation points a Kubernetes service account at the managed identity's client ID, and a pod label opts the workload in; on AKS a mutating webhook then injects the environment the SDK needs — AZURE_CLIENT_ID, AZURE_TENANT_ID, and the path to the projected token in AZURE_FEDERATED_TOKEN_FILE.

At runtime, Azure.Identity's DefaultAzureCredential (or the explicit WorkloadIdentityCredential) finds that projected token, presents it to Entra, and gets back an access token — automatically, refreshed as needed, with your code none the wiser. Worth knowing before you design around it: a single managed identity holds at most 20 federated credentials, and Entra stores only the first 100 signing keys from an issuer.

Show the code

The trust statement, created against your cluster's OIDC issuer. The subject is the exact service account that may act as this identity — and the pod opts in with an annotation and a label, no secret:

Code: federated cred

The C# is the payoff — a Key Vault call with no credential anywhere in it:

Code: keyvault

No connection string for the vault, no client secret, no certificate file. The credential is the pod's federated identity — minted fresh, expired quickly, never written down.

Security · Audit · Integration

Security property gained. No long-lived secret exists for the workload's Azure access. The token the pod presents is minted by Kubernetes, scoped to a single audience, and short-lived; a stolen copy is worthless fast, and there is no config field holding a credential to steal in the first place.

Audit evidence produced. Every Azure access resolves to a named managed identity, federated from a named service account. "Identity X, federated from payments/payment-api, read Key Vault secret Y at time Z" is a sentence you can put in an incident report — the outward-path equivalent of the SPIFFE-identity evidence from Article 14.

How it integrates. This completes Article 8's two-identity model: inward via mTLS/SPIFFE (Article 14), outward via federation (here). It's the workload half of passwordless (Article 9). And it uses the exact mechanism Article 11's oauth2-proxy used to authenticate itself. One pattern, everywhere a workload meets Entra.

Alternatives, and when you'd actually pick them

Legacy AAD Pod Identity. Deprecated — this is the thing you're migrating from, not an option. The migration is mechanical but not zero: create managed identities, add federated credentials, annotate service accounts, remove the old AzureIdentity/AzureIdentityBinding CRDs, and cut over. Do it on a clock, because the replacement is GA and the legacy path is on borrowed time.

Connection strings / client secrets in config. The status quo you're replacing. Always available, always tempting for a spike — and the exact liability the series has been dismantling. The moment it touches an environment an auditor can subpoena, it's a finding. Federate it away.

SPIRE federated to Entra. For a heterogeneous or multi-cloud estate where SPIRE already issues workload identity, Entra can accept SPIRE-issued tokens as a federated credential source — one identity plane spanning clouds, bridged into Azure. Real capability, real operational weight; justified only when you're already running SPIRE for portability reasons (Article 8).

From the toy to the standard

The toy is one managed identity, one federated credential, one Key Vault call with no secret. The industry-standard version is the same pattern with no exceptions: every workload that touches an Azure resource has its own managed identity, federated to its own service account, so access is least-privilege and individually attributable; no connection string or client secret exists in any config anywhere; and the legacy Pod Identity path is gone, not lingering. Inward identity by SPIFFE, outward identity by federation, and nothing in config to leak on either side.

You now have workloads that prove themselves both directions with no stored secret. Which means you can finally do the thing zero-trust actually demands: stop allowing traffic by default. If every caller carries a verifiable identity, you can deny everything and allow only the specific identities that should talk — and mean it.

That's Article 16: default-deny AuthorizationPolicy.


Next in the series — Article 16: Default-deny AuthorizationPolicy.

Key skills & topics in this article

Microsoft Entra IDWorkload identityAzureSPIFFESecrets & certificatesAKSKubernetesAuthorizationPolicy

  • #ServiceMesh
  • #Istio
  • #Azure
  • #dotnet
  • #ZeroTrust
  • #Kubernetes

Also on LinkedIn.