Desired state

What it is

Desired state is the declared target for infrastructure or configuration: the outcome a team intends a system to have. An IaC file or configuration manifest can describe that target, but the exact behavior when it is applied depends on the tool, deployment mode, and change plan.

Why it exists

Without a declared target, a team can see that a VM was changed but has no agreed reference for what it should be. Desired state makes the intended outcome explicit, versioned, reviewable, and testable. It helps prevent drift, but repeated application is safe only when the definition and the tool’s proposed changes have been reviewed.

Key ideas

  • Declarative descriptions focus on the intended outcome, not a sequence of manual commands. Bicep, ARM templates, Terraform, and configuration-management manifests use different engines and semantics, so verify each tool’s plan before changing production.
  • Idempotence is an aim, not permission to skip review. A tool may see no change for an already matching resource, but updates, replacements, dependencies, deployment mode, and omitted resources can produce important effects.
  • Convergence needs a feedback loop. Detect a change, decide whether it is desired, then either update the definition or apply the approved definition. Do not blindly overwrite an emergency change before understanding it.
  • Config management angle: tools like DSC / Ansible / Chef also enforce a desired state for inside-the-VM configuration (packages, services, registry), complementing template-level IaC which manages the resource layer.

How it fits (diagram)

Exam notes

  • Desired state is the agreed target; the change plan explains what the tool will actually do now.
  • Compare imperative “perform these steps” instructions with declarative “reach this outcome” definitions.
  • For ARM deployments, deployment mode and scope can materially affect omitted resources; always review what-if and current guidance before relying on a cleanup behavior.

infrastructure-as-code · bicep · arm-template · terraform · configuration-drift · immutable-infrastructure

📘 Source: Microsoft Learn — Desired State