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/Modifyto 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.
More on Azure DevOps, Bicep and Terraform
What services make up Azure DevOps?BeginnerWhat are branch policies in Azure Repos?BeginnerExplain the YAML pipeline structure in Azure Pipelines.BeginnerWhat are service connections and how should they authenticate?IntermediateWhat are environments in Azure Pipelines?IntermediateWhat deployment strategies do deployment jobs support?Intermediate