I'm using dot net core 3.0.1, for some reason I'm finding it really hard to work out how to utilize my appsettings.production.json when deploying using azure devops pipelines. My pipeline is as follows; Restore > Build > Package > Publish Artefact > Azure App Service Deploy The application is hosted fine but I cant see where/how I tell it to use/apply the production transform.
1 Answers
Dot net core how do I utilise appsettings.[envname].json when deploying via azure devops?
There is difference between Web Deploy/Visual Studio
and Deploy Azure App Service
in Azure devops publish task.
In order to use/apply the production transform during the Azure devops release, you will need to add variables to the release task and pass into the task the json
file in question for variable substitution.
When in "Deploy Azure App Service" release task you should see a "File Transforms and Variable Substitution" section. In here you will supply the path to the json file you want to swap variable values:
Then you can add the json
property you want to modify as a variable. In my case the connection string. Which will look like the following:
Check the document File transforms and variable substitution reference for some more details.
Hope this helps.