Set ARM Template Web appSetting

后端 未结 2 575
既然无缘
既然无缘 2021-01-06 15:48

How can I use ARM to deploy applicationsettings to a website?


1 When running the following in VS ARM Deploy json:

....
     \"resources\": [
           


        
2条回答
  •  半阙折子戏
    2021-01-06 16:21

    Answer 1

       $webapp = Get-AzureRmWebApp -Name $webSiteName
       $webapp.SiteConfig.AppSettings
    

    Answer 2

    Here what I have in my ARM template, and it works fine:

      "resources": [
        {
          "apiVersion": "2015-08-01",
          "location": "[resourceGroup().location]",
          "type": "config",
          "name": "appsettings",
          "dependsOn": [
            "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
          ],
          "properties": {...}
        },
        {
          "apiVersion": "2015-08-01",
          "location": "[resourceGroup().location]",
          "type": "config",
          "name": "web",
          "dependsOn": [
            "[resourceId('Microsoft.Web/Sites', variables('webSiteName'))]"
          ],
          "properties": {
            "alwaysOn": true
          }]
    

    As you can see I set AppSettings as separate resource under website. Try it, should work.

    Hope it helps.

提交回复
热议问题