2016-09-29 38 views
1

我有一個簡單的DSC配置文件,其中包含證書和字符串輸入參數。我希望這種DSC配置與在ARM模板中部署的VM一起部署,但我錯過了如何安全地傳遞這兩個參數的概念。我該如何做到這一點?將參數值從ARM模板傳遞到DSC配置

enter image description here

回答

0

將指定下protectedsettings部分受保護的設置。 ProtectedSettings中的任何內容都將被加密發送。詳情請查詢https://blogs.msdn.microsoft.com/powershell/2016/02/26/arm-dsc-extension-settings/

+0

這是一個很好的參考和一個開始,但不是完全清楚。我的DSC配置需要PSCredential對象。如果我僅通過添加用戶名和密碼屬性在ProtectedSettings.configurationArguments屬性中添加「Credential」對象,DSC配置將失敗,因爲它無法找到Credential參數。 – ChiliYago

+0

你好,這聽起來像你在做什麼應該工作。您會發布您在模板中使用的protectedSettings的值,以及擴展報告的錯誤嗎?謝謝! –

+0

@NorbertoArrieta我有同樣的問題。這裏是我的protectedSettings部分:' 「protectedSettings」:{ \t 「configurationArguments」:{ 「SqlAgentCred」:{ 「username」 的: 「[email protected]」, 「密碼」: 「密碼」 \t \t \t } }, 「DataBlobUri」:「」 }' – sirdank

1

我收到了同樣的錯誤,但在一些詭計後,它正在爲我工​​作。重要的部分是參考protectedSettings/Items/AgentPasswordsettings/Properties/SqlAgentCred/password。以下是我的模板中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": "[email protected]", 
          "password": "PrivateSettingsRef:AgentPassword" 
         } 
       }, 
       "WmfVersion": "latest", 
       "Privacy": { 
         "DataCollection": "Disable" 
       } 
     }, 
     "protectedSettings": { 
       "Items": { 
        "AgentPassword": "Pa$$word" 
       }, 
       "DataBlobUri": "" 
     } 
}