List appRoleAssignments granted to a user
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.
Retrieve the list of appRoleAssignment that a user has been granted. This operation also returns app roles assigned to groups that the user is a direct member of.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | User.ReadBasic.All, Directory.Read.All, AppRoleAssignment.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. |
Application | Directory.Read.All, AppRoleAssignment.ReadWrite.All |
HTTP request
GET /users/{id | userPrincipalName}/appRoleAssignments
Optional query parameters
This method supports the OData query parameters to help customize the response.
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. |
Request body
Do not supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of appRoleAssignment objects in the response body.
Examples
Example 1: List appRoleAssignments granted to a user
Request
Here is an example of the request to retrieve the app roles that have been assigned to a user.
GET https://graph.microsoft.com/beta/users/cdb555e3-b33e-4fd5-a427-17fadacbdfa7/appRoleAssignments
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "41W1zT6z1U-kJxf62svfp1HFE8pMZhxDun-ThPczmJE",
"deletedDateTime": null,
"appRoleId": "00000000-0000-0000-0000-000000000000",
"creationTimestamp": "2021-02-02T04:22:45.9480566Z",
"principalDisplayName": "Alex Wilber",
"principalId": "cdb555e3-b33e-4fd5-a427-17fadacbdfa7",
"principalType": "User",
"resourceDisplayName": "dxprovisioning-graphapi-client",
"resourceId": "8e881353-1735-45af-af21-ee1344582a4d"
}
]
}
Example 2: List appRoleAssignments granted to a user, filtered by resourceId
Request
Here is an example of the request to retrieve the app roles that have been assigned to a user, filtering by a resourceId
, which is a GUID type.
GET https://graph.microsoft.com/beta/users/cdb555e3-b33e-4fd5-a427-17fadacbdfa7/appRoleAssignments?$filter=resourceId eq 8e881353-1735-45af-af21-ee1344582a4d
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#appRoleAssignments",
"value": [
{
"id": "41W1zT6z1U-kJxf62svfp1HFE8pMZhxDun-ThPczmJE",
"creationTimestamp": "2021-02-02T04:22:45.9480566Z",
"appRoleId": "00000000-0000-0000-0000-000000000000",
"principalDisplayName": "MOD Administrator",
"principalId": "cdb555e3-b33e-4fd5-a427-17fadacbdfa7",
"principalType": "User",
"resourceDisplayName": "dxprovisioning-graphapi-client",
"resourceId": "8e881353-1735-45af-af21-ee1344582a4d"
}
]
}
Feedback
Submit and view feedback for