Reputation: 903
Net core application. My appsettings.json looks like below.
{
"AzureAd": {
"Authority": "https://login.microsoftonline.com/",
"TenantId": "mytenantid",
"ClientId": "myclientid"
},
"ApplicationInsights": {
"InstrumentationKey": "myinstrumentationkey"
},
"EnableSwagger":"true"
}
I deployed my application to azure app service. I have below appsettings in app service plan.
AzureAd:Authority
AzureAd:ClientId
AzureAd:TenantId
ApplicationInsights:InstrumentationKey
EnableSwagger
The problem I am facing is, whenever I deploy my application into azure app service only EnableSwagger value from app service configurations to appsettings.json. So Key:Value kind of configurations are working fine. The Issue with nested object keys like
"AzureAd": {
"Authority": "https://login.microsoftonline.com/"
}
This value is not overriding from app service configurations app settings to my application appsettings.json. But where I have just "Key":"Value" Its overriding. I spent whole one day and couldnt figure it out the issue. I tried changing appservice configurations to below syntex also since it is Linux. AzureAd:Authority I replaced : with __(double underscore) this also dint work for me? Also this is happening only when I deploy application through release pipeline. If I manually deploy by right clicking on the solution and configure app service and click on publish. It works. Only problem I am facing in release pipeline. Can some one give some thoughts to fix this? Any help really appreciated. Thank you
Upvotes: 1
Views: 1546
Reputation: 30323
If you want to override the app settings of the azure app service. You can use the App settings field of azure app deployment task in your release pipeline.
1, First you can define variables in release pipeline Variables tab to hold the app settings. See below:
2, Then you can override the app setting in the Azure App Service deploy task.
Go the Application and Configuration Settings--> App settings-->Click the 3dots--> Add the key-value.(You can refer to the variable by wrapping the variable name in $()
, or you can just set the value without define the variable in the Variables tab. )
After the release is deployed. The appsettings in app service plan should be overrode.
Upvotes: 3