Home > Software design >  How to update appsettings.json value using Azure
How to update appsettings.json value using Azure

Time:06-04

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?

CodePudding user response:

From this document:

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

  • Related