This is the 3rd Part of 3 part Mastering Azure Automation Blog Series.
|1||Mastering Azure Automation (Part 1 of 3 Learning ARM Templates)|
|2||Mastering Azure Automation (Part 2 of 3 Learning Azure runbooks)|
|3||Mastering Azure Automation (Part 3 of 3 Learning Desired State configurations)|
Desired State Configuration (DSC)
Azure Automation DSC is a cloud-based solution for Windows PowerShell DSC. The solution lets you manage, deploy, and enforce configurations for physical or virtual machines. Automation DSC uses declarative PowerShell syntax to define your configurations. A centralized pull server retrieves and applies configurations to a set of computers (also known as target nodes).
The following are some example scenarios where you can use built-in DSC resources to configure and manage a set of target nodes in an automated way.
- Enabling or disabling server roles and features.
- Managing files and directories.
- Starting, stopping, and managing processes and services.
- Deploying new software or software updates.
- Fixing a configuration that has drifted away from the desired state.
Moving along in our view of Azure Automation, we’re going to take a look at
Azure Automation for Desired State Configuration. Now this is built on the
exact same technology that is used in Windows Server.
So if you’re familiar with Windows Server Desired State Configuration then what you do in Azure is literally no different. You can take a Desired State Configuration script that you’ve written to run on premises and put that directly into Windows Azure in an Automation Account. You can author these in Azure directly or you can author them in
Windows PowerShell or Windows PowerShell ISE. What Azure does is Azure
provides the role of being the DSC pull server.
It provides the location or the compiled DSC items are placed and then assigned out to individual Virtual Machines. So any as a very quick kind of going to give this a little bit
of context, I have what are called DSC Configurations and what are called DSC Nodes. DSC Configurations are PowerShell scripts that I’m going to upload that represent definitions that I want to use.
DSC Configuration File
DSC configurations are PowerShell scripts that define a special type of function. Review this simple configuration.
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.
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.
Here are two short Video Explaining Desired State Configuration