Following my previous article about how to update a variable group using POSTMAN, I will now document how to implement the same behavior through a pipeline.
First things first you will need a PAT. I have included this PAT in a different variable group than the one that I will update. this is because when you update the variable group, all the variables that are inside will get lost. If you need to retain them, you should have to get them first and then add them again on the variable group.
For this reason I have created a variable group named token-group which holds my PAT. I also made this variable a secret.
The variable group that I will update has the name of var-group and the id of 5.
The pipeline includes two tasks. The first task will loop through the variables on the group and print them out. The second task will update the variable group based on the JSON that you provided. You should change your ORG and project URLs.
After running the pipeline you will notice a null output on the update of the variable group. This is the requested result and as task has not failed your var group will get updated.
Variables inside json