You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/roles/list-role-assignments-users.md
+14-81Lines changed: 14 additions & 81 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,111 +46,44 @@ Follow these steps to list Azure AD roles for a user using the Azure portal. You
46
46
47
47
Follow these steps to list Azure AD roles assigned to a user using PowerShell.
48
48
49
-
1. Install AzureADPreview and Microsoft.Graph module using [Install-module](/powershell/azure/active-directory/install-adv2).
49
+
1. Install Microsoft.Graph module using [Install-module](/powershell/azure/active-directory/install-adv2).
50
50
51
51
```powershell
52
-
Install-module -name AzureADPreview
53
52
Install-module -name Microsoft.Graph
54
53
```
55
-
56
-
2. Open a PowerShell window and use [Import-Module](/powershell/module/microsoft.powershell.core/import-module) to import the AzureADPreview module. For more information, see [Prerequisites to use PowerShell or Graph Explorer](prerequisites.md).
57
-
58
-
```powershell
59
-
Import-Module -Name AzureADPreview -Force
60
-
```
61
-
62
-
3. In a PowerShell window, use [Connect-AzureAD](/powershell/module/azuread/connect-azuread) to sign in to your tenant.
63
54
64
-
```powershell
65
-
Connect-AzureAD
66
-
```
67
-
4. Use [Get-AzureADMSRoleAssignment](/powershell/module/azuread/get-azureadmsroleassignment) to get roles assigned directly to a user.
4. Use the [List transitiveRoleAssignments](/graph/api/rbacapplication-list-transitiveroleassignments) API to get roles assigned directly and transitively to a user.
95
62
96
-
$userRoleAssignableGroups = (Invoke-MgGraphRequest -Method POST -Uri $uri -Body @{"ids"= $roleAssignableGroups}).value
97
-
```
98
-
99
-
d. Use [Get-AzureADMSRoleAssignment](/powershell/module/azuread/get-azureadmsroleassignment) to loop through the groups and get the roles assigned to them.
6. Combine both direct and transitive role assignments of the user.
109
-
110
-
```powershell
111
-
$allRoles = $directRoles + $transitiveRoles
112
-
```
113
-
114
72
## Microsoft Graph API
115
73
116
74
Follow these steps to list Azure AD roles assigned to a user using the Microsoft Graph API in [Graph Explorer](https://aka.ms/ge).
117
75
118
76
1. Sign in to the [Graph Explorer](https://aka.ms/ge).
119
77
120
-
1. Use the [List unifiedRoleAssignments](/graph/api/rbacapplication-list-roleassignments) API to get roles assigned directly to a user. Add following query to the URL and select **Run query**.
78
+
1. Use the [List transitiveRoleAssignments](/graph/api/rbacapplication-list-transitiveroleassignments) API to get roles assigned directly and transitively to a user. Add following query to the URL.
121
79
122
80
```http
123
-
GET https://graph.microsoft.com/v1.0/rolemanagement/directory/roleAssignments?$filter=principalId eq '55c07278-7109-4a46-ae60-4b644bc83a31'
81
+
GET https://graph.microsoft.com/beta/rolemanagement/directory/transitiveRoleAssignments?$count=true&$filter=principalId eq '6b937a9d-c731-465b-a844-2d5b5368c161'
124
82
```
125
83
126
-
3.To get transitive roles assigned to the user, follow these steps.
84
+
3.Navigate to **Request headers** tab. Add `ConsistencyLevel` as key and `Eventual` as its value.
127
85
128
-
a. Use the [List groups](/graph/api/group-list) API to get the list of all role assignable groups.
129
-
130
-
```http
131
-
GET https://graph.microsoft.com/v1.0/groups?$filter=isAssignableToRole eq true
132
-
```
133
-
134
-
b. Pass this list to the [checkMemberObjects](/graph/api/user-checkmemberobjects) API to figure out which of the role assignable groups the user is member of.
135
-
136
-
```http
137
-
POST https://graph.microsoft.com/v1.0/users/55c07278-7109-4a46-ae60-4b644bc83a31/checkMemberObjects
138
-
{
139
-
"ids": [
140
-
"936aec09-47d5-4a77-a708-db2ff1dae6f2",
141
-
"5425a4a0-8998-45ca-b42c-4e00920a6382",
142
-
"ca9631ad-2d2a-4a7c-88b7-e542bd8a7e12",
143
-
"ea3cee12-360e-411d-b0ba-2173181daa76",
144
-
"c3c263bb-b796-48ee-b4d2-3fbc5be5f944"
145
-
]
146
-
}
147
-
```
148
-
149
-
c. Use the [List unifiedRoleAssignments](/graph/api/rbacapplication-list-roleassignments) API to loop through the groups and get the roles assigned to them.
150
-
151
-
```http
152
-
GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?$filter=principalId eq '5425a4a0-8998-45ca-b42c-4e00920a6382'
0 commit comments