Interview Prep/Azure/CI/CD and IaC

A pipeline needs to deploy to dev, test and prod in different subscriptions. How do you handle identities?

AdvancedScenarioCI/CD and IaC
Answer

Situation read → One identity per environment, each federated to its environment.

What I'd do →

  1. Three user-assigned identities, each with roles only in its subscription
  2. Federated credentials: repo:org/shop:environment:dev, ...:test, ...:prod
  3. Each workflow job sets environment: and uses that environment's AZURE_CLIENT_ID (stored as environment variables in GitHub)
  4. Prod environment has required reviewers and branch restrictions

Why → A compromised dev job can't touch prod, because it can never get the prod token.

Interview tip → Environment-scoped federation is the key phrase.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on CI/CD and IaC