@Chris Sessions , Thanks for reaching out to us.
You can follow below steps to update appsettings.json with variables from pipeline and deploy your Web App :
- Sign in to https://dev.azure.com/.
- Go to your Organisation > Project
- Go to Pipelines > Releases > New Pipeline
- For Stage 1 > Click on Select a Template > Empty Job
- Click on Add an Artifact > Select your Build Pipeline from the dropdown list.
- Click on 1 job, 0 task > Add Agent Job
- For your Web App Zipped Artifact, you can add Tokenize in Archive task and configure as below: OR
- For your folder structure Web App Artifact, you can add Replace tokens task and configure as below:
- Add Azure App Service deploy task to deploy your Web App.
- Add Pipeline Variables/Variable Groups. I have added Pipeline variables for demo -
- Update replaceable setting values in appsettings.json with specified token prefix and suffix in pipeline tasks above. For e.g., if you choose Replace token task, an example appsettings.json is shown below (here TestVariable will be replaced):
"Position": {{
"Title": #{TestVariable}#,
"Name": "Joe Smith"
},
"MyKey": "My appsettings.json Value",
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
} - Save and run the pipeline.