Interview Prep/DevSecOps/Cloud identity: IRSA, Workload Identity and CI OIDC

An AKS app using `DefaultAzureCredential` fails with `ManagedIdentityCredential authentication unavailable` / `WorkloadIdentityCredential authentication unavailable`

BeginnerTroubleshootingCloud identity: IRSA, Workload Identity and CI OIDC
Answer

Likely causes → The pod is missing the label azure.workload.identity/use: "true", so the webhook never injected AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE. The SA may also lack the azure.workload.identity/client-id annotation.

Diagnose →

kubectl get pod <pod> -o jsonpath='{.metadata.labels}'
kubectl exec <pod> -- env | grep AZURE_

Fix → Add the label to the pod template (not just the Deployment), annotate the SA with the identity's client ID, and restart the pods.

Prevent → Validate both with a Kyverno policy for namespaces that use workload identity.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Cloud identity: IRSA, Workload Identity and CI OIDC