Passing Parameter Values to DSC Configuration from ARM Template

核能气质少年 提交于 2019-12-12 23:04:33

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/39779552/passing-parameter-values-to-dsc-configuration-from-arm-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!