在JSON DSC中找不到AdminCreds参数

时间:2019-01-10 11:43:34

标签: azure powershell arm-template dsc azure-template

我正在尝试将扩展名添加到天蓝色的手臂模板,因此当它循环时,它会将扩展名添加到每个vm,但是在无法识别凭据参数的地方出现错误。

完整的JSON位于以下链接:

https://pastebin.com/embed_iframe/7uvwdZ6e

我得到的错误是:

VM has reported a failure when processing extension 'CreateADPDC'. Error message: "The DSC Extension received an incorrect input: A parameter cannot be found that 
matches parameter name 'AdminCreds'.
Another common error is to specify parameters of type PSCredential without an explicit type. Please be sure to use a typed parameter in DSC Configuration, for example:
    configuration Example {
        param([PSCredential] $UserAccount)

知道我在哪里出错了吗?

预先感谢:)

1 个答案:

答案 0 :(得分:1)

此错误来自您的配置\ arm模板交互,如果那里有AdminCreds凭据参数,我认为您需要使用protectedsettings来传递它:

"protectedSettings": {
    "configurationArguments": {
        "adminCreds": {
            "userName": "xxx",
            "password": "yyy"
        }
    }
}

配置应如下所示(因此应包含具有特定类型的adminCreds输入参数):

Param (
    [System.Management.Automation.PSCredential]$Admincreds,
    other_params
)