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:
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 -
sub→system: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
subclaim matchessystem:serviceaccount:<namespace>:<serviceaccount>.”
So when your Kubernetes pod (running with that SA) requests an Azure token:
-
The pod gets a signed OIDC JWT from the AKS OIDC endpoint.
-
The pod presents that token to Azure’s identity endpoint.
-
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:
🧩 Visual summary
⚙️ 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
Post a Comment