如何在Azure资源模板中为Web App部署指定插槽

时间:2018-09-03 07:21:40

标签: azure azure-resource-manager azure-template

我在Azure资源模板中有几个插槽,我试图找出如何从参数(slot_for_deploy)指定部署插槽,但是我还没有找到解决方案。

当前模板:

{
      "parameters": {
          "slots_dev_name": {
              "defaultValue": "dev",
          },
        "slot_for_deploy": {
          "defaultValue": "dev",
        },
      },
    "resources": [
      {
        "type": "Microsoft.Web/serverfarms",
        "kind": "app",
        "name": "[parameters('serverfarms_azm_name')]",
        "apiVersion": "2016-09-01",
      },
      {
        "type": "Microsoft.Web/sites",
        "kind": "app",
        "name": "[parameters('sites_azm_name')]",
        "resources": [              
          {
            "type": "Microsoft.Web/sites/slots",
            "kind": "app",
            "name": "[concat(parameters('sites_azm_name'), '/', parameters('slots_dev_name'))]",
          },
          {
            "name": "MSDeploy",
            "type": "extensions",
            "properties": {
              "packageUri": "...",
              "setParameters": {
                "IIS Web Application Name": "[parameters('sites_azm_name')]"
               }
            }
          }
        ]
      }
    ]
  }

1 个答案:

答案 0 :(得分:0)

查看此博客文章,作者在其中解释部署插槽和ARM模板。 https://msftplayground.com/2016/12/azure-resource-templates-deployment-slots/