在 VSTS 中以编程方式添加 ARM 服务端点

Add ARM Service Endpoint programatically in VSTS

我在 Azure AD 中有一个现有的 SPN,并且想以编程方式添加到 VSTS。 这可能吗? VSTS 休息-API?例子? 通过 powershell?

您可以使用 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