如何通过API启用/禁用项目服务

问题描述 投票:0回答:1

我从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

azure service azure-devops project
1个回答
1
投票

This guy wrote a blog post on how to do this

这是从他的帖子中摘录的摘录:

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}

根据需要替换account,project-id和feature-id。以下是我所知道的功能ID。

ms.vss-build.pipelines
ms.vss-test-web.test
ms.vss-work.agile
ms.vss-code.version-control

它看起来像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

© www.soinside.com 2019 - 2024. All rights reserved.