I have a web project which deployed over 50+ servers as per client and regions, each webconfig have 600+ values which are specific for each client and environment. means WebConfig have 600+ appsetting tags and and each client and environment have their own values. right now its manual if any value change than release team will go manually on server and do add/update value in webconfig. I want to handle it in
tfs release pipeline by tokenize webconfig's values but again it not an easy task to create each client's variables groups., which will create 50 group variables and each group variables will have 600 values. 50x600 = 30,000
is there an easy way to update webconfig values at time of per client release in TFS pipeline
Thanks in advance
You can try using FileTransform task in the release pipeline to update the webconfig values.
FileTransform task will match the pipeline variables against the
keyornameentries in the appsettings section. And update the appsettings value of webconfig with the matched pipeline variables.So you can define a pipeline variable with the same name of the
keyornameentries of the appsetting which needs to be changed. When new release is created, the FileTransform task will change the appsetting with the value of the pipeline variable.You can also use Magic Chuncks task to update the webconfig appsettings.
Check here to learn how to transform xml file with magic chucks
Please check this similar thread for more information.
Update:
Since it is a lot of task to manually create all the variables, you can have a try using Variablegroups - Add rest api to do this.
You need to write scripts to read all the appsetttings first, and then add all the appsettings to the rest api request body. See below example:
For example, I have below appsettings in web.config.
First I need to write script to add all the keys and values to the request body. Then call rest api. See below example:
By using scripts you donot need to create the variable group manually.