List governanceRoleDefinitions

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Caution

This version of the Privileged Identity Management (PIM) API for Azure Resource roles will be deprecated soon. Please use the new Azure REST PIM API for Azure resource roles.

Get a collection of governanceRoleDefinitions on a resource.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Azure resources

Permission type Permissions
Delegated (work or school account) PrivilegedAccess.ReadWrite.AzureResources
Delegated (personal Microsoft account) Not supported.
Application PrivilegedAccess.Read.AzureResources

Azure AD

Permission type Permissions
Delegated (work or school account) PrivilegedAccess.ReadWrite.AzureAD
Delegated (personal Microsoft account) Not supported.
Application PrivilegedAccess.Read.AzureAD

Groups

Permission type Permissions
Delegated (work or school account) PrivilegedAccess.ReadWrite.AzureADGroup
Delegated (personal Microsoft account) Not supported.
Application PrivilegedAccess.Read.AzureADGroup

Besides the permission scope, this API requires the requestor to have at least one role assignment on the resource.

HTTP request

GET /privilegedAccess/azureResources/resources/{resourceId}/roleDefinitions
GET /privilegedAccess/azureResources/roleDefinitions?$filter=resourceId+eq+'{resourceId}'

Optional query parameters

This method supports the OData query parameters to help customize the response.

Request headers

Name Description
Authorization Bearer {code}

Request body

Do not supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and collection of governanceRoleDefinition objects in the response body.

Example

This example shows how to get all role definitions of the subscription Wingtip Toys - Prod.

Request
GET https://graph.microsoft.com/beta/privilegedAccess/azureResources/resources/e5e7d29d-5465-45ac-885f-4716a5ee74b5/roleDefinitions  
Response
HTTP/1.1 200 OK
Content-type: application/json
Content-Length: 21906

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#governanceRoleDefinitions",
    "value": [
        {
            "id": "00efc9e0-1b96-4e9a-99a3-a3df0735cf88",
            "resourceId": "e5e7d29d-5465-45ac-885f-4716a5ee74b5",
            "externalId": "/subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d/providers/Microsoft.Authorization/roleDefinitions/befefa01-2a29-4197-83a8-272ff33ce314",
            "templateId": "befefa01-2a29-4197-83a8-272ff33ce314",
            "displayName": "DNS Zone Contributor"
        },
        {
            "id": "051f7264-a992-429a-b345-90415af9f917",
            "resourceId": "e5e7d29d-5465-45ac-885f-4716a5ee74b5",
            "externalId": "/subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d/providers/Microsoft.Authorization/roleDefinitions/c12c1c16-33a1-487b-954d-41c89c60f349",
            "templateId": "c12c1c16-33a1-487b-954d-41c89c60f349",
            "displayName": "Reader and Data Access"
        },
        {
            "id": "0789c03d-445d-40ab-aed3-d110a98146c7",
            "resourceId": "e5e7d29d-5465-45ac-885f-4716a5ee74b5",
            "externalId": "/subscriptions/38ab2ccc-3747-4567-b36b-9478f5602f0d/providers/Microsoft.Authorization/roleDefinitions/5d28c62d-5b37-4476-8438-e587778df237",
            "templateId": "5d28c62d-5b37-4476-8438-e587778df237",
            "displayName": "New Relic APM Account Contributor"
        },
  ]
}