Interview Prep/Azure/Azure DevOps, Bicep and Terraform

How do you detect and handle drift between Azure and IaC?

AdvancedConceptAzure DevOps, Bicep and Terraform
Answer
  • Terraform: scheduled terraform plan -detailed-exitcode (exit 2 = changes) in CI that alerts on drift.
  • Bicep: scheduled what-if, or deployment stacks with deny settings to prevent drift outright.
  • Policy: Deny/Modify to stop portal changes that violate standards.
  • RBAC: remove write access for humans in prod; changes go through PRs, with PIM for emergencies.

When drift is found, decide whether to revert (re-apply) or codify (update code, then apply). Use lifecycle { ignore_changes = [...] } only for fields legitimately managed elsewhere, like AKS default_node_pool[0].node_count under the autoscaler.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on Azure DevOps, Bicep and Terraform