karthikN
karthikN

Reputation: 73

Azure REST API : How to get Repository Security policies "Bypass policies when completing pull requests" and "Bypass policies when pushing"

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 ?

Upvotes: 0

Views: 189

Answers (1)

Evelyn Chen-MSFT
Evelyn Chen-MSFT

Reputation: 179

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

Upvotes: 0

Related Questions