Azure Automation : Desired State Configuration (DSC)

PowerShell is a task-orientated shell and scripting solution for Windows system administrators. But PowerShell DSC extends on that idea and provides a declarative syntax that enables people who don’t know anything about the particular IT resources they want to deploy to configure and maintain a particular state for that IT resource, even if they don’t know how to achieve that goal from a technical point of view.

PowerShell allows us to provide a configuration for each server, and ensure that every time the server is deployed, it gets deployed in exactly the same way with the same configuration, and that configuration is maintained for the lifetime of the device.

PowerShell DSC Deployment Models

Push Model
  • Pull Model : The pull model is the most commonly-used model and the model that Azure Automation DSC uses. An advantage of the pull model is that the Local Configuration Manager every few minutes will check in to the pull server to make sure that no updated configuration has been made available. Of course if it finds an updated configuration, then that is downloaded to the machine and applied as required.

Azure Automation DSC

  • Easier to configure
  • Integration with existing PowerShell Systems
  • Flexibility
  • The pull server provided by Azure Automation DSC can be used to store all DSC configurations and resources.
  • Reporting allows you to keep track of the compliant state.

DSC Terminology:

  • Resource : Building blocks containing knowledge about how to deploy resources step-by-step.
  • A DSC configuration is the configuration file that contains PowerShell DSC code in declarative syntax.
  • Compilation Job : Generate one or more node configurations from DSC configuration file.
Azure Automation DSC Lifecycle. (Image Credit : MicroSoft)

Azure Automation

Creating DSC Configuration file:

This DSC Configuration file can be uploaded to DSC configuration blade on Automation Account and once complied, automatically DSC Node configuration is created by Complication Node.

Azure Automation Assets

DSC Resources

DSC Reporting

$Node = Get-AzureRmAutomationDscNode -ResourceGroupName “ResourceGroup03” -AutomationAccountName “Contoso17” -Name “Computer14”Get-AzureRmAutomationDscNodeReport -ResourceGroupName “ResourceGroup03” -AutomationAccountName “Contoso17” -NodeId $Node.Id -Id c0a1718e-d8be-4fa3–91b6–82e1d3a36298

And to Exports the raw content of a DSC report sent from a DSC node to Automation use cmdlet : Export-AzureRmAutomationDscNodeReportContent



An Azurer, Web developer, Technologist, Writer, Poet, Runner. Opinions are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Milind Chavan

An Azurer, Web developer, Technologist, Writer, Poet, Runner. Opinions are my own.