如何使用 Azure DevOps API 列出有权访问项目存储库的组/用户? [英] How to list the groups/user who has permissions to the project repo with Azure DevOps API?

查看:23
本文介绍了如何使用 Azure DevOps API 列出有权访问项目存储库的组/用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to check who has permissions to access some of the repos in the project via REST API. I referred to the documentations, but could find anything.

推荐答案

使用 AzurePipelinesPSPowerShell 模块您可以运行以下命令来创建权限报告并将文件保存在本地.其中 _yourSessionName_ 是您的会话名称.要了解有关 AzurePipelinesPS 会话管理的更多信息,您可以查看文档此处.

Using the AzurePipelinesPS PowerShell module you can run the following commands to create a permission report and save the file locally. Where _yourSessionName_ is the name of your session. To learn more about session management with AzurePipelinesPS you can review the documentation here.

为团队项目中的存储库创建报告,其中 _myTeamProjectName_ 是您的团队项目的名称,_myRepoName_ 是您的存储库的名称.可以修改此输入对象以创建各种权限报告.请参阅文档 此处.

Creates a report for a repository in a team project where _myTeamProjectName_ is the name of your team project and _myRepoName_ is the name of your repository. This input object can be modified to create all kinds of permissions reports. See the documentation here.

New-APPermissionReport -Session '_yourSessionName_' -InputObject @{
        descriptors = @()
        reportName = 'myFirstPermissionReport'
        resources = @(
            @{
                resourceId = '_myTeamProjectName_/_myRepoName_'
                resourceName = '_myRepoName_'
                resourceType = 'repo'
            }
        )
    }

返回报告状态

返回列表中第一个报告的报告信息

Return the Report Status

Returns the report information for the first report in the list

$session = '_yourSessionName_'
$reports = Get-APPermissionReportList -Session $session
Get-APPermissionReport -Session $session -ReportId $reports[0].id 

保存报告

将列表中的第一个报告保存到位于 c: empmyReport.json 的文件中

Save the Report

Saves the first report in the list to a file located at c: empmyReport.json

$session = '_yourSessionName_'
$reports = Get-APPermissionReportList -Session $session
Save-APPermissionReport -Session $session -ReportId $reports[0].id -OutputPath C:	empmyReport.json

如果您对该模块有任何问题,请随时在 AzurePipelinesPS Github 项目上提出问题

If you have any issues with the module please feel free to open an issue on the AzurePipelinesPS Github project

这篇关于如何使用 Azure DevOps API 列出有权访问项目存储库的组/用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆