
close
close
In today’s Ask the Admin, I’ll show you how to create an Azure Automation account, upload and compile a DSC configuration, and on board an Azure VM.
advertisment
In Introduction to Azure Automation Desired State Configuration on the Petri IT Knowledgebase, I explained how Azure Automation Desired State Configuration (DSC) relieves organizations of some of the infrastructure requirements of PowerShell DSC, along with other advantages, including controlling who can access DSC configurations, assign them to nodes, and check node configuration compliance. Today we’re going to get down to business and configure Azure Automation DSC.
Before we can test out Azure Automation DSC, we’ll need a DSC script. For the purposes of this demonstration, we’ll use a basic script that checks for the presence of a text file (test.txt). If the file is not present, it’s created.
Configuration FileResourceDemo { Node "localhost" { File CreateFile { DestinationPath = 'C:\Test.txt' Ensure = "Present" Contents = 'Hello World!' } } }
You can copy the above code into Notepad or the Windows PowerShell ISE. Save the script to your PC as TestDSC.ps1
Azure Automation DSC requires an Azure Automation account in addition to the Microsoft account associated with your subscription. If you don’t already have an Azure Automation account, create one using the steps below.
advertisment
Add an Azure Automation account (Image Credit: Russell Smith)
You’ll need to wait a few minutes for the accounted to be created. To check if the account has been created successfully:
Add an Azure Automation account (Image Credit: Russell Smith)
Now that we have created an Azure Automation account, let’s add the DSC configuration script that we created earlier to Azure.
Add a DSC node (Image Credit: Russell Smith)
Again, we’ll need to wait a few minutes for DSC script to be compiled into a MOF file.
The final step is to on board a VM (node) and assign the DSC configuration. Note that it’s also possible to on board VMs hosted by cloud providers other than Microsoft, and on premise servers.
advertisment
Add a DSC node (Image Credit: Russell Smith)
Adding the node can take up to ten minutes. It could take even more time for the configuration to apply to the node(s), depending on the refresh and configuration mode frequencies set. But you should connect to the node using RDP and check if test.txt was created.
More from Russell Smith
advertisment
Petri Newsletters
Whether it’s Security or Cloud Computing, we have the know-how for you. Sign up for our newsletters here.
advertisment
More in Cloud Computing
Use Azure ExpressRoute Private Peering & Azure Virtual WAN to Connect Privately to Microsoft 365
Apr 21, 2022 | Flo Fox
Microsoft to Make Changes to Cloud Licensing Restrictions after Customer Complaints
Apr 18, 2022 | Rabia Noureen
Most popular on petri
Log in to save content to your profile.
Article saved!
Access saved content from your profile page. View Saved
Join The Conversation
Create a free account today to participate in forum conversations, comment on posts and more.
Copyright ©2019 BWW Media Group