Get variable group id for Azure Pipeline Library

problem

I want to update some values (and secrets) automatically in an Azure Library variable group from an Azure Pipeline. For this I need to pass in the variable group id, 123 in the example below:

# yml pipeline file
echo $AZURE_DEVOPS_CLI_PAT | az devops login
az pipelines variable-group variable update --group-id 123 --name librarySecret --value $(somePipelineVar) --output table

Command updates 'librarySecret' with a the value of 'somePipelineVar'.
Where can I find the variable group id?

solution

Azure CLI

Run CLI command (can be run locally) and get ID value

# Azure CLI Command
az pipelines variable-group list --group-name my-variable-group

# Output
[
  {
    "createdBy": {
       ...
    },
    "createdOn": "2020-09-04T10:47:54.763333+00:00",
    "description": "",
    "id": 123,
    "isShared": false,
    "modifiedBy": {
       ...
    },
    "modifiedOn": "2021-05-12T12:52:24.343333+00:00",
    "name": "my-variable-group",
    "providerData": null,
    "type": "Vsts",
    "variableGroupProjectReferences": null,
    "variables": {
       ...
    }
  }
]

Azure Devops

Azure DevOps -> Pipelines -> Library
Check Azure Devops URL in your browser for variableGroupId

/_library?itemType=VariableGroups&view=VariableGroupView&variableGroupId=123&path=

Gravatar
Author: Vlad Fibrich
Last Edit: March 12, 2023
1 Thanks received
Last Edit March 12, 2023
Created March 10, 2023
Views 73
Tags
Azure

Join us!

Do you like this website?

Bookmark it and come back here to write a post yourself when you run into something shareable.

Early collaborators will get to own a part of the project (5 to 20%)... >> read more

Your Comment

Feel free to post additional info or improvement suggestions.
preview
Optional, never shown, displays gravatar.

Formatting Tips

This editor uses Markdown to easily add code in your posts.

Triple backticks for full line(s) of code (or indent 4 spaces)

```
let foo = 'bar';
```

[link text](http://a.com)

*italic* **bold**

More Tips