powershell - 如何使用 Azure DevOps API 列出对项目存储库具有权限的组/用户?

标签 powershell azure-devops azure-devops-rest-api

我想检查谁有权通过 REST API 访问项目中的某些存储库。我引用了文档,但可以找到任何东西。

最佳答案

使用 AzurePipelinesPS PowerShell 模块,您可以运行以下命令来创建权限报告并将文件保存在本地。其中 _yourSessionName_ 是您的 session 名称。要了解有关使用 AzurePipelinesPS 进行 session 管理的更多信息,您可以查看文档 here .
创建报告
为团队项目中的存储库创建报告,其中 _myTeamProjectName_ 是团队项目的名称,_myRepoName_ 是存储库的名称。可以修改此输入对象以创建各种权限报告。请参阅文档 here .

New-APPermissionReport -Session '_yourSessionName_' -InputObject @{
        descriptors = @()
        reportName = 'myFirstPermissionReport'
        resources = @(
            @{
                resourceId = '_myTeamProjectName_/_myRepoName_'
                resourceName = '_myRepoName_'
                resourceType = 'repo'
            }
        )
    }
返返回告状态
返回列表中第一个报告的报告信息
$session = '_yourSessionName_'
$reports = Get-APPermissionReportList -Session $session
Get-APPermissionReport -Session $session -ReportId $reports[0].id 
保存报告
将列表中的第一个报告保存到位于 c:\temp\myReport.json 的文件中
$session = '_yourSessionName_'
$reports = Get-APPermissionReportList -Session $session
Save-APPermissionReport -Session $session -ReportId $reports[0].id -OutputPath C:\temp\myReport.json
如果您对该模块有任何问题,请随时在 AzurePipelinesPS Github project 上打开问题。

关于powershell - 如何使用 Azure DevOps API 列出对项目存储库具有权限的组/用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63450768/

相关文章:

powershell - 如何使用PowerShell为MSBuild属性设置值

powershell - 使用PowerShell替换JSON中的值

visual-studio - Visual Studio Team Services 生成问题

azure-devops - Azure 开发运营 : How to avoid a build on new branch creation

azure - 如何在 Powershell 中访问 Azure DevOps 阶段名称?

Azure DevOps REST API SendMail

azure - 如何在azure devops中通过Rest API获取测试的通过百分比

powershell - 在 PowerShell 中将文件名复制到文本文件

powershell - 在 IIS7.5 中使用 Powershell 设置启用父路径

azure-devops - 如何将 VSTS 发布阶段移动到不同的 "parent"