I'm trying to set up variables in the appsettings.json
file for my Azure App Service. These variables use the colon (:
) notation for nested configuration.
When I manually add these settings through the Azure portal, everything works fine:
However, when I attempt to add the same configuration using a Bicep script, it fails.
Here is the Bicep script I’m using to set the app settings:
var dbConnectionString = 'test connection'
resource siteconfigWebjob 'Microsoft.Web/sites/config@2022-03-01' = {
parent: windowsAppService
name: 'appsettings'
properties: {
'ConnectionStrings:DefaultConnection': dbConnectionString
}
}
Additionally, I tried adding the app settings directly in the App Service configuration within the Bicep file:
resource windowsAppService 'Microsoft.Web/sites@2022-03-01' = {
name: webjobAppServiceName
location: resourceGroupLocation
kind: 'app'
properties: {
serverFarmId: windowsappServicePlan.id
siteConfig: {
appSettings: [
{
name: 'AzureWebJobsStorage'
value: storageConnectionString
}
{
name: 'MaxCsvFileSizeInBytes'
value: '4194304'
}
]
}
}
}
I tried this method and it worked for me.
var defaultConnection = 'DefaultConnection'
var tenantConnection = 'TenantConnection'
var applicationInsightConnectionString = 'ApplicationInsightsConnectionString'
var emailProcessorEndpoint = 'EmailProcessorEndpoint'
resource siteconfigWebjob 'Microsoft.Web/sites/config@2022-03-01' = {
parent: windowsAppService
name: 'appsettings'
properties: {
'ConnectionStrings:${defaultConnection}': dbConnectionString
'ConnectionStrings:${tenantConnection}': tenantDbConnection
'ConnectionStrings:${applicationInsightConnectionString}': applicationInsights.properties.ConnectionString
AzureWebJobsDashboard: storageConnectionString
AzureWebJobsStorage: storageConnectionString
MaxCsvFileSizeInBytes: '4194304'
WebsiteUrl: 'https://${frontendAppServiceName}.azurewebsites.net'
'EventGridCredentials:${emailProcessorEndpoint}': emailProcessor.properties.endpoint
}
}