Interview Prep/Azure/Identity and Authorization Errors

`AADSTS70021: No matching federated identity record found for presented assertion. Assertion Issuer: 'https://token.actions.githubusercontent.com'. Assertion Subject: 'repo:devopsshack/shop:ref:refs/heads/feature/login'.`

BeginnerTroubleshootingIdentity and Authorization Errors
Answer

Likely causes → The federated credential subject doesn't match: workflow ran on a different branch, uses an environment (subject becomes environment:<name>), was a PR, or org/repo name casing changed.

Diagnose →

az identity federated-credential list --identity-name id-shop-ci -g rg-ci \
  --query "[].{name:name, subject:subject, issuer:issuer}" -o table

Compare the subject in the error with the list exactly.

Fix →

  1. Add a federated credential for the needed subject, or run the job from the expected branch/environment
  2. If the job declares environment: prod, the subject must be repo:devopsshack/shop:environment:prod

Prevent → Standardise on environment-based subjects and document them next to the workflow.

Azure All Azure questions Roadmap: Azure core services

More on Identity and Authorization Errors