簡體   English   中英

ARM 模板:我如何確保 Web 應用程序插槽沒有部署 Web 應用程序設置?

[英]ARM Template: How can i ensure Web App slots do not get the Web App Settings deployed over?

我在 Azure 上為我們的暫存和生產環境提供了完整的 ARM 模板。 它通過 Azure DevOps 發布。

However, i noticed that the Web App settings i have applied in my ARM for the Web App, it replicates over to the Web App Slots also. 我知道這可以在 Azure 上手動勾選,但是有沒有辦法在 ARM 模板上做到這一點? 我查看了 Microsoft 網站,但沒有看到任何幫助,並且想知道這是否是手動任務?

{
        "type": "Microsoft.Web/sites/config",
        "apiVersion": "2019-08-01",
        "location": "[resourceGroup().location]",
        "name": "[concat(parameters('webAppName'), '/appsettings')]",
        "dependsOn": [
            "[parameters('webAppName')]",
            "[concat(parameters('sqlDatabase'), 'constr')]"
        ],
        "properties": {
            "APPINSIGHTS_INSTRUMENTATIONKEY": "[reference(resourceId('Microsoft.Insights/components', parameters('appInsights')), '2014-04-01').InstrumentationKey]",
            "ApplicationInsightsAgent_EXTENSION_VERSION": "~2",
            "DiagnosticServices_EXTENSION_VERSION": "~3",
}

這就是我的應用程序設置代碼的樣子(還有更多應用程序設置,我不需要全部復制)

下面是我的 Web 應用槽 ARM 代碼

{
        "apiVersion": "2019-08-01",
        "type": "Microsoft.Web/sites/slots",
        "name": "[concat(parameters('webAppName'), '/', parameters('slots')[copyIndex()])]",
        "kind": "app",
        "location": "[resourceGroup().location]",
        "copy": {
            "name": "WebAppSlots",
            "count": "[length(parameters('slots'))]"
        },
        "properties": {
            "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('planName'))]"
        },
        "dependsOn": [
            "[parameters('webAppName')]",
            "[concat(parameters('sqlDatabase'), 'constr')]"
        ]
    },

我真的很感激任何關於這個問題的見解。

謝謝:)

使用 ARM 模板的插槽設置非常痛苦。 在 ARM 模板中沒有辦法在不實際復制插槽定義中的屬性部分的情況下復制設置。

由於您使用 Azure DevOps 進行部署,因此您可以使用更多選項。 在我的腦海中,這些包括:

  • 使用Azure 應用服務設置任務將 Web 應用和插槽設置設置為管道的一部分。
  • 使用Azure App Configuration Service讓我很幸運。 這將需要一些代碼,但我喜歡配置歷史跟蹤、比較和熱插拔設置的能力,而無需回收您的 Web 應用程序。
  • 我還剛剛執行了 Powershell 腳本作為我的部署管道的一部分,以設置 Azure Web 應用程序和插槽設置。 有了上述方法的可用性,我想說這是一個遙遠的三分之一。 但為了完整起見,我想包括它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM