AZ-400 ยท Infrastructure as code
IaC strategy and configuration management
Declarative vs imperative, idempotency, source control for infrastructure, testing and validation (what-if, linting), Ansible, Chef, Puppet, Terraform vs Bicep, picking a tool for a scenario.
Key points
- Infrastructure as code: environments in source-controlled files; changes go through pull requests, validation (lint, what-if) and a pipeline.
- Declarative (Bicep, ARM, Terraform): end result. Imperative scripts: steps.
- Idempotent: running twice gives the same state.
- Ansible: agentless, YAML playbooks.
- Chef, Puppet: agent-based, own DSLs.
- Terraform: multi-cloud, state file. Bicep: Azure only.
Source: https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/deploy-what-if
Practice questions
What does it mean that an IaC deployment is idempotent?
- Running it repeatedly results in the same final state
- It can only be run once per environment
- It always deletes and recreates every resource
- It must be executed from a developer workstation
Show answer
Answer: A. Running it repeatedly results in the same final state
Idempotent means repeated runs converge on the same state. Failing on the second run or duplicating resources is the opposite behavior.
Which practices belong in a sound IaC strategy?
- Keep templates in a Git repository
- Review infrastructure changes through pull requests
- Apply urgent fixes in the portal and skip the code
- Run a what-if preview before deploying
- Commit admin passwords in parameter files
Show answer
Answer: A. Keep templates in a Git repository, B. Review infrastructure changes through pull requests, D. Run a what-if preview before deploying
Source control, pull-request review and previewing changes make infrastructure changes auditable and safe. Portal hotfixes cause drift from the code, and committing secrets exposes them in history.
True or false: Ansible requires an agent installed on every managed node.
Show answer
Answer: False
False. Ansible is agentless and connects over SSH or WinRM. Chef and Puppet are the ones usually run with an agent.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
