Register Servers to Azure Automation DSC

Author by Rob Plank

In the previous blog post I showed you how to enable Azure Automation DSC Preview, now lets take a look at how we can register existing on premise servers to Azure Automation DSC.

Switch-AzureMode -Name AzureResourceManager
Add-AzureAccount
Select-AzureSubscription -SubscriptionName ""
$ResourceGroup = Get-AzureResourceGroup -Name ""
$MyAutomationAccount = $ResourceGroup | Get-AzureAutomationAccount -Name ""
$MyAutomationAccount | Get-AzureAutomationDscOnboardingMetaconfig -OutputFolder C:\temp\  -Force ##Make sure the directory exist already

Now we can move the DscMetaConfigs directory that was downloaded in the previous script, to a network share or a local machine.

This single command needs to be run on the local server that you want to register to Azure Automation DSC to set the local DSC Configuration to use Azure Automation as the Pull Server.

I installed the latest PowerShell v5 update on my test machine to get this next command to work, you can download it here.

Set-DscLocalConfigurationManager -Path "\DscMetaConfigs" –Verbose

as you can see below I now have one node registered with Azure Automation DSC

If you are registering a new Azure VM with Azure Automation DSC the process can be done at build time of the VM.

Author

Rob Plank

Systems Engineer