PUBLIC BETA OFFER

Save 50% off on an Eligible Learning PlanValid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026

Design and implement infrastructure as code (IaC)

Distinguish infrastructure previews, configuration and enforcement

Separate resource topology, guest desired state and runtime application settings. Interpret previews within their omissions, package and assign machine configuration with the intended audit or correction behavior, and verify evaluation while respecting test privileges and cleanup ownership.

Knowledge domain
Design and implement build and release pipelines (35–40%)
Topics & tags
Published
Author
LearningPathX Editorial TeamContent version 1.0
Resources

Design and implement infrastructure as code (IaC)

Learning objectives

  • Distinguish resource topology, guest configuration and application configuration.
  • Interpret previews without treating them as complete drift or deployment evidence.
  • Build and assign a machine-configuration package with the intended enforcement behavior.
  • Explain the privileges and cleanup consequences of package testing and assignment.

Control the right object

Infrastructure as code describes resources and their relationships. Bicep/ARM-style definitions belong at this topology layer. Guest desired state concerns settings inside supported machines; Azure machine configuration can audit or apply them. Application configuration concerns settings and feature controls consumed by a running application; Azure App Configuration externalizes these values and complements Key Vault for protected secrets.

Select a mechanism by the object being controlled. A resource deployment does not establish that a guest setting is compliant or that an application refreshed a new setting. Likewise, centralizing application settings does not make App Configuration a replacement for a secret store.

Preview the intended IaC scope and parameters before an authorized apply. Inspect reported change types, ignored resources, unresolved expressions and exclusions. A what-if result is limited evidence: it does not prove that all drift is absent. Parsing a template establishes neither target permissions nor runtime success. After applying, inspect the deployment result and relevant resources separately, then verify any application-level refresh or consumption.

Decide observation versus enforcement

Choose Audit when reporting compliance is sufficient. Apply-and-monitor suits an approved initial configuration followed by drift reporting. Apply-and-autocorrect fits a deliberate requirement to keep restoring the desired state. These choices have operational consequences; continuous correction can undo changes someone makes manually.

Package capability and assignment behavior are distinct. A package capable of setting configuration does not independently choose continuous autocorrection. For application settings, also select the actual source, refresh behavior and protected-secret references. Do not claim that an infrastructure task's success proves that the process loaded the latest value.

Package the actual desired configuration

Azure machine configuration packages use a compiled DSC MOF together with required modules/dependencies. New-GuestConfigurationPackage accepts Name, the full Configuration path, optional output Path, and a package Type of Audit or AuditAndSet. Required modules must be available through PSModulePath so packaging includes them.

For an illustrative audit package whose MOF already exists:

New-GuestConfigurationPackage -Name 'ExampleConfig' `
  -Configuration './ExampleConfig/ExampleConfig.mof' -Type Audit

The MOF must describe real approved settings; the command does not create that policy intent. Packaging itself does not require elevation. Do not extend this statement to the later machine-affecting test.

Publish the resulting ZIP at an appropriate HTTPS content URI and compute its SHA-256 contentHash. The assignment name must match the configuration inside the MOF. Custom content does not use the built-in-package version field as its versioning authority. If bytes change, update the hash and perform the relevant review rather than silently replacing content behind an unchanged claim.

Assign capability with the intended behavior

Create a Microsoft.GuestConfiguration/guestConfigurationAssignments resource directly or through Azure Policy. Set the intended assignmentType: Audit, ApplyandMonitor or ApplyandAutoCorrect. An AuditAndSet package is only a capability prerequisite for setting; it does not force the third behavior.

Supply configurationParameter overrides using the actual DSC resource/type/name format. Inspect complianceStatus after evaluation. A created assignment and a compliant evaluated machine are different states. Application settings likewise need their own effective-value/refresh observation rather than an assumed result.

Consider an illustrative requirement to inspect a setting without changing it. An Audit package and Audit assignment preserve that intent. If the policy instead requires an initial approved correction followed by drift reporting, select a setting-capable package with ApplyandMonitor. If continuous restoration is intended and authorized, ApplyandAutoCorrect expresses that behavior. The deciding input is the required effect, not simply the presence of a ZIP. These are design outcomes, not observed machine results.

Treat package tests as real operations

Get-GuestConfigurationPackageComplianceStatus -Path <package> checks MOF placement, dependency versions and Test/Get results, with optional signature verification. Its first invocation installs the guest-configuration agent into protected machine locations and requires elevation. It is therefore not harmless static package linting. Run it only on an appropriate authorized machine and record actual results. No such test was executed for this lesson.

Retirement also follows ownership. Deleting an Azure Policy assignment can remove its created guest assignment. Removing a policy from an initiative can require manual cleanup. Manually created guest assignments need manual cleanup or removal with the parent machine. Identify the actual creator and remaining assignment before assuming enforcement is gone; otherwise an unwanted correction can persist after the policy discussion has ended.

Summary

Use IaC for topology, machine configuration for guest settings and application configuration for runtime-consumed values. Interpret previews within their omissions, distinguish package capability from assignment behavior, and verify actual evaluation or consumption after authorized changes. Package tests and cleanup can affect machines and enforcement, so preserve their real privilege and ownership boundaries.

PUBLIC BETA OFFER

Save 50% off on an Eligible Learning Plan

Valid for 1-month plan, 3-month plan, 12-month plan · Code LPXBETA50 · Ends Dec 6, 2026