Bitzu

AZ-400 ยท Secrets and sensitive information

Secretless authentication with workload identity federation

OIDC trust between GitHub Actions or Azure Pipelines and Microsoft Entra, federated credentials, subject claims, id-token permission, benefits vs stored secrets.

Key points

  • No stored client secret: a Microsoft Entra app (or user-assigned managed identity) trusts tokens from an external issuer.
  • Federated credential: issuer, subject, audience; Entra matches them, then issues an access token.
  • GitHub Actions: issuer token.actions.githubusercontent.com, audience api://AzureADTokenExchange, job needs permissions: id-token: write.
  • Nothing long-lived to rotate or leak.

Source: https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust

Practice questions

Single choice

Which workflow permission must a GitHub Actions job have so azure/login can request an OIDC token?

  1. contents: write
  2. id-token: write
  3. actions: read
  4. packages: write
Show answer

Answer: B. id-token: write

The job must be allowed to fetch an OIDC token, which is id-token: write. contents: write or actions: read do not mint tokens, and there is no oidc: read scope.

Select all that apply

Which are benefits of OIDC federation compared with a stored service principal secret?

  1. No long-lived credential to rotate or leak
  2. Azure role assignments are no longer needed
  3. Trust is limited to a specific issuer and subject, such as one repository and environment
  4. Any repository in the organization is trusted automatically
  5. The audience claim is ignored during token exchange
Show answer

Answer: A. No long-lived credential to rotate or leak, C. Trust is limited to a specific issuer and subject, such as one repository and environment

There is no long-lived secret to rotate or leak, and trust is bound to issuer and subject so only the intended workflow can exchange tokens. It does not remove the need for role assignments on Azure resources, and the audience is still checked.

True or false

True or false: you can use a wildcard such as repo:contoso/*:ref:refs/heads/* in a federated credential's subject to cover many repositories.

Show answer

Answer: False

False. Wildcards are not supported in any federated credential property, and subjects must match the token exactly. Cover many cases with several credentials (up to 20 per app) or an environment.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module