首页 > 解决方案 > 从公司 AD 中删除时删除 Azure DevOps 帐户

问题描述

从公司 AD 中删除帐户时,是否有自动(脚本或类似)方法从 Azure DevOps 中删除帐户订阅。今天,这是我们公司的一项手动工作,效率不高。

标签: azure-devopsactive-directoryaccount-management

解决方案


如果要删除订阅的服务连接,可以使用一些 REST API。

步骤1。获取要删除连接的项目 ID

GET https://dev.azure.com/{organization}/_apis/projects/{projectName}?api-version=6.1-preview.4

第2步。获取项目中的服务连接id列表:Endpoints - Get Service Endpoints list

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

或者您可以通过名称获取特定的服务连接 ID:Endpoints - Get Service Endpoints By Names

GET https://dev.azure.com/{organization}/{project}/_apis/serviceendpoint/endpoints?endpointNames={endpointNames}&api-version=6.1-preview.4

Step3:删除服务连接:端点 - 删除

DELETE https://dev.azure.com/{organization}/_apis/serviceendpoint/endpoints/{endpointId}?projectIds={projectIds}&api-version=6.1-preview.4

多个服务连接可以通过使用服务连接 id 作为{endpointId}并重复此 REST API 来快速删除。


推荐阅读