I'm trying to onboard a VM to Azure Automation DSC using the Register-AzureRmAutomationDSCNode
cmdlet as recommended here for non-classic vm's. The DSC nodeconfiguration has been both imported and compiled in Azure Automation.
Here is my code:
$AutomationAccountName = "PersistentAutomationAccount"
$VMName = "VM1"
$AutomationResourceGroup = "PersistantResources"
$VMResourceGroup = "AutomatingAutomation2"
$NodeConfigurationName = "HelloWorldDSC.localhost"
Register-AzureRmAutomationDscNode -AutomationAccountName $AutomationAccountName -AzureVMName $VMName -ResourceGroupName $AutomationResourceGroup -AzureVMResourceGroup $VMResourceGroup -NodeConfigurationName $NodeConfigurationName
But I'm getting the following error which I can't find an explanation for:
New-AzureRmResourceGroupDeployment : 10:56:57 AM - Resource
Microsoft.Compute/virtualMachines/extensions 'VM1/Microsoft.Powershell.DSC' failed with message '{
"error": {
"code": "NotFound",
"target": "vmName",
"message": "The entity was not found."
}
}'
The VM name is correct, it exists, the resourcesgroup names are correct, so what is not being found? I thought maybe the VM needed an extension preinstalled, but according to an Azure rep it's Automation's job to install the dsc agent/extension once the node is onboarded.
-AzureVMResourceGroup
– 4c74356b41Register-AzureRmAutomationDscNode
with the-debug
switch and see what is going on there – 4c74356b41