从手臂模板向DSC传递凭据

时间:2019-02-13 16:07:41

标签: azure azure-resource-manager

我正在尝试通过arm模板将用户凭证传递给我的DSC脚本。似乎模板没有正确将凭证传递给dsc。

DSC and MOF

谢谢

1 个答案:

答案 0 :(得分:1)

这是对我有用的东西。 Powershell:

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

xxx

手臂模板:

"properties": {
    "publisher": "Microsoft.Powershell",
    "type": "DSC",
    "typeHandlerVersion": "2.20",
    "autoUpgradeMinorVersion": true,
    "settings": {
        "configuration": {
            "url": "https://url.zip",
            "script": "file.ps1",
            "function": "configuration"
        },
        "configurationArguments": {
            "param": "something"
        }
    },
    "protectedSettings": {
        "configurationArguments": {
            "adminCreds": {
                "userName": "actualusername",
                "password": "actualpassword"
            }
        }
    }
}