本文介绍了从 ARM 模板创建 Azure Web 应用程序槽,而无需复制原始 Web 应用程序配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 ARM 模板创建 Web 应用程序插槽.

I am trying to create web app slots through ARM template.

我能够创建它们,但看起来默认行为是将它们创建为当前 Web 应用程序状态的副本.这导致我的插槽继承了应用程序设置、连接字符串、虚拟目录......

I was able to create those but it looks like the default behavior is to create the them as a copy of the current web app state. This result in my slot inheriting app settings, connection strings, virtual directories, ....

这里是演示行为的复制示例 https://github.com/ggirard07/ARMSlotWebConfig.

Here a reproduction sample which demonstrate the behavior https://github.com/ggirard07/ARMSlotWebConfig.

我希望我的插槽干净清新,这是 azure 门户的默认行为.门户能够允许用户通过指定在创建槽时发布的 "configSource": "", 值来选择行为.

I want my slot clean and fresh instead, which is the azure portal default behavior. The portal is able to allow a user to select the behavior by specifying the "configSource": "", value it posts when creating the slot.

无论如何可以从 ARM 模板内部实现相同的目标吗?

Is there anyway to achieve the same from inside an ARM template?

推荐答案

要防止从生产应用复制设置,只需在插槽 propertiessiteConfig 对象代码>.例如

To prevent the copying of settings from the production app, just add an empty siteConfig object in the slot properties. e.g.

    {
      "apiVersion": "2015-08-01",
      "type": "slots",
      "name": "maintenance",
      "location": "[resourceGroup().location]",
      "dependsOn": [
        "[resourceId('Microsoft.Web/Sites/', variables('webSiteName'))]"
      ],
      "properties": {
        "siteConfig": { }
      }
    }

我发送了一个 PR 来说明您的回购.

I sent a PR to illustrate on your repo.

这篇关于从 ARM 模板创建 Azure Web 应用程序槽,而无需复制原始 Web 应用程序配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 01:26