Passing Parameter Values to DSC Configuration from

2019-07-30 09:15发布

I have a simple DSC Config file that contains a credential and string input parameter. I want this DSC configuration deployed with a VM deployed in an ARM template but am missing the concept of how to pass these two parameters securely. How do I accomplish this?

enter image description here

2条回答
Anthone
2楼-- · 2019-07-30 09:56

I was receiving the same error but, after some shenanigans, it is working for me. The important part is the settings/Properties/SqlAgentCred/password reference to protectedSettings/Items/AgentPassword. Below is the properties node under my Powershell.DSC extension resource in my template.

"properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.17",
        "autoUpgradeMinorVersion": false,
        "settings": {
                "ModulesUrl": "https://blobstore.blob.core.windows.net/windows-powershell-dsc/DBServer.ps1.zip",
                "ConfigurationFunction": "DBServer.ps1\\DBServer",
                "Properties": {
                    "SqlAgentCred": {
                            "userName": "user@domain.com",
                            "password": "PrivateSettingsRef:AgentPassword"
                        }
                },
                "WmfVersion": "latest",
                "Privacy": {
                        "DataCollection": "Disable"
                }
        },
        "protectedSettings": {
                "Items": {
                    "AgentPassword": "Pa$$word"
                },
                "DataBlobUri": ""
        }
}
查看更多
冷血范
3楼-- · 2019-07-30 09:59

You will specify protected settings under protectedsettings section. Anything under ProtectedSettings are sent encrypted. Check https://blogs.msdn.microsoft.com/powershell/2016/02/26/arm-dsc-extension-settings/ for details.

查看更多
登录 后发表回答