Azure 自动化:载入 DSC 节点:"vmname, The entity was not found."

Azure Automation: Onboarding DSC Node: "vmname, The entity was not found."

我正在尝试使用 Register-AzureRmAutomationDSCNode cmdlet 将 VM 载入 Azure Automation DSC,这是针对非经典 VM 推荐的 here。 DSC 节点配置已在 Azure 自动化中导入和编译。

这是我的代码:

$AutomationAccountName = "PersistentAutomationAccount"
$VMName = "VM1" 
$AutomationResourceGroup = "PersistantResources" 
$VMResourceGroup = "AutomatingAutomation2"
$NodeConfigurationName = "HelloWorldDSC.localhost"
Register-AzureRmAutomationDscNode -AutomationAccountName $AutomationAccountName -AzureVMName $VMName -ResourceGroupName $AutomationResourceGroup -AzureVMResourceGroup $VMResourceGroup -NodeConfigurationName $NodeConfigurationName

但我收到以下错误,我找不到解释:

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."
  }
}'

VM 名称正确,它存在,资源组名称正确,所以找不到什么?我认为 VM 可能需要预安装扩展,但根据 Azure 代表的说法,自动化的工作是在节点启动后安装 dsc agent/extension。

您的 VM 是否与您的自动化帐户位于不同的区域?如果是这样,您是否尝试过添加 AzureVMLocation 变量并包括 VM 区域?