Skip to content

Commit b5014c2

Browse files
committed
fix: add more logging to mfa report
1 parent 5f899fb commit b5014c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/CIPPCore/Public/Get-CIPPMFAState.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ function Get-CIPPMFAState {
1717
}
1818
}
1919

20+
$Errors = [System.Collections.Generic.List[object]]::new()
2021
try {
2122
$SecureDefaultsState = (New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/policies/identitySecurityDefaultsEnforcementPolicy' -tenantid $TenantFilter ).IsEnabled
2223
} catch {
2324
Write-Host "Secure Defaults not available: $($_.Exception.Message)"
25+
$Errors.Add(@{Step = 'SecureDefaults'; Message = $_.Exception.Message })
2426
}
2527
$CAState = [System.Collections.Generic.List[object]]::new()
2628

@@ -29,6 +31,7 @@ function Get-CIPPMFAState {
2931
} catch {
3032
$CAState.Add('Not Licensed for Conditional Access') | Out-Null
3133
$MFARegistration = $null
34+
$Errors.Add(@{Step = 'MFARegistration'; Message = $_.Exception.Message })
3235
Write-Host "User registration details not available: $($_.Exception.Message)"
3336
}
3437

@@ -58,6 +61,7 @@ function Get-CIPPMFAState {
5861
} catch {
5962
$CASuccess = $false
6063
$CAError = "CA policies not available: $($_.Exception.Message)"
64+
$Errors.Add(@{Step = 'CAPolicies'; Message = $_.Exception.Message })
6165
}
6266
}
6367

@@ -110,6 +114,7 @@ function Get-CIPPMFAState {
110114
CoveredByCA = $CoveredByCA
111115
CAPolicies = $UserCAState
112116
CoveredBySD = $SecureDefaultsState
117+
Errors = $Errors
113118
RowKey = [string]($_.UserPrincipalName).replace('#', '')
114119
PartitionKey = 'users'
115120
}

0 commit comments

Comments
 (0)