azure-workload-identity: AADSTS700211 invalid_client
Describe the bug
I’m getting the error AADSTS700211: WorkloadIdentityCredential: Microsoft Entra ID error '(invalid_client) AADSTS700211: No matching federated identity record found for presented assertion issuer 'https://oidc.prod-aks.azure.com/879-...-a6425/'. Please check your federated identity credential Subject, Audience and Issuer against the presented assertion. https://docs.microsoft.com/en-us/azure/active-directory/develop/workload-identity-federation Trace ID: REDACTED Correlation ID: REDACTED Timestamp: 2023-12-08 16:17:27Z'
Steps To Reproduce
Deploy Workload Identity v1.2.0 inside an AKS cluster v1.27.7
Create an AAD Service Principal and a k8s service account using the azwi cli:
azwi serviceaccount create \
--service-account-name "saName" \
--skip-phases role-assignment \
--subscription-id "<SUB_ID>" \
--aad-application-name "<AAD_APP_NAME>" \
--service-account-issuer-url "https://oidc.prod-aks.azure.com/879-...-a6425/" \
--service-account-namespace <K8S_NAMESPACE>
Create a pod associating the SA and with a label azure.workload.identity/use: "true"
Trying to authenticate and get a Key Vault secret using Python 3.10 with DefaultAzureCredential(), using azure-identity==1.15.0 lib
Expected behavior
Get the secret value.
Logs
WorkloadIdentityCredential: Microsoft Entra ID error ‘(invalid_client) AADSTS700211: No matching federated identity record found for presented assertion issuer ‘https://oidc.prod-aks.azure.com/879-…-6425/’. Please check your federated identity credential Subject, Audience and Issuer against the presented assertion. https://docs.microsoft.com/en-us/azure/active-directory/develop/workload-identity-federation Trace ID: REDACTED Correlation ID: REDACTED Timestamp: 2023-12-08 16:55:37Z’
Environment
- Kubernetes version (use
kubectl version): AKS 1.27.7 - Cloud provider or hardware configuration: Azure Public Cloud
- OS (e.g:
cat /etc/os-release): Ubuntu 20.04.6 LTS - Kernel (e.g.
uname -a): 5.15.0-1051-azure #59-Ubuntu SMP Wed Oct 11 18:49:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux - Install tools:
- Network plugin and version (if this is a network-related bug):
- Others:
Additional context
AAD Service Principal is created without problems:
Fri, 08 Dec 2023 13:11:16 -03 role-assignment workflow/runner.go:133 skipping phase
Fri, 08 Dec 2023 13:11:20 -03 aad-application create/aadapplication.go:71 created an AAD application {"name": "$AAD_NAME", "clientID": "d861-...-7de", "objectID": "4e11-...-8eec"}
Fri, 08 Dec 2023 13:11:20 -03 serviceaccount/create.go:175 --service-principal-name not specified, falling back to AAD application name {"warning": true}
Fri, 08 Dec 2023 13:11:21 -03 aad-application create/aadapplication.go:95 created service principal {"name": "$AAD_NAME", "clientID": "d861-..-7de", "objectID": "9e0-..-9512"}
Fri, 08 Dec 2023 13:11:22 -03 service-account create/serviceaccount.go:94 created kubernetes service account {"namespace": "$K8S_NAMESPACE", "name": "$K8S_SA_NAME"}
Fri, 08 Dec 2023 13:11:24 -03 federated-identity create/federatedidentitycredential.go:96 added federated credential {"objectID": "4e11-...-8eec", "subject": "system:serviceaccount:$K8S_NAMESPACE:$K8S_SA_NAME"}
Name: REDACTED
Namespace: REDACTED
Labels: <none>
Annotations: azure.workload.identity/client-id: d861-...-7de
azure.workload.identity/tenant-id: 73d-...-26f
Image pull secrets: <none>
Mountable secrets: <none>
Tokens: <none>
Events: <none>
OIDC: az aks show -n $AKS_NAME -g $AKS_RG --query “oidcIssuerProfile.issuerUrl” -otsv
https://oidc.prod-aks.azure.com/879-...-a6425/
On AAD App Registration I can see all the values populated correctly (issuer, namespace, service account name).
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 18 (4 by maintainers)
having the same issue with flux addon and workload identity on AKS
I’ve just investigating the same issue. All including the OIDC Issuer URL look fine. Can’t figure what’s going on for already a week. Azure support couldn’t help, either.
We are encountering the same issue as the original poster. I have validated the federated credential against the JWT token mounted to the pods and everything seems to match. Any updates?