【发布时间】:2017-06-26 14:02:16
【问题描述】:
我正在尝试使用 Register-AzureRmAutomationDSCNode cmdlet 将 VM 载入 Azure 自动化 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 名称正确,存在,resourcesgroup 名称正确,那么找不到什么?我认为 VM 可能需要预先安装一个扩展,但根据 Azure 代表的说法,一旦节点启动,安装 dsc 代理/扩展是自动化的工作。
【问题讨论】:
-
这种情况只发生在这个特定的虚拟机上吗?另外,我一直在使用它而没有
-AzureVMResourceGroup -
我会检查的。我需要该参数,因为我的自动化帐户和 vm 位于两个不同的资源组中。
-
您可能应该查看活动监视器并尝试找出传递给 dsc 扩展配置的内容
-
我创建了一个新的虚拟机并定位它,同样的错误发生了。我不知道如何理解那个 JSON,我在里面寻找什么元素(对象)?
-
好吧,试着找到正在被操作的虚拟机的名称\id,你也可能想用
-debug开关运行Register-AzureRmAutomationDscNode,看看那里发生了什么
标签: powershell azure dsc azure-automation