如何将项目的所有迭代添加到该项目中的所有团队?

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

如何将项目的所有迭代添加到该项目中的所有团队?

我知道如何列出我想要添加到团队中的所有迭代:

az boards iteration project list --depth 2 --query "children[*].children[*].identifier"

我知道如何列出项目中的所有团队:

az devops team list --query "[].id"

我知道如何向团队添加迭代:

az boards iteration team add --id 76c902xxx-ca2b-4b94-ab06-ce6d3xxx8784 --team 81fxxx72-a384-453b-9ba2-1229xxxba8c6

如何将项目中注册的所有迭代(返回上面带有

--depth 2
的过滤器)添加到该项目中的所有团队?

我只知道如何向团队添加迭代:

az boards iteration team add --id 76c9084-ca2b-4b94-ab0xxxe6d33b68784 --team 81f0exxxa384-453b-9ba2-1229xxxba8c6

我需要知道如何将所有迭代添加到所有项目团队。

azure-cli
1个回答
0
投票

我已使用给定的 PowerShell 脚本将项目的迭代添加到该项目中的所有团队。

$iterations = az boards iteration project list --depth 2 --query "children[*].identifier" | ConvertFrom-Json

$teams = az devops team list --query "[].id" | ConvertFrom-Json

# Iterate through each team and iteration to add them
foreach ($teamId in $teams) {
    foreach ($iterationId in $iterations) {
        $output = az boards iteration team add --id $iterationId --team $teamId
        Write-Output "Added iteration $iterationId to team $teamId"
        Write-Output $output
    }
}

我按照我的要求使用

--query "children[*].identifier"
,你相应地修改它。

我能够得到预期的结果。

enter image description here

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