如何使用Rest API将变量组链接到Azure管道?

时间:2020-03-06 09:51:50

标签: powershell azure-devops azure-powershell azure-devops-rest-api

是否有可能使用Rest API将变量组添加到Azure管道?

1 个答案:

答案 0 :(得分:0)

是的,有一个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"
}