AADSTS700213: No matching federated identity record found for presented assertion subject
'repo:my-org/my-repo:ref:refs/heads/main'. Please check your federated identity credential
Subject, Audience and Issuer against the presented assertion.
Short answer: Microsoft Entra ID compares the token’s sub claim with the subject of each
federated identity credential exactly and case-sensitively. The error means none matches. The
subject GitHub sends depends on the trigger, the job’s environment: and the repository’s subject
format, so it is often not the one you expect.
Fastest way to see the exact cause:
pip install wiaudit
az login
wiaudit collect azure -o azure-snapshot.json --all-subscriptions
cd my-repo
wiaudit doctor --azure ../azure-snapshot.json
wiaudit doctor prints, for each job that uses azure/login, the subject GitHub will send, whether a
credential accepts it, the closest credential and a hint. It is read-only.
| Workflow situation | Subject GitHub sends |
|---|---|
Job has environment: prod (any trigger) |
repo:ORG/REPO:environment:prod |
push to branch main, no environment |
repo:ORG/REPO:ref:refs/heads/main |
push of tag v1.2.0, no environment |
repo:ORG/REPO:ref:refs/tags/v1.2.0 |
pull_request, no environment |
repo:ORG/REPO:pull_request |
| Repo created, renamed or transferred on/after 2026‑07‑15 | repo:ORG@ORG_ID/REPO@REPO_ID:… (details) |
environment:The environment subject replaces the branch subject. A credential for
ref:refs/heads/main will not match a job with environment: prod.
Fix: add a credential with subject repo:ORG/REPO:environment:prod.
pull_requestThe subject is repo:ORG/REPO:pull_request, with no branch.
Fix: add that credential, ideally on a separate identity with read-only roles, because anyone
who can open a pull request from a branch can use it.
Classic credentials do not support wildcards, so ref:refs/tags/* does not match v1.2.0.
Fix: use a flexible federated identity credential with a claims matching expression such as
claims['sub'] matches 'repo:ORG/REPO:ref:refs/tags/*' and claims['repository_id'] eq '123456'.
Always bind repository_id (or repository_owner_id), otherwise the wildcard can be satisfied by
another repository with a matching name.
For repositories created, renamed or transferred on/after 2026‑07‑15, GitHub sends
repo:ORG@ORG_ID/REPO@REPO_ID:…. Name-based credentials stop matching.
Fix: see immutable subject. wiaudit doctor computes the exact value.
My-Org/My-Repo and my-org/my-repo are different subjects for Entra ID.
Fix: copy the subject exactly from the error message.
The subject contains the new name (and, after a transfer, a new owner).
Fix: update the credential. Also delete credentials that still point at the old name: if
someone registers that name, they inherit the trust (wiaudit scan, rule WIA007).
id-token: writeWithout it GitHub issues no OIDC token at all; the error then comes from azure/login, not Entra ID.
Permissions set on a job replace the workflow-level ones.
Fix: add permissions: id-token: write to the job that runs azure/login.
Issuer must be https://token.actions.githubusercontent.com, audience normally
api://AzureADTokenExchange (errors AADSTS700211 / AADSTS700212).
| Error | Meaning |
|---|---|
| AADSTS700211 | Issuer does not match |
| AADSTS700212 | Audience does not match |
| AADSTS700213 | Subject does not match (this page) |
| AADSTS70021 | No matching record, typically Azure DevOps service connections |
Made by the authors of wiaudit (open source, Apache-2.0).