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 1is the coarse option; better, reset withaz 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.
More on Entra ID, RBAC and Identities
What is Microsoft Entra ID and how is it different from on-prem Active Directory?BeginnerWhat is the difference between an app registration and a service principal?BeginnerWhat is a managed identity and what problem does it solve?BeginnerSystem-assigned vs user-assigned managed identity: when do you use each?IntermediateHow does Azure RBAC evaluate access?IntermediateName the core built-in roles and the difference between Owner, Contributor and User Access Administrator.Beginner