Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用powershell cmdlet将Azure Scaleset连接到Automation DSC_Azure_Powershell_Dsc_Azure Automation - Fatal编程技术网

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

无法使用powershell cmdlet将Azure Scaleset连接到Automation DSC,azure,powershell,dsc,azure-automation,Azure,Powershell,Dsc,Azure Automation,我正在尝试使用DSC扩展将Scaleset虚拟机连接到Azure Automation DSC服务器。这不是通过门户公开的,但从它看来,应该可以通过模板和powershell命令行来实现 我将事情归结为以下片段(屏蔽敏感变量): 在门户中,将列出扩展名。但是什么也没有发生:我既没有看到Automation DSC“Nodes”列表中列出的任何VM,也没有看到scaleset VM上的DSC活动-DSC的事件查看器为空;“c:\WindowsAzure\Logs”文件夹与DSC无关 我已经束手无策

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

我将事情归结为以下片段(屏蔽敏感变量):

在门户中,将列出扩展名。但是什么也没有发生:我既没有看到Automation DSC“Nodes”列表中列出的任何VM,也没有看到scaleset VM上的DSC活动-DSC的事件查看器为空;“c:\WindowsAzure\Logs”文件夹与DSC无关


我已经束手无策了,因为我觉得很快就要让它工作了,但是我没有得到任何关于什么是错误的反馈…

我已经设法获得了
添加AzureRmVmssExtension
作为
新AzureRMVMS
powershell管道流的一部分。我需要做两个改变:

1) 为了不将
$setting
$protectedSetting
哈希表编码为Json,我的原始代码片段使用哈希表上的
转换为Json
来获取字符串Json。在我的辩护中,这些参数的文档表明:“指定扩展的私有配置,作为字符串。”。我将提交一个文档错误


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

TypeHandlerVersion是一个强制参数。唉。我只需调用
获取AzureRmVMExtensionImage
即可动态发现最新版本
$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