Add ARM Service Endpoint programatically in VSTS

时间:2018-07-24 10:21:16

标签: azure-devops azure-active-directory azure-pipelines-release-pipeline azure-devops-rest-api

I have an existing SPN in Azure AD and want to add to VSTS programatically. Is this possible? VSTS Rest-API? Examples? Through powershell?

1 个答案:

答案 0 :(得分:1)

您可以使用REST API来管理端点。

例如,以下POST将创建一个Azure终结点:

https://fabrikam.visualstudio.com/DefaultAgileGitProject/_apis/serviceendpoint/endpoints?api-version=4.1-preview.1

{
  "data": {
    "SubscriptionId": "12345678-1234-1234-1234-123456129012",
    "SubscriptionName": "TestSubscriptionName"
  },
  "id": "64be39c2-102b-416d-a3ac-2de40ebc8513",
  "name": "TestEndpoint",
  "type": "Azure",
  "authorization": {
    "parameters": {
      "Certificate": "dummyCertificate"
    },
    "scheme": "Certificate"
  },
  "isReady": false
}

您可以在此处找到完整的文档:https://docs.microsoft.com/en-us/rest/api/vsts/serviceendpoint/endpoints/create?view=vsts-rest-4.1