| title | List transitiveRoleAssignment |
|---|---|
| description | List direct and transitive role assignments for a specific principal. |
| ms.localizationpriority | medium |
| author | DougKirschner |
| ms.reviewer | msodsrbac |
| ms.subservice | entra-directory-management |
| doc_type | apiPageType |
| ms.date | 07/26/2024 |
Namespace: microsoft.graph
[!INCLUDE beta-disclaimer]
Get the list of direct and transitive unifiedRoleAssignment objects for a specific principal. For example, if a user is assigned a Microsoft Entra role through group membership, the role assignment is transitive, and this request will list the group's ID as the principalId. Results can also be filtered by the roleDefinitionId and directoryScopeId. Supported only for directory (Microsoft Entra ID) provider.
For more information, see Use Microsoft Entra groups to manage role assignments.
Note
This request might have replication delays for role assignments that were recently created, updated, or deleted.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
[!INCLUDE rbac-role-assignment-apis-read]
To list transitive role assignments for a directory provider:
GET /roleManagement/directory/transitiveRoleAssignments?$filter=principalId eq '{principalId}'This method requires the $filter (eq) OData query parameter to scope the transitive role assignments to a principal. You can narrow the scope of the request by expanding the filter to other supported properties. This method also supports the $count and $select OData query parameters to help customize the response. For general information, see OData query parameters.
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| ConsistencyLevel | eventual. This header, $count, and $filter are required. For more information about the use of ConsistencyLevel, $count, and $filter, see Advanced query capabilities on directory objects. |
Don't supply a request body for this method.
If successful, this method returns a 200 OK response code and a collection of unifiedRoleAssignment objects in the response body.
If your request doesn't include the ConsistencyLevel header set to eventual, this method returns 404 Not Found response code.
For the examples in this section, consider the following role assignment scenario. A user named Alice has both direct and transitive role assignments as follows:
| User | Group | Role | Scope | Role assignment ID |
|---|---|---|---|---|
Alice2c7936bc-3517-40f3-8eda-4806637b6516 |
User Administratorfe930be7-5e62-47db-91af-98c3a49a38b1 |
Tenant | RA1857708a7-b5e0-44f9-bfd7-53531d72a739 |
|
G1ae2fc327-4c71-48ed-b6ca-f48632186510(Alice is a member) |
User Administratorfe930be7-5e62-47db-91af-98c3a49a38b1 |
Tenant | RA28a021d5f-7351-4713-aab4-b088504d476e |
|
G26ffb34b8-5e6d-4727-a7f9-93245e7f6ea8(Alice is a member) |
Helpdesk Administrator729827e3-9c14-49f7-bb1b-9608f156bbb8 |
Administrative unit (AU1)26e79164-0c5c-4281-8c5b-be7bc7809fb2 |
RA36cc86637-13c8-473f-afdc-e0e65c9734d2 |
- Alice is assigned the User Administrator role directly at tenant scope with role assignment RA1.
- Alice is member of a group G1 and G1 is assigned the User Administrator role at tenant scope with role assignment RA2.
- Alice is also a member of group G2 and G2 is assigned the Helpdesk Administrator role at an administrative unit AU1 scope with role assignment RA3.
The following example shows a request. This request requires the ConsistencyLevel header set to eventual and the $count=true and $filter query parameters. For more information about the use of ConsistencyLevel, $count, and $filter, see Advanced query capabilities on directory objects.
GET https://graph.microsoft.com/beta/roleManagement/directory/transitiveRoleAssignments?$count=true&$filter=principalId eq '2c7936bc-3517-40f3-8eda-4806637b6516'
ConsistencyLevel: eventual
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/transitiveRoleAssignments",
"value": [
{
"id": "857708a7-b5e0-44f9-bfd7-53531d72a739",
"principalId": "2c7936bc-3517-40f3-8eda-4806637b6516",
"directoryScopeId": "/",
"roleDefinitionId": "fe930be7-5e62-47db-91af-98c3a49a38b1"
},
{
"id": "8a021d5f-7351-4713-aab4-b088504d476e",
"principalId": "ae2fc327-4c71-48ed-b6ca-f48632186510",
"directoryScopeId": "/",
"roleDefinitionId": "fe930be7-5e62-47db-91af-98c3a49a38b1"
},
{
"id": "6cc86637-13c8-473f-afdc-e0e65c9734d2",
"principalId": "6ffb34b8-5e6d-4727-a7f9-93245e7f6ea8",
"directoryScopeId": "/administrativeUnits/26e79164-0c5c-4281-8c5b-be7bc7809fb2",
"roleDefinitionId": "729827e3-9c14-49f7-bb1b-9608f156bbb8"
}
]
}The following example shows a request. This request requires the ConsistencyLevel header set to eventual and the $count=true and $filter query parameters. For more information about the use of ConsistencyLevel, $count, and $filter, see Advanced query capabilities on directory objects.
GET https://graph.microsoft.com/beta/roleManagement/directory/transitiveRoleAssignments?$count=true&$filter=principalId eq '2c7936bc-3517-40f3-8eda-4806637b6516' and roleDefinitionId eq 'fe930be7-5e62-47db-91af-98c3a49a38b1'
ConsistencyLevel: eventual
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/transitiveRoleAssignments",
"value": [
{
"id": "857708a7-b5e0-44f9-bfd7-53531d72a739",
"principalId": "2c7936bc-3517-40f3-8eda-4806637b6516",
"directoryScopeId": "/",
"roleDefinitionId": "fe930be7-5e62-47db-91af-98c3a49a38b1"
},
{
"id": "8a021d5f-7351-4713-aab4-b088504d476e",
"principalId": "6ffb34b8-5e6d-4727-a7f9-93245e7f6ea8",
"directoryScopeId": "/",
"roleDefinitionId": "fe930be7-5e62-47db-91af-98c3a49a38b1"
}
]
}Example 3: Get direct and transitive role assignments of a principal, but only administrative unit scoped
The following example shows a request. This request requires the ConsistencyLevel header set to eventual and the $count=true and $filter query parameters. For more information about the use of ConsistencyLevel, $count, and $filter, see Advanced query capabilities on directory objects.
GET https://graph.microsoft.com/beta/roleManagement/directory/transitiveRoleAssignments?$count=true&$filter=principalId eq '2c7936bc-3517-40f3-8eda-4806637b6516' and directoryScopeId eq '/administrativeUnits/26e79164-0c5c-4281-8c5b-be7bc7809fb2'
ConsistencyLevel: eventual
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability. All the properties will be returned from an actual call.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#roleManagement/directory/transitiveRoleAssignments",
"value": [
{
"id": "6cc86637-13c8-473f-afdc-e0e65c9734d2",
"principalId": "6ffb34b8-5e6d-4727-a7f9-93245e7f6ea8",
"directoryScopeId": "/administrativeUnits/26e79164-0c5c-4281-8c5b-be7bc7809fb2",
"roleDefinitionId": "729827e3-9c14-49f7-bb1b-9608f156bbb8"
}
]
}