Fix and maintain GitHub Actions sign-in to Azure with OIDC
What each OIDC sign-in error between GitHub Actions and Azure means and how to fix it, plus what to do after a rename, how to revoke access and keep it safe.
Most OIDC failures come down to one string that doesn't match, and the run log tells you which one. The setup is in Passwordless deploys with GitHub Actions and OIDC.
- The job gets a token from GitHub
Failed to fetch federated token (no id-token: write) - The login step gets all its IDs
Not all values are present - Entra ID finds the app in that tenant
AADSTS700016 - The app has a federated credential
AADSTS70025 - Issuer and subject match
AADSTS70021 · AADSTS700213 · AADSTS7002138 (letter case only) - A role covers the action at that scope
AuthorizationFailed
A job that names an environment sends the environment, not the branch
Run log, subject claimrepo:<owner>/<repo>:environment:production
Credential, subject identifierrepo:<owner>/<repo>:ref:refs/heads/main
→ AADSTS700213
1. Read the run log first
Open the failed run and expand Azure login. Once GitHub has issued a token, the step prints Federated token details: the issuer, the subject claim and the audience. No such lines? The job never got a token (first row below). Otherwise, compare the subject claim with your credential's Subject identifier, character for character.
2. Match the error
| What you see | Why | Fix |
|---|---|---|
Failed to fetch federated token from GitHub. Please make sure to give write permissions to id-token in the workflow. or Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable | The job lacks id-token: write | Add it under the job's permissions: |
Not all values are present. Ensure 'client-id' and 'tenant-id' are supplied. or Ensure 'subscription-id' is supplied or 'allow-no-subscriptions' is 'true'. | An input arrived empty: a typo in the name, or a secret read with vars. (or the reverse) | Match the names and the secrets. or vars. prefix |
AADSTS700016 (the application wasn't found in the directory/tenant) | Wrong client ID, or the right one sent to the wrong tenant | Copy both IDs again from the app's Overview |
AADSTS70025: Client application has no configured federated identity credentials | The app has no federated credential yet | Add one |
AADSTS700213: No matching federated identity record found for presented assertion subject | The subject differs: environment vs branch, name-based vs immutable format, a typo | Add a credential with the exact subject claim from the log |
AADSTS7002138 (matches with case-insensitive comparison, but not case-sensitive) | Only the letter case differs | Copy the subject claim's exact case |
AADSTS70021: No matching federated identity record found for presented assertion | The issuer or subject doesn't match, or the credential is only minutes old | Check the issuer. For a new credential, wait a few minutes and rerun |
does not have authorization to perform action ... over scope ... (code: AuthorizationFailed) | Signed in, but no role for that action at that scope | Assign the role on that resource, then allow up to 10 minutes |
3. After a rename or transfer
The owner and repository names are part of the subject, so a renamed or transferred repository sends a new one. From 15 July 2026, GitHub also moves such a repository to the immutable format. Add a credential for the new subject next to the old one, run the workflow, then delete the old credential. Both can stay while you test.
4. Revoke access
Delete the federated credential and new runs can't get an Azure token (changes take a few minutes to reach every region). Remove the role assignments too.
az ad app federated-credential list --id <client-id> --query "[].{name: name, id: id}" -o table
az ad app federated-credential delete --id <client-id> --federated-credential-id <credential-id>
az role assignment delete --scope <resource-id> \
--assignee "$(az ad sp show --id <client-id> --query id -o tsv)"- App registration → Certificates & secrets → Federated credentials → delete the credential.
- The resource → Access control (IAM) → Role assignments → remove the app's assignment.
5. Watch the sign-ins
In the Entra admin center, as at least Reports Reader: Entra ID → Monitoring & health → Sign-in logs → Service principal sign-ins. Your app's sign-ins should line up with your deploy runs. One you can't explain is a reason to revoke.
6. Guard who can deploy
Anyone who can push to the trusted branch can deploy. Make that a short list:
- Protect the branch, so changes arrive through reviewed pull requests.
- Use an environment with required reviewers. A job that names it waits for approval, and it can't read the environment's secrets until then. Trust the environment subject (
:environment:<name>) instead of the branch. - Own the workflow files. In
.github/CODEOWNERS, add the line below, and turn on Require review from Code Owners in the branch rule. Then no workflow changes without your approval. - Pin actions to full commit SHAs, as in the setup note.
/.github/workflows/ @<owner>Sources
- azure/login: AADSTS700213 and 7002138 (GitHub)
- Entra error codes: AADSTS700016 (Microsoft Learn)
- Workload identity errors: 700213, 70021, 70025 (Microsoft Learn)
- Federated credentials: propagation, AADSTS70021 (Microsoft Learn)
- Troubleshoot Azure RBAC: AuthorizationFailed (Microsoft Learn)
- Sign-in logs, service principal sign-ins (Microsoft Learn)
- Manage deployment environments (GitHub Docs)
- Secure use: pin actions, CODEOWNERS (GitHub Docs)