I want to get a build number and display it on my website logo. So whenever there is a new build, I want a new build number and pass it to the AppSettings.json file so then I can fetch the build number from there and use it.
"AppSettings": {
"EmailPopPort": "111",
"PopEmail": "[email protected]",
"PopPassword": "sBzce",
"AvailableStacks": [
"AAA",
"Plan",
"US"
],
"SmsProvider": "SmsGlobal",
"Version": "Dev"
}
I want to update the above "Version" In appsettings.json through the pipeline in Azure. What would be the best technique to do that?
From this document:
https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-app-settings
the values of configuration in App Service override the ones in Web.config or appsettings.json.
So, just need to change to configuration settings is ok.
How to do it in Azure pipeline:
1, Create a service connection:


2, Give the related service principal required permission:







(Note: The role assign need 5 minutes to apply, please wait.)
3, Use DevOps pipeline to change the app settings:







If you use YAML, it is
steps:
- task: AzureAppServiceSettings@1
displayName: 'xxx'
inputs:
azureSubscription: xxx
appName: xxx
resourceGroupName: 'xxx'
appSettings: |
[
{
"name": "bowmantest",
"value": "bowmantestvalue",
"slotSetting": false
}
]
4, After that, just wait, it will be successful:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With