【问题标题】:Add slots using ARM templates使用 ARM 模板添加插槽
【发布时间】:2021-01-07 07:39:34
【问题描述】:

我想在两个不同的环境中创建相同的命名槽。不同之处在于Integration 我想启用自动交换。我尝试使用condition 执行此操作,如下所示,但这没有通过验证,因为我有两个同名的资源。

  "resources": [
    {
      "condition": "[equals(parameters('env'), 'Integration')]",
      "apiVersion": "2018-11-01",
      "name": "staging", <----------------- HERE
      "type": "slots",
      "location": "[resourceGroup().location]",
      "identity": {
        "type": "SystemAssigned"
      },
      "dependsOn": [
        "[variables('webApiWebSiteName')]"
      ],
      "properties": {
        "siteConfig": {
          "autoSwapSlotName": "production"  <----------------- only difference
        }
      }
    },
    {
      "condition": "[equals(parameters('env'), 'Production')]",
      "apiVersion": "2018-11-01",
      "name": "staging", <----------------- HERE
      "type": "slots",
      "location": "[resourceGroup().location]",
      "identity": {
        "type": "SystemAssigned"
      },
      "dependsOn": [
        "[variables('webApiWebSiteName')]"
      ],
      "properties": {
      }
    }
  ]

【问题讨论】:

    标签: azure-web-app-service azure-resource-manager arm-template azure-deployment-slots


    【解决方案1】:

    您只能创建一个具有唯一名称 across all of Azure 的 Web 应用程序,因为它会为您的网站生成一个端点。

    关于插槽,您也可以查看链接中的表格。他们可以在不同站点(应用服务)之间使用相同的名称,但在一个站点下不能使用相同的名称。不确定你说的环境,如果是develop和staging环境,这两个slot还在一个app服务下。

    【讨论】:

    • 我正在为每个环境创建一个应用服务(每个环境使用不同的名称)。我尝试为它们添加同名的插槽。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 1970-01-01
    • 2018-01-03
    • 2021-12-07
    • 2017-10-25
    • 1970-01-01
    相关资源
    最近更新 更多