OIDC Issuer Mismatch¶
Symptom¶
Pods have the expected service account and projected token, but Azure token exchange fails and workloads cannot access Azure resources such as Key Vault or Storage.
Possible Causes¶
- The federated identity credential trusts an old or wrong AKS OIDC issuer URL.
- Workloads were moved to a different cluster and the new cluster has a different issuer URL.
- The cluster never had OIDC issuer or workload identity enabled.
- A copied automation template reused the wrong issuer value across environments.
Diagnosis Steps¶
flowchart TD
A[Azure token exchange fails] --> B[Confirm workload identity and OIDC issuer are enabled]
B --> C[Read actual cluster issuer URL]
C --> D[Compare issuer with federated identity credential]
D --> E{Issuer matches exactly?}
E -->|No| F[Update federated identity credential]
E -->|Yes| G[Continue with subject and audience checks] -
Confirm the cluster has workload identity and an OIDC issuer.
az aks show \ --resource-group "$RG" \ --name "$CLUSTER_NAME" \ --query "{issuer:oidcIssuerProfile.issuerUrl,workloadIdentity:securityProfile.workloadIdentity}" \ --output yamlCommand Purpose az aks showShow the OIDC issuer and workload identity state. --resource-groupResource group that contains the AKS cluster. --nameName of the AKS cluster. --querySelects the issuer URL and workload identity profile. --outputOutput format for the result. -
Confirm the workload runs as the intended service account.
-
Compare the cluster issuer URL with the issuer trusted by the federated identity credential.
az identity federated-credential list \ --resource-group "$RG" \ --identity-name "$USER_ASSIGNED_IDENTITY_NAME" \ --output tableCommand Purpose az identity federated-credential listList federated credentials on the identity. --resource-groupResource group that contains the identity. --identity-nameManaged identity to inspect. --outputOutput format for the result. -
Inspect pod logs for token exchange failures while keeping the issuer comparison as the primary hypothesis.
Resolution¶
- Update or recreate the federated identity credential with the exact AKS OIDC issuer URL reported by the cluster.
- If the workload was moved across clusters, create the new federated credential before cutting traffic to the new cluster.
- Verify subject and audience after fixing the issuer so you do not stop at the first corrected mismatch.
Prevention¶
- Always source the issuer URL from
az aks showinstead of copying it manually between environments. - Treat cluster migration as an issuer trust migration event.
- Validate token exchange with a canary pod before removing an older federated identity credential.
See Also¶
- Microsoft Entra Workload Identity
- Identity Model Comparison
- Audience Mismatch
- Token Exchange Failure