Bitzu

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

Single choice

What does it mean that an IaC deployment is idempotent?

  1. Running it repeatedly results in the same final state
  2. It can only be run once per environment
  3. It always deletes and recreates every resource
  4. 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.

Select all that apply

Which practices belong in a sound IaC strategy?

  1. Keep templates in a Git repository
  2. Review infrastructure changes through pull requests
  3. Apply urgent fixes in the portal and skip the code
  4. Run a what-if preview before deploying
  5. 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

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.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module