无法使用 powershell cmdlet 将 Azure Scaleset 连接到 Automation DSC

Cannot wire up Azure Scaleset to Automation DSC using powershell cmdlets

我正在尝试使用 DSC 扩展将 Scaleset VM 连接到 Azure Automation DSC 服务器。这不是通过门户公开的,但从 this documentation 看来,它应该可以通过模板和 powershell cmd 行实现。

我已经将事情简化为以下片段(屏蔽了敏感变量):

$settings = @{
    configurationArguments = @{
        registrationUrl = "https://ne-agentservice-prod-1.azure-automation.net/accounts/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx"
    }
}    
$protectedSettings = @{
    configurationArguments = @{
        registrationKey = @{
            userName = "NOT_USED"
            password = "/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="
        } 
    } 
}

Get-AzureRmVmss -ResourceGroupName $resourceGroupName -VMScaleSetName $VmSsName | 
    Add-AzureRmVmssExtension -Name "DSC" -Publisher "Microsoft.Powershell" -Type "DSC" -TypeHandlerVersion "2.24" -Setting $settings -ProtectedSetting $protectedSettings |
    Update-AzureRmVmss

在门户中,列出了扩展程序。但是什么也没有发生:我既没有在 Automation DSC "Nodes" 列表中看到任何 VM,也没有在规模集 VM 上看到 DSC activity - DSC 的事件查看器是空的; "c:\WindowsAzure\Logs" 文件夹与 DSC 无关。

我已经无计可施了,因为我觉得快要完成这项工作了,但是我没有得到关于哪里出了问题的反馈...

我已经设法将 Add-AzureRmVmssExtension 作为 New-AzureRmVmss powershell 管道流程的一部分。我需要进行两项更改:

1) 不将 $setting$protectedSetting 哈希表编码为 Json - 我的原始代码片段在哈希表上使用 ConvertTo-Json 来获取字符串 json.在我的辩护中,这些参数的文档表明:"Specifies private configuration for the extension, as a string."。我将提交文档错误。

2)(我认为这是主要原因),我将 TypeHandlerVersion 更新为 2.76,这是当前的最新版本 - 从 Internet 示例复制粘贴给了我 2.24。我要看看我是否可以完全不指定版本 - 我总是想要最新的。