KB:How OIDC Connects AKS Service Accounts to Azure Managed Identities MI

OIDC (OpenID Connect) is the glue that binds the Kubernetes Service Account (SA)Azure Managed Identity (MI)Federated Credential chain.

Here’s what’s really happening behind the scenes in AKS + Microsoft Entra ID (formerly Azure AD).


🔐 The Role of OIDC in the AKS–Azure Identity Chain

1. OIDC Issuer: The Cluster’s Identity Provider

When you enable OIDC on your AKS cluster, Azure assigns it an OIDC issuer URL, like:

https://eastus.oic.prod-aks.azure.com/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/

This URL acts like a mini identity provider (IdP) for your cluster.

Inside the cluster, Kubernetes Service Accounts can issue JWT tokens that are signed by this OIDC issuer.
Each token includes claims like:

  • iss → the OIDC issuer URL

  • subsystem:serviceaccount:<namespace>:<serviceaccount>

  • aud → the audience you request when you create the token

Those claims prove “This token was issued by this AKS cluster for this Service Account.”


2. Federated Credential: The Bridge to Entra ID

In Microsoft Entra (Azure AD), you create a Federated Credential inside a User-Assigned Managed Identity (UAMI) or an App Registration.

That federated credential tells Entra ID:

“I trust tokens coming from this OIDC Issuer URL, but only if the sub claim matches system:serviceaccount:<namespace>:<serviceaccount>.”

So when your Kubernetes pod (running with that SA) requests an Azure token:

  1. The pod gets a signed OIDC JWT from the AKS OIDC endpoint.

  2. The pod presents that token to Azure’s identity endpoint.

  3. Entra ID validates:

    • The signature (via the OIDC Issuer’s JWKS keys),

    • The iss (issuer matches the URL you entered),

    • The sub (matches the SA you configured in the federated credential).

If all checks out — ✅ Azure issues an access token for the Managed Identity.


3. Managed Identity: The Azure-side Actor

Once the token is issued, your workload in the pod is acting as that Managed Identity — it can:

  • Authenticate to Azure Resource Manager,

  • Access Key Vault, Storage, Cosmos DB, etc.

  • All without storing secrets or client secrets in the pod.

So in plain English:

OIDC = the authentication handshake
Federated Credential = the trust mapping
Managed Identity = the Azure persona
Service Account = the Kubernetes persona

And the handshake path is:

K8s Service Account → AKS OIDC Issuer → Entra Federated Credential → Managed Identity → Azure Resource Access

🧩 Visual summary

[ Pod ] | └── uses ServiceAccount (namespace: dev, name: my-app-sa) | └── AKS issues OIDC JWT token (iss + sub) | └── Azure Entra ID Federated Credential validates it | └── issues Azure access token for Managed Identity

⚙️ Why this matters

  • No secrets — eliminates need for AZURE_CLIENT_SECRET.

  • Per-pod identity — each pod can have its own Managed Identity securely.

  • Automatic rotation — JWTs and access tokens are short-lived.

  • Cross-cloud portability — same concept works in GKE, EKS, etc. (each has its own OIDC issuer).

Comments

Popular posts from this blog

KB: Azure ACA Container fails to start (no User Assigned or Delegated Managed Identity found for specified ClientId)

Electron Process Execution Failure with FSLogix

KB:RMM VS DEX (Remote Monitoring Management vs Digital Employee Experience)