首页 > 解决方案 > 从 arm 模板向 DSC 传递凭证

问题描述

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

DSC 和 MOF

谢谢

标签: azureazure-resource-manager

解决方案


这对我有用。电源外壳:

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"
            }
        }
    }
}

推荐阅读