Azure Pipelines: Export Variable Group via API

Useful when migrating off Azure Pipelines. First, you need to find ID of the variable group in the URL (it’s 9 in this case):


Then, insert in the url<org>/<project>/_apis/distributedtask/variablegroups/9?api-version=6.0-preview.2

which returns you a raw json.

To transform the JSON I used the following python script:

i = """raw json returned from the api call above"""

import json

j = json.loads(i)
for vn, vv in j["variables"].items():
    print(f"{vn}: {vv['value']}")

returns something like:

VAR_NAME: value
VAR_NAME: value

Thanks! You can always email me or use contact form for more questions/comments etc.


76 Words