且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Azure ARM模板中使用条件

更新时间:2022-05-13 02:32:53

要实现这一目标的关键属性是:

The key properties to achieve this are:

  • templateLink设置要包含的模板以及要传递给被调用模板的参数的名称.

  • templateLink that sets the template to be included and the names of the parameters to be passed to the called template.

"templateLink": {
    "uri": "[variables('sharedTemplateUrl')]",
    "contentVersion": "1.0.0.0"
}

  • newOrExisting根据其值,我们可以决定使用质量检查还是产品配置.

  • newOrExisting based on its value we can decide to use an QA versus Productoin config.

    "newOrExisting": "new",
    
    "configHash": {
      "new": "[concat(parameters('templateBaseUrl'),'partials/QA.json')]",
      "existing": "[concat(parameters('templateBaseUrl'),'partials/Production.json')]"
    }
    
    "configTemplate": "[variables('configHash')[parameters('Settings').newOrExisting]]"
    

  • 您可能会看到

    You could see Azure ARM deployments: how to perform conditional deployments which has provided more details.