There has been some confusion internally around how to automate appsettings for Function Apps and Web Apps recently with some of our deployments, and checking around there appears to be a bewildering amount of options that look like they are doing roughly the same thing, but in different steps.
Our developers usually have an appsettings.json file they commit to the repo that might look something like this for their testing...
{
"Logging": {
"LogLevel": {
"Default": "Information",
}
},
"Values": {
"ThingToPointTo": "http://localhost",
}
}
When we take that to other environment e.g. PROD, we change the ThingToPointTo to something like "https://productionservice"
We have been using the Azure DevOps YAML pipelines to deploy and change the AppSettings in this way...
- task: AzureFunctionApp@1
inputs:
azureSubscription: 'OurAzureSubServiceConnection'
appType: functionApp
appName: $(azfuncappname)
package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
AppSettings: '-Values:ThingToPointTo "https://productionservice"'
My question is 2-fold
Is the Values:ThingToPointTo correct for enumerating to the correct setting, or should it just be ThingToPointTo (omitting the Values:) ?
Is this the way to do it? I notice there are JSON transform steps you can use to change the actual file before deploying it, and also a task called "Azure App Service Settings" available to use that will do it after deployment?
There are so many articles on the subject of this, but none seem to fit.
Thanks in advance!