ARM Templates for Azure Functions with many appSettings for different environments and slots

后端 未结 3 610
迷失自我
迷失自我 2020-12-10 19:02

I\'ve got two Azure Function apps that use deployment slots, stage and production. These two Azure Function apps have about 50~ key:value pairs in Application Settings to de

3条回答
  •  执笔经年
    2020-12-10 19:41

    It is possible to combine static configuration with deployment-time references. You use the union template function to combine your static configuration (object or array) with some deployment-time value that you wrap using the json template function.

    I use this to set Application Insights at deployment-time with a base config object and a app service-specific object (broken up for easier reading):

    [union(
      variables('appServiceBaseConfig'), 
      variables('appService1'), 
      json(
        concat(
          '{\"APPINSIGHTS_INSTRUMENTATIONKEY\":\"', 
          reference(concat('microsoft.insights/components/', variables('applicationInsightsName')), '2015-05-01').InstrumentationKey,
           '\"}')
        )
      )
    ]
    

提交回复
热议问题