We earn commissions when you shop through the links below, at no extra cost to you. Our guides and technical recommendations are written independently of these relationships: a commission never decides what we recommend, how we diagnose a problem or what we publish, and the content does not depend on it. Affiliate disclosure

CI/CD · Azure · Intermediate · 12 min

Fix AADSTS700213 in GitHub Actions Azure login

Fix AADSTS700213 in GitHub Actions azure/login with OIDC: read the subject from the log, match the new repo@ID subject format, then id-token and role errors.

AADSTS700213 means Entra ID found no federated credential matching the token GitHub sent. This runbook reads the exact subject from the log, explains the subject format GitHub uses for repositories created after 15 July 2026, and fixes the id-token and No subscriptions found errors that follow. Every error was reproduced on a throwaway repository and our own Azure subscription.

azure/login with OpenID Connect lets a workflow sign in to Azure without a stored secret: GitHub hands the job a short-lived token, and Microsoft Entra ID accepts it if it matches a federated credential on your app registration. When it does not match, the login fails with AADSTS700213: No matching federated identity record found for presented assertion subject. This runbook finds the mismatch from the log, fixes it, and gets past the two errors that come right after it.

Everything below was run on 12 November 2026 against a throwaway GitHub repository and our own Azure subscription: Azure CLI 2.92.0, azure/login v3.1.0 pinned to its commit, GitHub-hosted ubuntu-latest runners. Names and IDs in the output are masked (OWNER, OWNER-ID, REPO-ID, <guid>).

0. Rules of engagement

  • Read the subject from the log first. azure/login prints the exact subject GitHub sent. Compare it character by character with the federated credential before you change anything.
  • Change one thing per run. The subject, then the permissions, then the role. Each fix reveals the next error, and that is progress.
  • Trust an environment, not a branch, for anything that deploys. A credential that trusts environment:production only works for jobs that use that environment, and the environment can require an approval. That is the control that blocks injected workflow steps, as in the wfx secret-stealer campaign.
  • No secrets in the repository. The client, tenant and subscription IDs are not passwords, but keep them in repository or environment secrets so they are masked in public logs.

1. Read the subject GitHub sent

Open the failed run and expand the azure/login step. Before the error, it prints the token details:

# Real output: a job without an environment, credential trusting environment:obf-prod
Federated token details:
 subject claim - repo:OWNER@OWNER-ID/testrepo@REPO-ID:ref:refs/heads/obf-lab
##[error]AADSTS700213: No matching federated identity record found for presented assertion subject 'repo:OWNER@OWNER-ID/testrepo@REPO-ID:ref:refs/heads/obf-lab'. Check your federated identity credential Subject, Audience and Issuer against the presented assertion.
##[error]Login failed with Error: The process '/usr/bin/az' failed with exit code 1. Double check if the 'auth-type' is correct.

Then list what your app registration trusts:

# The federated credentials on the app registration (APP_ID = the client ID used by azure/login)
az ad app federated-credential list --id APP_ID --query "[].{name:name, subject:subject, issuer:issuer, audiences:audiences}" -o json

The issuer must be https://token.actions.githubusercontent.com and the audience api://AzureADTokenExchange (the azure/login default). If those match, the subject is the problem, and there are two usual reasons: the subject format (section 2) and the subject type (section 3).

2. The subject format changed for new repositories

Most tutorials show subjects like repo:OWNER/REPO:environment:production. GitHub now sends a different format for repositories created after 15 July 2026: the owner and repository names are followed by their numeric IDs, repo:OWNER@OWNER-ID/REPO@REPO-ID:.... Older repositories keep the old format unless they opt in, and GitHub's documentation says a rename or transfer after 15 July 2026 also moves a repository to the new format, so a credential that worked for months can break the day someone renames the repository.

Update 14 November 2026. A branch credential written in the classic form failed the same way on a repository with the new format, and a one-line Terraform change of the subject fixed it. The Terraform for Azure and Google Cloud is in GitHub Actions OIDC to Azure and GCP with Terraform.

Even a job that uses the right environment fails if the credential uses the old format:

# Real output: job with environment obf-prod, credential subject repo:OWNER/testrepo:environment:obf-prod
 subject claim - repo:OWNER@OWNER-ID/testrepo@REPO-ID:environment:obf-prod
##[error]AADSTS700213: No matching federated identity record found for presented assertion subject 'repo:OWNER@OWNER-ID/testrepo@REPO-ID:environment:obf-prod'.

Ask GitHub which prefix your repository uses:

# The subject prefix GitHub uses for this repository (needs gh, signed in with access to the repository)
gh api repos/OWNER/REPO/actions/oidc/customization/sub
# Real output for a repository created in November 2026
{"use_default":true,"use_immutable_subject":true,"sub_claim_prefix":"repo:OWNER@OWNER-ID/testrepo@REPO-ID"}

use_immutable_subject: true means the new format. Build the credential subject from sub_claim_prefix and update the credential. az ad app federated-credential update takes a JSON file, not a --subject flag (we tried; it stops with the following arguments are required: --parameters):

# Rewrite the credential with the exact prefix plus the environment (the name stays the same)
PREFIX=$(gh api repos/OWNER/REPO/actions/oidc/customization/sub --jq .sub_claim_prefix)
printf '{"name":"gha-production","issuer":"https://token.actions.githubusercontent.com","subject":"%s:environment:production","audiences":["api://AzureADTokenExchange"]}' "$PREFIX" > fic.json
az ad app federated-credential update --id APP_ID --federated-credential-id gha-production --parameters fic.json
az ad app federated-credential show --id APP_ID --federated-credential-id gha-production --query subject -o tsv
# Real output (masked)
repo:OWNER@OWNER-ID/testrepo@REPO-ID:environment:obf-prod

Entra can take a few seconds to a minute to use the new value; re-run the job after that.

3. The subject type: environment, branch or pull request

The last part of the subject depends on the job, not on the repository:

The jobSubject ends with
has environment: NAME:environment:NAME (wins over the branch)
runs on a push or manual start, no environment:ref:refs/heads/BRANCH or :ref:refs/tags/TAG
runs for a pull request:pull_request

That is why the job in section 1 failed even with the right prefix: it had no environment:, so GitHub sent :ref:refs/heads/obf-lab while the credential trusts :environment:obf-prod. Fix the job, not the credential:

# The job that signs in to Azure: an environment, and permission to request the OIDC token
jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: production
    permissions:
      id-token: write
      contents: read
    steps:
      - uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
        with:
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

Each credential matches one exact subject (an app registration holds up to 20). Add a second credential for a branch only if a job really needs Azure without an environment, and never one for pull_request on a repository that accepts outside contributions.

4. Unable to get ACTIONS_ID_TOKEN_REQUEST_URL

If the job cannot even ask GitHub for a token, the error comes before Entra is involved:

# Real output: a job with environment obf-prod but no id-token permission
##[error]Failed to fetch federated token from GitHub. Please make sure to give write permissions to id-token in the workflow.
##[error]Login failed with Error: Error message: Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable. Double check if the 'auth-type' is correct.

The job needs permissions: id-token: write. Setting permissions: on a job replaces the defaults, so list contents: read too if the job checks out code. A workflow-level permissions: block works as well, but then every job in the file can request a token.

5. No subscriptions found

With the subject right, the login gets further and stops here:

# Real output: subject matches, but the app has no role on anything
 subject claim - repo:OWNER@OWNER-ID/testrepo@REPO-ID:environment:obf-prod
##[error]No subscriptions found for ***.
##[error]Login failed with Error: The process '/usr/bin/az' failed with exit code 1.

Entra accepted the token; Azure just has nothing this identity may see. Give the app's service principal a role on the smallest scope the job needs, here Reader on one resource group:

# A role for the app on one resource group (the service principal must exist: az ad sp create --id APP_ID)
az role assignment create --assignee APP_ID --role Reader --scope "$(az group show --name RG_NAME --query id -o tsv)"
# Real output (the CLI prints None for the role name here; the scope is masked)
None	/subscriptions/SUB/resourceGroups/obf-oidc

We re-ran the job a minute later. If you only need Entra or Microsoft Graph and no subscription at all, allow-no-subscriptions: true on azure/login is the alternative; it was not needed here.

6. Verify

# Real output: the same job after the role assignment; the step after login ran az group show
 subject claim - repo:OWNER@OWNER-ID/testrepo@REPO-ID:environment:obf-prod
Subscription is set successfully.
obf-oidc	Succeeded

The run shows Subscription is set successfully., the next az command works, and the job is green. In the Actions tab, the job waited for the environment approval before it started: that wait is the point.

7. Rollback and prevention

  • Roll back by deleting the credential (az ad app federated-credential delete --id APP_ID --federated-credential-id NAME) and the role assignment; nothing else changed. If you migrate from a stored client secret, keep the secret until the OIDC run is green, then delete it from the app and from GitHub.
  • Before a rename or transfer, add a credential with the new subject first, then rename, then remove the old one.
  • Keep the scope small: a role on a resource group, not the subscription, and an environment with required reviewers for anything that deploys.
  • Pin the action to a commit (azure/login@<sha> # v3.1.0), as above, so a moved tag cannot change what runs with your token.

Cleanup of our test: the app registration (which also removes its service principal and credential), the resource group, the repository secrets, the environment, the branch and the runs were deleted.

References

Official reference

docs.github.com ↗

Technical steps are original explanations; consult the upstream documentation for version-specific details.

Behavior differs by distribution and tool version. Commands are examples for authorized systems; review output for secrets before sharing.

Found this useful?

Follow us on YouTube for video explainers, and find us on Facebook to keep up with what is new.