File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -8,21 +8,10 @@ function Get-CIPPPerUserMFA {
8
8
)
9
9
try {
10
10
if ($AllUsers -eq $true ) {
11
- $AllUsers = New-graphGetRequest - Uri " https://graph.microsoft.com/beta/users?`$ top=999&`$ select=UserPrincipalName,Id" - tenantid $tenantfilter
12
- $Requests = foreach ($id in $AllUsers.userPrincipalName ) {
13
- @ {
14
- id = $int ++
15
- method = ' GET'
16
- url = " users/$id /authentication/requirements"
17
- }
18
- }
19
- $Requests = New-GraphBulkRequest - tenantid $tenantfilter - scope ' https://graph.microsoft.com/.default' - Requests @ ($Requests ) - asapp $true
20
- if ($Requests.body ) {
21
- $UsersWithoutMFA = $Requests.body | Select-Object peruserMFAState, @ {Name = ' UserPrincipalName' ; Expression = { [System.Web.HttpUtility ]::UrlDecode($_ .' @odata.context' .split(" '" )[1 ]) } }
22
- return $UsersWithoutMFA
23
- }
11
+ $AllUsers = New-graphGetRequest - Uri " https://graph.microsoft.com/v1.0/users?`$ top=999&`$ select=UserPrincipalName,Id,perUserMfaState" - tenantid $tenantfilter
12
+ return $AllUsers
24
13
} else {
25
- $MFAState = New-graphGetRequest - Uri " https://graph.microsoft.com/beta/users/$ ( $userId ) /authentication/requirements " - tenantid $tenantfilter
14
+ $MFAState = New-graphGetRequest - Uri " https://graph.microsoft.com/beta/users/$ ( $userId ) ? `$ select=UserPrincipalName,Id,perUserMfaState " - tenantid $tenantfilter
26
15
return [PSCustomObject ]@ {
27
16
PerUserMFAState = $MFAState.perUserMfaState
28
17
UserPrincipalName = $userId
You can’t perform that action at this time.
0 commit comments