【问题标题】:How to link variable group to azure pipeline using Rest API?如何使用 Rest API 将变量组链接到 Azure 管道?
【发布时间】:2020-03-06 09:51:50
【问题描述】:
是否有可能使用 Rest API 将变量组添加到 Azure 管道?
【问题讨论】:
标签:
powershell
azure-devops
azure-powershell
azure-devops-rest-api
【解决方案1】:
是的,有一个Rest API来添加变量组,Variablegroups - Add:
POST https://dev.azure.com/{organization}/{project}/_apis/distributedtask/variablegroups?api-version=5.1-preview.1
例如:
POST https://dev.azure.com/fabrikam/DGDemo/_apis/distributedtask/variablegroups?api-version=5.1-preview.1
主体:
{
"variables": {
"key1": {
"value": "value1"
},
"key2": {
"value": "value2",
"isSecret": true
}
},
"type": "Vsts",
"name": "TestVariableGroup1",
"description": "A test variable group"
}