如何获取Azure devops服务连接ID

时间:2019-05-25 12:01:04

标签: azure azure-devops

我已经在Azure devops中创建了一个新的服务连接,我想获取它的id无法在Azure devops门户中的任何地方找到它

1 个答案:

答案 0 :(得分:0)

您可以使用以下端点获取ID,

https://dev.azure.com/{organization}/{project}/_apis/serviceendpoint/endpoints?api-version=5.0-preview.2

根据 docs ,它将以

的形式返回json。
  

{“计数”:1,“值”:[       {         “数据”:{           “ SubscriptionId”:“ 12345678-1234-1234-1234-123456789012”,           “ SubscriptionName”:“ TestSubscriptionName”,           “环境”:“ AzureCloud”         },         “ id”:“ 4b16dc87-22a0-45f9-82d8-2e295c4597c6”,         “ name”:“ TestEndpoint”,         “ type”:“ Azure”,         “ url”:“ https://management.core.windows.net/”,         “由...制作”: {           “ id”:“ 4adb1680-0eac-6149-b5ee-fc8b4f6ca227”,           “ uniqueName”:“ fabfiber@outlook.com”,           “ imageUrl”:“ https://dev.azure.com/fabrikam/_api/_common/identityImage?id=4adb1680-0eac-6149-b5ee-fc8b4f6ca227”,           “ displayName”:“查克·莱因哈特”,           “ url”:“ https://vssps.dev.azure.com/fabrikam/_apis/Identities/4adb1680-0eac-6149-b5ee-fc8b4f6ca227”         },         “授权”:{           “方案”:“证书”         },         “ isReady”:是       }]}