【问题标题】:Passing Parameter Values to DSC Configuration from ARM Template从 ARM 模板将参数值传递给 DSC 配置
【发布时间】:2016-09-29 20:37:01
【问题描述】:

我有一个简单的 DSC 配置文件,其中包含凭据和字符串输入参数。我希望将此 DSC 配置与部署在 ARM 模板中的 VM 一起部署,但我缺少如何安全地传递这两个参数的概念。我该如何做到这一点?

【问题讨论】:

    标签: azure-resource-manager dsc


    【解决方案1】:

    我收到了同样的错误,但经过一些恶作剧后,它对我有用。重要的部分是settings/Properties/SqlAgentCred/passwordprotectedSettings/Items/AgentPassword 的引用。下面是我的模板中我的 Powershell.DSC 扩展资源下的属性节点。

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

      您将在受保护的设置部分指定受保护的设置。 ProtectedSettings 下的任何内容都以加密方式发送。详情请查看https://blogs.msdn.microsoft.com/powershell/2016/02/26/arm-dsc-extension-settings/

      【讨论】:

      • 这是一个很好的参考和开始,但并不完全清楚。我的 DSC 配置需要 PSCredential 对象。如果我只是通过添加用户名和密码属性在 ProtectedSettings.configurationArguments 属性中添加“凭据”对象,则 DSC 配置将失败,因为它找不到凭据参数。
      • 你好,听起来你正在做的应该可以。你会发布你在模板中使用的 protectedSettings 的值,以及扩展报告的错误吗?谢谢!
      • @NorbertoArrieta 我遇到了同样的问题。这是我的 protectedSettings 部分:"protectedSettings": { "configurationArguments": { "SqlAgentCred": { "userName": "user@domain.com", "password": "password" } }, "DataBlobUri": "" }
      • @sirdank 他们看起来不错。扩展报告的错误是什么?谢谢
      • @NorbertoArrieta 抱歉,我找不到原始错误。我确实让它工作了。请参阅我对这个问题的回答。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多