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 →
- Three user-assigned identities, each with roles only in its subscription
- Federated credentials:
repo:org/shop:environment:dev,...:test,...:prod - Each workflow job sets
environment:and uses that environment'sAZURE_CLIENT_ID(stored as environment variables in GitHub) - 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.
More on CI/CD and IaC
Design a GitHub Actions pipeline that builds an image, pushes to ACR and deploys to AKS with no secrets.IntermediateYour organisation uses Azure DevOps. Set up a secure deployment pipeline to AKS.IntermediateYou need to promote the same image from dev to staging to prod. How do you design it?IntermediateTerraform state for prod is in a storage account accessible with account keys. Harden it.IntermediateYour team wants to move from ARM JSON templates to Bicep. How do you migrate?BeginnerThe Terraform plan for a small change shows the AKS cluster will be replaced. What do you do?Advanced