Skip main navigation

Hurry, only 4 days left to get one year of Unlimited learning for £249.99 £174.99. New subscribers only. T&Cs apply

Find out more

Implementing Automation DSC

.

In the previous steps, you gained a basic understanding of DSC and how Automation DSC works. This step will demonstrate how to configure, implement and manage Azure IaaS with Automation DSC.

The DSC Configuration File

DSC configurations are Windows PowerShell scripts that define a special type of function.

Review this example of a simple configuration:

NOTE:

  1. The Configuration block is the outermost script block. In this case, the name of the configuration is LabConfig. Notice the curly brackets to define the block.
  2. There can be one or more node blocks. These define the nodes (computers and VMs) that you are configuring. In this example, the node targets a computer called WebServer. You could also call it localhost and use it locally on any server.
  3. There can be one or more resource blocks. This is where the configuration sets the properties for the resources. In this case, there is one resource block called WindowsFeature. Notice the parameters that are defined.
You can create the configuration in any editor, such as the PowerShell ISE. Save the file as a PowerShell script with a ps1 file type.

Import and Compile

After creating your DSC configuration file, you must import the file and compile it to the DSC pull server. Compiling will create the MOF file:
NOTE: If you prefer, you can use the PowerShell Start-AzureRmAutomationDscCompilationJob to compile the configuration file. There are two options to compile your Desired State Configuration (DSC) configurations: With Azure Automation in the Azure portal, or with Windows PowerShell.

Registering DSC Nodes

After your configuration is in place, you will select the Azure virtual machines or on-premises virtual machines that you would like to onboard:

For each machine, you will need to configure the registration data:.

  • Node Configuration Name. DSC configuration that will run on this node. Your configuration should show in the drop-down.
  • Refresh Frequency. Represents the frequency in minutes at which the PS DSC Local Configuration Manager contacts the Azure DSC pull server to download the latest node configuration.
  • Configuration Mode Frequency. Represents the frequency in minutes at which the background application of DSC attempts to implement the current node configuration on the target node.
  • Configuration Mode. Specifies how the Local Configuration Manager applies the configuration to the target nodes. ApplyandMonitor is the default. For other options, see Basic Settings.
  • Allow Module Override. Controls whether new configurations downloaded from the Azure Automation DSC pull server are allowed to overwrite the old modules already on the target server.
  • Reboot Node if Needed. Reboot the server if the configuration requires.
  • Action after Reboot. There are two choices: ContinueConfiguration and StopConfiguration.

Monitoring DSC Jobs

Each time that Azure Automation DSC performs a consistency check on a managed node, the node sends a status report back to the pull server. You can view these reports on the blade for that node.

Notice that you can also Unregister the node and Assign a different configuration to this node. For more information, see Troubleshooting DSC.

This article is from the free online

Microsoft Future Ready: DevOps Development, Implementation and Azure Automation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now