Skill 3.3.4

Describe infrastructure as code (IaC)

Key Concepts

With IaC, the resources an environment needs, such as networks, VMs and databases, are described in files that are stored in source control alongside application code. The same files deploy the same infrastructure every time, which avoids configuration drift between environments, lets changes be reviewed and tracked, and allows an environment to be recreated quickly after a failure or for testing.

IaC can be imperative, where a script lists the commands to run in order (for example Azure CLI or Azure PowerShell scripts), or declarative, where a file describes the desired end state and the platform works out how to reach it. In Azure, declarative IaC uses ARM templates (JSON) and Bicep files; Terraform is a popular third-party declarative tool. Declarative templates are typically idempotent: deploying the same template again produces the same result.