如何通过 API enable/disable 项目服务

How to enable/disable project services through API

我正在从 TFS 2015 迁移到 Azure DevOps。创建目标项目和导入旧 git 存储库的过程可以通过 Azure DevOps API.

轻松完成

但是每个新项目,无论是手动创建还是由 API 创建,都始终启用所有服务(BoardsPipelinesTest Lab、...)。有没有办法更改应在新项目上启用哪些服务的默认设置?或者更好的 API 方法来打开/关闭某些服务?

我们有很多项目,因此无法在浏览器中打开每个项目,切换到项目设置页面并调整服务。

我没有在文档中找到任何内容:https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-5.0

This guy wrote a blog post on how to do this

这是摘自他的 post:

PATCH https://{account}.visualstudio.com/_apis/FeatureManagement/FeatureStates/host/project/{project-id}/{feature-id}?api-version='4.1-preview.1'
content-type: application/json

{"featureId":"{feature-id}","scope":{"settingScope":"project","userScoped":false},"state":0}

根据需要替换帐户、项目 ID 和功能 ID。这是我知道的功能 ID。

ms.vss-build.pipelines  [Azure Pipelines]
ms.vss-test-web.test [Test Plans]
ms.vss-work.agile [Azure Boards]
ms.vss-code.version-control [Azure Repos]
ms.feed.feed [Azure Artifacts]

看起来像turning a service off really just means hiding it from the UI

编辑:it looks like the .net SDK has built in support for this as well