Using Azure REST API on Repository Security policies, how to get values that got assigned for

Bypass policies when completing pull requests and
Bypass policies when pushing

As on audit we need to regularly check the above Azure Repo Policies, can anyone share the related API for this ?

1

There are 1 best solutions below

1
Evelyn Chen-MSFT On

You could use this API:

POST https://dev.azure.com/{OrgName}/_apis/Contribution/HierarchyQuery?api-version=6.0-preview

Request body:

{
"contributionIds":[
    "ms.vss-admin-web.security-view-permissions-data-provider"
    ],
"dataProviderContext":{
    "properties":{
        "subjectDescriptor":
        "You could get from the network trace",
        "permissionSetId":"You could get from the network trace",
        "permissionSetToken":"You could get from the network trace",
        "accountName":"[ProjectName]\\GroupName",
        "sourcePage":{
            "routeId":"ms.vss-admin-web.project-admin-hub-route",
            "routeValues":{
            "project":"ProjectName",
            "serviceHost":"OrgName"}
            }
        }
    }
}

Please replace the certain value with your own information.

Here's a screenshot showing where to find the value of "subjectDescriptor", "permissionSetId"and "permissionSetToken":

enter image description here

Here's a sample response you will get:

enter image description here