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

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

问题描述

我想检查谁有权通过REST API访问项目中的某些回购协议.我参考了文档,但是什么都找不到.

解决方案

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

创建报告

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

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.

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.

Create the Report

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 

Save the Report

Saves the first report in the list to a file located at c:\temp\myReport.json

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

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天全站免登陆