Interview Prep/Azure/Entra ID, RBAC and Identities

How do you avoid leaking credentials when using `az ad sp create-for-rbac`?

IntermediateConceptEntra ID, RBAC and Identities
Answer
  • Don't use it for CI at all when OIDC is available; create the app (or a user-assigned identity) and add a federated credential.
  • If you must, scope it: --role AcrPush --scopes <acrId>, never the default subscription Contributor.
  • Set a short lifetime: --years 1 is the coarse option; better, reset with az ad app credential reset --id <appId> --end-date 2026-06-30.
  • Store the output in Key Vault or the CI secret store immediately; never paste it into chat or tickets.
  • Turn on GitHub secret scanning with push protection, which recognises Entra client secrets.
Azure All Azure questions Roadmap: Azure core services

More on Entra ID, RBAC and Identities