Study guide
11.2 Desired State Configuration & Azure Machine Configuration
Microsoft Certified: Azure DevOps Engineer Expert AZ-400
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Flow of Work, Traceability & Work Tracking
1.1 Flow of Work, GitHub Flow & Feedback Cycles 1.2 Work Tracking with Azure Boards & GitHub Projects 1.3 End-to-End DevOps Traceability & Quality Tracking
2 Chapter 2: DevOps Metrics, Dashboards & Team Collaboration
2.1 DORA Metrics, Flow Metrics & Dashboard Design 2.2 Lifecycle Metrics Across the Six DevOps Phases 2.3 Work Item Queries, WIQL Charts & Analytics 2.4 Project Documentation: Wikis, Mermaid Diagrams & Release Notes 2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
3 Chapter 3: Git Branching Strategies & Pull Request Workflows
3.1 Git Branching Models & Strategy Design 3.2 Pull Request Workflows & Merge Strategies 3.3 Branch Policies, Quality Gates & Compliance Restrictions
4 Chapter 4: Repository Management, Optimization & Git Data Operations
4.1 Git LFS Architecture & .gitattributes Tracking 4.2 LFS History Migration, git-fat & File Locking 4.3 Git Repository Scaling, Scalar & Monorepo Governance 4.4 Repository Permissions & Git Tag Governance 4.5 Git Data Recovery & Sensitive-Data Scrubbing
5 Chapter 5: Package Management & Dependency Versioning
5.1 Selecting Package Tools: Azure Artifacts vs. GitHub Packages 5.2 Feed Scoping, Upstream Sources & Pipeline Authentication 5.3 Package Views, Immutability & Quality Promotion 5.4 Dependency Versioning: SemVer, CalVer & Automated Versioning 5.5 Pipeline Artifact Versioning & Artifact Storage Strategy
6 Chapter 6: Pipeline Infrastructure, Agents & Integration
6.1 Selecting a CI/CD Solution: Azure Pipelines vs. GitHub Actions 6.2 GitHub-Azure Pipelines Integration & Hybrid Migration 6.3 Hosted vs. Self-Hosted Agents & Runners 6.4 VMSS Elastic Pools, Container Jobs & Agent Governance 6.5 Pipeline Triggers, Filters & Concurrency Management
7 Chapter 7: YAML Pipeline Architecture & Reusable Elements
7.1 YAML Pipeline Anatomy: Stages, Jobs, Steps & Workspaces 7.2 Job Execution Order: DAG Dependencies, Parallelism & Conditions 7.3 Reusable Elements: Templates, Parameters & Variables 7.4 Variable Groups, Secret Variables & Key Vault Linking 7.5 YAML Environments, Checks & Deployment Approvals
8 Chapter 8: Testing Strategy, Quality Gates & Code Coverage
8.1 Test Strategy Design: Local, Unit & Integration Testing 8.2 Load, Stress & Performance Testing in Pipelines 8.3 Test Execution Tasks, Agents & Results Integration 8.4 Code Coverage Analysis & SonarQube Integration 8.5 Quality Gates, Release Gates & Governance Checks
9 Chapter 9: Modern Deployment Strategies & Zero-Downtime Delivery
9.1 Progressive Delivery: Blue-Green, Canary & Ring Deployments 9.2 Minimizing Downtime: Deployment Slots & Rolling Updates 9.3 Feature Flags with Azure App Configuration & Feature Manager 9.4 Designing the High-Priority Hotfix Path 9.5 Ordered Dependency Deployments, Resiliency & Rollback
10 Chapter 10: Artifact Deployment & Database DevOps
10.1 Containerized Application Delivery: ACR, AKS & Container Apps 10.2 Binary, Web App, Function & Scripted Deployments 10.3 Database DevOps: State-Based & Migration-Based Strategies
11 Chapter 11: Infrastructure as Code (IaC) & Azure Deployment Environments
11.1 Infrastructure as Code Strategy: Bicep, ARM & Terraform 11.2 Desired State Configuration & Azure Machine Configuration 11.3 Azure Deployment Environments (ADE) & Developer Self-Service
12 Chapter 12: Pipeline Maintenance, Health & Modernization
12.1 Pipeline Health, Flaky Tests & Reliability Engineering 12.2 Pipeline Optimization: Caching, Slicing & Concurrency 12.3 Artifact & Build Retention Governance 12.4 Modernizing CI/CD: Classic to YAML Migration
13 Chapter 13: Authentication, Authorization & Identity Governance
13.1 Microsoft Entra Service Principals & Managed Identities 13.2 Service Connections, Workload Identity & Personal Access Tokens 13.3 Azure DevOps Projects, Teams & Permission Evaluation 13.4 Access Levels, GitHub Roles & Outside Collaborators
14 Chapter 14: Secrets Management, Sensitive Data & DevSecOps Scanning
14.1 Azure Key Vault, Secret Variables & Secretless CI/CD 14.2 Security Scanning Strategy, GHAS & Secret Scanning 14.3 CodeQL SAST in Pipelines and Containers 14.4 Software Supply Chain, Container Scanning & Cloud Defender
15 Chapter 15: Telemetry Collection, Azure Monitor & Alerting
15.1 Azure Monitor Architecture, AMA & Data Collection Rules 15.2 Application Insights & Specialized Azure Monitor Insights 15.3 Alerting Rules, Action Groups & GitHub Repository Insights
16 Chapter 16: Telemetry Analysis, Distributed Tracing & SRE Practices
16.1 Distributed Tracing, Application Map & Exception Triage 16.2 KQL Log Analytics, SRE Observability & Error Budgets
11.2 Desired State Configuration & Azure Machine Configuration
Key Takeaways Explain This Topic AI
Desired State Configuration (DSC) provides declarative operating system configuration, utilizing the Local Configuration Manager (LCM) to detect and remediate configuration drift on Windows and Linux nodes.
The Local Configuration Manager's ApplyAndAutoCorrect mode actively enforces baseline compliance by automatically correcting unauthorized modifications at each refresh interval.
Azure Automation State Configuration acts as a legacy managed DSC pull server, compiling PowerShell scripts into Managed Object Format (MOF) configurations and distributing them via the DSC virtual machine extension.
Azure Machine Configuration (formerly Azure Policy Guest Configuration) supersedes Automation DSC by embedding OS-level auditing and enforcement directly into Azure Policy without requiring an Automation Account.
Azure Arc extends Azure Machine Configuration to hybrid and multi-cloud servers, applying unified compliance baselines across on-premises, AWS, and Azure virtual machines through a single governance plane.
Last updated: September 2026
11.2 Desired State Configuration & Azure Machine Configuration
While Infrastructure as Code tools like Bicep and Terraform excel at provisioning cloud fabric resources (virtual networks, storage accounts, Kubernetes clusters, and virtual machines), they do not natively manage the software configurations inside virtual machine operating systems. Operating systems require software packages, system services, security registries, environment variables, and filesystem baselines.
Without continuous inside-the-OS management, virtual machines suffer from configuration drift : manual administrative interventions, uncoordinated patches, or software crashes that cause running servers to deviate from approved compliance baselines. For the AZ-400 exam, candidates must understand PowerShell Desired State Configuration (DSC), the mechanics of the Local Configuration Manager (LCM), the operational role of Azure Automation State Configuration, and the modern migration to Azure Machine Configuration (formerly Azure Policy Guest Configuration) powered by Azure Arc.
1. Configuration Drift and Continuous Compliance
Configuration drift occurs when an operational server's state gradually diverges from its defined specification. Examples include:
An engineer logging into a production VM via SSH or Bastion and manually editing a configuration file to resolve an emergency incident.
A Windows service crashing or being stopped manually and never restarted.
An unauthorized registry key modification that disables TLS 1.2 or weakens cipher suites.
Package updates applied to one server in a cluster but missed on others.
Continuous compliance requires an automated inside-the-guest agent that periodically checks the actual OS state against a declared baseline and remediates discrepancies without human intervention.
2. PowerShell Desired State Configuration (DSC) Architecture
PowerShell DSC is a declarative configuration platform built into Windows and cross-platform PowerShell. It separates the configuration specification from the execution mechanism.
DSC Script Anatomy
A PowerShell DSC script uses specialized declarative keywords:
Configuration : The top-level block defining the configuration container.
Node : Specifies the target host or computer names.
Resource Blocks : Declarative definitions of system components ( File , Archive , Environment , Group , Registry , Script , Service , User , WindowsFeature , WindowsProcess ). # Example: PowerShell DSC Configuration Script
- Configuration WebServerBaseline
- {
- param (
- [string[]]$NodeName = 'localhost'
- )
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
- Node $NodeName
- {
- # Enforce that IIS Web Server feature is installed
- WindowsFeature IIS
- {
- Ensure = 'Present'
- Name = 'Web-Server'
- }
- # Enforce that the World Wide Web Publishing Service is running
- Service W3SVC
- {
- Name = 'W3SVC'
- StartupType = 'Automatic'
- State = 'Running'
- DependsOn = '[WindowsFeature]IIS'
- }
- # Ensure production directory exists
- File WebDirectory
- {
- Ensure = 'Present'
- Type = 'Directory'
- DestinationPath = 'C:\inetpub\wwwroot\api'
- }
- }
- }
- # Compiling the configuration generates a localhost.mof file
- WebServerBaseline
- The Compilation Phase (MOF Generation)
A common exam point is that DSC configuration scripts ( .ps1 ) cannot be executed directly on target nodes . The PowerShell script must first be compiled into a Managed Object Format ( .mof ) document based on the Common Information Model (CIM) standard. The resulting MOF file contains the serialized desired state consumed by the target machine.
3. The Local Configuration Manager (LCM)
The Local Configuration Manager (LCM) is the operating system engine that executes on each target node (Windows and Linux). The LCM is responsible for receiving MOF configurations, testing the current state, and applying changes.
LCM Configuration Modes ( ConfigurationMode )
The behavior of the LCM is controlled by its ConfigurationMode property:
Configuration Mode Behavior and Drift Remediation Mechanics
ApplyOnly The LCM applies the configuration once during initial onboarding. It does not perform ongoing monitoring or automatic drift correction. If an administrator stops a service or deletes a directory later, the machine remains non-compliant.
ApplyAndMonitor The LCM applies the configuration once. At every regular evaluation interval ( ConfigurationModeFrequencyMins ), the LCM checks whether the system has drifted. It logs compliance status (Compliant/Non-Compliant) to the pull server and event logs, but makes no attempt to fix drift.
ApplyAndAutoCorrect The LCM applies the configuration once. At every evaluation interval ( ConfigurationModeFrequencyMins ), the LCM checks the machine state. If any drift is detected, the LCM immediately reapplies the desired configuration to force the system back into compliance automatically.
Critical LCM Operational Properties
ConfigurationModeFrequencyMins : Dictates how often (in minutes) the LCM evaluates the machine against the current configuration to check for drift and enforce compliance (Default: 15 minutes ).
RefreshFrequencyMins : In pull mode, dictates how often (in minutes) the LCM contacts the central pull server to check for updated MOF files (Default: 30 minutes ). RefreshFrequencyMins must be an integer multiple of ConfigurationModeFrequencyMins .
RebootNodeIfNeeded : When set to $true , permits the LCM to automatically reboot the target virtual machine if a resource requires a reboot to complete installation (e.g., certain Windows Server features).
ActionAfterReboot : Specifies whether the LCM continues configuration processing ( ContinueConfiguration ) or halts ( StopConfiguration ) following a system reboot.
4. Azure Automation State Configuration (Managed DSC Pull Server)
Azure Automation State Configuration provides a cloud-hosted, managed DSC pull server integrated into an Azure Automation account. ┌────────────────────────────────────────────────────────────────────────┐
- │ Azure Automation Account │
- │ ┌──────────────────────┐ ┌───────────────────────────┐ │
- │ │ DSC Scripts (.ps1) │──[Compile]───►│ Node Configurations (.mof)│ │
- │ └──────────────────────┘ └─────────────┬─────────────┘ │
- └───────────────────────────────────────────────────────┼────────────────┘
- │ Pull (Every 30m)
- ▼
- ┌───────────────────────┐
- │ Azure VM (LCM Engine) │
- │ - ApplyAndAutoCorrect│
- │ - Drift Evaluation │
- └───────────────────────┘
- Key Operational Steps in Azure Automation DSC
Upload Configuration : Author the PowerShell DSC script ( .ps1 ) and upload it to the Azure Automation Account under Configuration Management → State Configuration (DSC) → Configurations .
Compile Configuration : Trigger compilation within Azure Automation ( Start-AzAutomationDscCompilationJob ). This produces compiled Node Configurations ( ConfigurationName.NodeName ) stored in Azure Automation.
Register Nodes : Virtual machines are registered with the pull server using the Azure VM DSC extension ( Microsoft.Powershell.DSC for Windows, nx for Linux) or via PowerShell Register-AzAutomationDscNode .
Assign Node Configuration : Map the compiled node configuration to the registered virtual machine.
Monitor Compliance : The Azure Automation portal visualizes the status of each node: Compliant , Non-Compliant , Failed , or Pending .
5. Modern Evolution: Azure Machine Configuration (Azure Policy)
While Azure Automation State Configuration served as the standard for years, Microsoft has transitioned configuration management into Azure Machine Configuration (formerly known as Azure Policy Guest Configuration).
Why the Architecture Evolved
Elimination of Standalone Automation Accounts : Automation DSC required provisioning and maintaining dedicated Automation Accounts, managing separate access keys, and troubleshooting cloud compilation jobs.
Unified Governance Plane : Enterprise security demands governing the inside of a VM (e.g., auditing installed software, TLS settings, password policies) using the exact same policy definitions, scopes, and compliance dashboards that govern the outside of a VM (e.g., disk encryption, network security groups, tagging).
Native Policy Integration : Machine Configuration definitions are published directly as Azure Policy definitions and assigned via Management Groups, Subscriptions, or Resource Groups.
How Azure Machine Configuration Works
Agent Extension : Virtual machines require the Machine Configuration extension ( AzurePolicyforWindows or AzurePolicyforLinux ).
Managed Identity Requirement : The virtual machine must have a System-Assigned or User-Assigned Managed Identity enabled . The Machine Configuration agent uses this managed identity to authenticate against the Azure Policy service and retrieve configuration packages from secure storage.
Policy Effects :
auditIfNotExists : Audits settings inside the virtual machine without modifying them, generating compliance reports in Azure Policy.
deployIfNotExists : Automatically provisions the Machine Configuration extension and deploys custom remediation packages to fix non-compliant configurations inside the guest operating system.
Authoring Custom Machine Configuration Packages
Custom packages are built using PowerShell Core and the GuestConfiguration module:
Author a DSC configuration defining desired baseline settings.
Compile the DSC configuration into a MOF file.
Run New-GuestConfigurationPackage to package the MOF file and required dependencies into a signed .zip artifact.
Upload the .zip package to an Azure Blob Storage container accessible by the VM's managed identity.
Run Publish-GuestConfigurationPackage to generate and publish an Azure Policy definition referencing the package.
Hybrid and Multi-Cloud Governance via Azure Arc
Azure Machine Configuration natively supports hybrid physical and virtual machines running on-premises, in VMware, or across other clouds (AWS, GCP) via Azure Arc-enabled servers .
When the Azure Connected Machine agent is installed on an external server, Azure Arc exposes that machine as a first-class Azure Resource Manager resource ( Microsoft.HybridCompute/machines ).
Azure Machine Configuration policies apply identically to both native Azure VMs and Arc-enabled hybrid servers, establishing a single enterprise governance plane across the entire fleet.
6. Architecture Comparison Matrix
- Capability Azure Automation State Configuration (DSC) Azure Machine Configuration (Azure Policy)
- Core Management Plane Azure Automation Account Azure Policy Engine & ARM
- VM Agent / Extension Microsoft.Powershell.DSC Extension AzurePolicyforWindows / AzurePolicyforLinux
- Identity Requirement Registration Key and Account URL VM Managed Identity (System or User-Assigned)
- Policy Governance Disconnected from Azure Policy Fully integrated native Azure Policy definitions
- Remediation Trigger LCM internal timer ( AutoCorrect ) Azure Policy remediation tasks ( deployIfNotExists )
- Target Scope Individual Automation Account boundary Management Group, Subscription, Resource Group
- Hybrid Support Hybrid Runbook Worker registration Azure Arc-enabled servers ( Connected Machine Agent )
- Strategic Direction Legacy / Maintenance mode Microsoft strategic standard for OS governance
- 7. Realistic Exam Scenarios & Common Traps
- Scenario: Remediating Configuration Drift in Mission-Critical Clusters
Context : A security audit reveals that unauthorized administrators have disabled Windows Defender Firewall and altered TLS registry entries across 50 production VMs. The existing DSC configuration reports these machines as Non-Compliant in Azure Automation, but the settings are never corrected automatically. Root Cause & Fix : The virtual machines' Local Configuration Manager is configured with ConfigurationMode = 'ApplyAndMonitor' . In this mode, the LCM detects and logs drift but takes no corrective action. The DevOps engineer must update the LCM meta-configuration to ConfigurationMode = 'ApplyAndAutoCorrect' . At the next ConfigurationModeFrequencyMins interval, the LCM will automatically re-apply the baseline and restore the firewall and TLS settings.
Common Exam Traps to Avoid
Trap: Confusing RefreshFrequencyMins with ConfigurationModeFrequencyMins . RefreshFrequencyMins governs how often the machine checks the pull server for newly published configurations (default: 30 min). ConfigurationModeFrequencyMins governs how often the local LCM evaluates and auto-corrects drift against the currently cached configuration (default: 15 min).
Trap: Forgetting the VM Managed Identity requirement for Machine Configuration. If an Azure Policy assignment targeting guest configurations fails to evaluate or remediate a VM, verify whether the VM has a Managed Identity. Azure Machine Configuration relies on Managed Identity to access configuration packages in Azure Storage.
Trap: Attempting to deploy raw .ps1 scripts as DSC node configurations. The Local Configuration Manager cannot parse raw PowerShell scripts directly. The DSC script must be compiled into a .mof file before it can be assigned to a node.