问题
We are currently researching the usage of Azure DevOps Build and Release pipelines.
We did successfully create a simple Asp.NET Core web application and pushed that application into an Azure DevOps repository.
We did successfully create a pipeline for that application consisting of Restore, Build, Test, Publish, and Publish Artifacts (as shown on the attached image) and successfully built that pipeline.
In the Azure Portal, we did successfully create a Resource Group and the Web App to host the web application
In the Azure DevOps, we did successfully create a release for that application and did successfully publish the application to the created Web App
However, in the Azure Portal, in the newly created Web App configuration section, there are no config values transferred from the application's appsettings.json.
I did try to use 'Link settings' feature on the Publish segment of the pipeline, but that didn't work
Thus, the question is how do I transfer the config values of the ASP.NET Core Web application into an Azure Portal Web App through an Azure DevOps pipeline and release?
回答1:
Settings from appsettings.json are not displayed in Azure App Service Configuration, but settings defined there override values in appsettings.json. So if you define again key/pair in Configuration tab it will override value from file. Here is a link for documentation.
回答2:
We found a solution
Click plus sign on the pipeline (add new task) and choose 'Azure App Service Settings'
On the App Settings for the Task, add the settings you need
Save, build and add to the release
来源:https://stackoverflow.com/questions/61238621/how-to-include-appsettings-json-settings-into-azure-devops-build-and-release-pip