Skip to content

Commit

Permalink
func: get-msfmfastatus remove additionalproperties
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTaylorLee committed Sep 18, 2024
1 parent d41416a commit ccffd71
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions modules/AdminToolbox.MSGraph/public/Get-msgMFAStatus.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,17 @@ function Get-msgMFAStatus {
foreach ($user in $users) {

$myObject = [PSCustomObject]@{
user = $null
MFAstatus = $null
email = $null
fido2 = $null
MicrosoftAuthenticator = $null
password = $null
Authenticatorpasswordless = $null
phone = $null
softwareoath = $null
tempaccess = $null
hellobusiness = $null
AdditionalPropertiesemail = $null
AdditionalPropertiesfido2 = $null
AdditionalPropertiesMicrosoftAuthenticator = $null
AdditionalPropertiespassword = $null
AdditionalPropertiesAuthenticatorpasswordless = $null
AdditionalPropertiesphone = $null
AdditionalPropertiessoftwareoath = $null
AdditionalPropertiestempaccess = $null
AdditionalPropertieshellobusiness = $null
user = $null
MFAstatus = $null
email = $null
fido2 = $null
MicrosoftAuthenticator = $null
password = $null
Authenticatorpasswordless = $null
phone = $null
softwareoath = $null
tempaccess = $null
hellobusiness = $null
}

$MFAData = Get-MgUserAuthenticationMethod -UserId $user.UserPrincipalName #-ErrorAction SilentlyContinue
Expand All @@ -76,50 +67,41 @@ function Get-msgMFAStatus {
"#microsoft.graph.emailAuthenticationMethod" {
$myObject.email = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiesemail = $MFAData.AdditionalProperties["emailAddress"]
}
"#microsoft.graph.fido2AuthenticationMethod" {
$myObject.fido2 = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiesfido2 = $MFAData.AdditionalProperties["model"]
}
'#microsoft.graph.passwordlessMicrosoftAuthenticatorAuthenticationMethod' {
$myObject.Authenticatorpasswordless = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiesAuthenticatorpasswordless = $MFAData.AdditionalProperties["displayName"]
}
"#microsoft.graph.microsoftAuthenticatorAuthenticationMethod" {
$myObject.MicrosoftAuthenticator = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiesMicrosoftAuthenticator = $MFAData.AdditionalProperties["displayName"]
}
"#microsoft.graph.passwordAuthenticationMethod" {
$myObject.password = $true
# When only the password is set, then MFA is disabled.
if ($myObject.MFAstatus -ne "Enabled") {
$myObject.MFAstatus = "Disabled"
}
$myObject.AdditionalPropertiespassword = $MFAData.AdditionalProperties["displayName"]
}
"#microsoft.graph.phoneAuthenticationMethod" {
$myObject.phone = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiesphone = $MFAData.AdditionalProperties["phoneType", "phoneNumber"] -join ' '
}
"#microsoft.graph.softwareOathAuthenticationMethod" {
$myObject.softwareoath = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiessoftwareoath = $MFAData.AdditionalProperties["displayName"]
}
"#microsoft.graph.temporaryAccessPassAuthenticationMethod" {
$myObject.tempaccess = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertiestempaccess = 'TapLifetime:' + $MFAData.AdditionalProperties["lifetimeInMinutes"] + 'm - Status:' + $MFAData.AdditionalProperties["methodUsabilityReason"]
}
"#microsoft.graph.windowsHelloForBusinessAuthenticationMethod" {
$myObject.hellobusiness = $true
$myObject.MFAstatus = "Enabled"
$myObject.AdditionalPropertieshellobusiness = $MFAData.AdditionalProperties["displayName"]
}
}
}
Expand Down

0 comments on commit ccffd71

Please sign in to comment.