Interview Prep/Azure/Entra ID, RBAC and Identities

What does a federated credential for GitHub Actions look like and what is the subject format?

AdvancedConceptEntra ID, RBAC and Identities
Answer
az identity federated-credential create \
  --name gh-prod --identity-name id-shop-ci --resource-group rg-shop-ci \
  --issuer https://token.actions.githubusercontent.com \
  --subject repo:devopsshack/shop:environment:prod \
  --audiences api://AzureADTokenExchange

Subject formats GitHub emits:

  • repo:ORG/REPO:ref:refs/heads/main for a branch
  • repo:ORG/REPO:environment:prod when the job uses an environment
  • repo:ORG/REPO:pull_request for PR workflows
  • repo:ORG/REPO:ref:refs/tags/v1.2.3 for tags

Subjects must match exactly (newer flexible federated credentials allow wildcard-style claim matching, but exact match is the safe default). Binding to an environment lets GitHub's environment protection rules gate who can get a prod token.

Azure All Azure questions Roadmap: Azure core services

More on Entra ID, RBAC and Identities