Azure自动化:Onboarding DSC节点:"vmname,未找到实体."

All*_*ack 1 powershell azure dsc azure-automation

我正在尝试使用Register-AzureRmAutomationDSCNodecmdlet 将VM加载到Azure Automation DSC ,是非经典vm的推荐.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
Run Code Online (Sandbox Code Playgroud)

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

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."
  }
}'
Run Code Online (Sandbox Code Playgroud)

VM名称是正确的,它存在,资源组名称是正确的,所以没有找到什么?我想也许虚拟机需要预先安装扩展,但根据Azure代表,自动化的工作是在节点启用后安装dsc代理/扩展.

小智 5

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