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.
First we need to export meta configurations from Azure.
Switch-AzureMode -Name AzureResourceManager
Select-AzureSubscription -SubscriptionName "<Subscription Name>"
$ResourceGroup = Get-AzureResourceGroup -Name "<Resource Group Name>"
$MyAutomationAccount = $ResourceGroup | Get-AzureAutomationAccount -Name "<AccountName>"
$MyAutomationAccount | Get-AzureAutomationDscOnboardingMetaconfig -OutputFolder C:\temp\ -Force ##Make sure the direcory 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 "<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.