Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update appsettings.json value using Azure

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?

like image 656
Rnue Avatar asked Dec 06 '25 16:12

Rnue


1 Answers

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:

enter image description here

enter image description here

2, Give the related service principal required permission:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

(Note: The role assign need 5 minutes to apply, please wait.)

3, Use DevOps pipeline to change the app settings:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

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:

enter image description here

like image 127
Bowman Zhu Avatar answered Dec 09 '25 21:12

Bowman Zhu



Donate For Us

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