Skip to content

Commit d529de4

Browse files
Merge pull request KelvinTegelaar#1723 from ZenTopBrandon/feature-admin-mfa-report
Add Admin Role Reporting to MFA User List
2 parents ac3d8d9 + 9d84176 commit d529de4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Modules/CIPPCore/Public/Get-CIPPMFAState.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ function Get-CIPPMFAState {
6969
}
7070

7171
if ($CAState.count -eq 0) { $CAState.Add('None') | Out-Null }
72+
73+
$assignments = New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments?`$expand=principal" -tenantid $TenantFilter -ErrorAction SilentlyContinue
7274

75+
$adminObjectIds = $assignments |
76+
Where-Object {
77+
$_.principal.'@odata.type' -eq '#microsoft.graph.user'
78+
} |
79+
ForEach-Object {
80+
$_.principal.id
81+
}
7382

7483
# Interact with query parameters or the body of the request.
7584
$GraphRequest = $Users | ForEach-Object {
@@ -98,6 +107,7 @@ function Get-CIPPMFAState {
98107
$CoveredByCA = 'Not Enforced'
99108
}
100109
}
110+
$IsAdmin = if ($adminObjectIds -contains $_.ObjectId) { $true } else { $false }
101111

102112
$PerUser = $_.PerUserMFAState
103113

@@ -117,6 +127,7 @@ function Get-CIPPMFAState {
117127
CoveredByCA = $CoveredByCA
118128
CAPolicies = $UserCAState
119129
CoveredBySD = $SecureDefaultsState
130+
IsAdmin = $IsAdmin
120131
RowKey = [string]($_.UserPrincipalName).replace('#', '')
121132
PartitionKey = 'users'
122133
}

0 commit comments

Comments
 (0)