I want my Azure DevOps pipeline to deploy all the function app configs without manually entering them in the devops pipeline how to do that ?
We’ve C# code which is getting deployed on Azure function apps. But we’re adding the configs of fucntion apps manually in azure devops pipeline.
As of now we’re entering the configs in Azure function deploy task in pipeline, but I want it as it needs to come from source code directly without enteritng them in pipeline.
We need direction to understand how we can automate the config vaules by using ADO pipelines. Is this possible ?
2
Answers
You can add a task to run an Azure CLI script to edit app settings in bulk:
The file format needed for
settings.json
is a JSON array of settings where the slot setting field is optionalFor convenience, you can save existing settings into a JSON file with
az webapp config appsettings list
. The following example can be run in Bash:The appsettings.json file can not be directly used in the Azure CLI:
az webapp config appsettings set
.To meet your requirement, you can use script to loop the app settings value in the appsettings.json file. Then you can add them to an array and use it to the Azure CLI commnad.
Here is an example:
Result sample: