Infrastructure as Code (IaC)
What it is
Infrastructure as Code (IaC) is the practice of defining and managing your Azure infrastructure — VMs, networks, storage, policies — as machine-readable definition files stored in version control, instead of configuring resources by hand in the Portal or with one-off CLI commands. Tools like Bicep, ARM templates and terraform describe the target state and Azure (or the tool’s provider) makes the live environment match it.
Why it exists
Clicking through the Portal is fast for one box but not repeatable, auditable, or portable. IaC turns infrastructure into code so it gets the same benefits as application code: version history, code review, peer validation, rollback, reusability, and reproducibility across dev → test → prod. It also powers the DevOps loop — the same definition can run in CI/CD through a provisioning-pipeline.
Key ideas
- Declarative, not imperative: you say what you want (
a VM with this NIC and tier), not how to build it step by step. The engine figures out the diff and applies only the changes needed. - Idempotent: running the same definition twice converges to the same end state — no duplicate resources, no “already exists” errors.
- Versioned & reviewed: definitions live in git; changes go through pull requests and code review.
- Environments from the same source: one definition parametrized by environment (dev/stage/prod) gives parity and removes environment drift at deploy time.
- Supports both “speed” and “safety”: enables blue/green & canary rollouts and true immutable infrastructure.
How it fits (diagram)
Exam notes
- IaC = the umbrella term; Bicep/ARM templates are Azure-native, terraform is cross-cloud.
- Core exam contrast: imperative (CLI scripts,
azone-liners, runbooks) vs declarative (templates) — declarative + idempotent is the IaC ideal. - IaC is a pillar of the AZ-400 value stream: source control → CI → IaC → releases.
Related
bicep · arm-template · terraform · desired-state · configuration-drift · immutable-infrastructure · provisioning-pipeline
📘 Source: Microsoft Learn — Infrastructure As Code