1
votes

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.

1
does this happen only to this particular vm? also, I've been using it without -AzureVMResourceGroup 4c74356b41
I'll check. I needed that parameter because my automation account and vm are in two different resource groups.AllTradesJack
you should probably look at the activity monitor and try to figure out what is getting passed to the dsc extension provisioning4c74356b41
I created a new vm and targeted it and the same error happens. I don't know how to make sense of that JSON, what elements (objects) am I looking for in there?AllTradesJack
well, try to find the name\id of the vm that is being acted upon, also you might want to run the Register-AzureRmAutomationDscNode with the -debug switch and see what is going on there4c74356b41

1 Answers

6
votes

Is your VM in a different region from your automation account? If so, have you tried adding the AzureVMLocation variable and including the VM region?