Forum Discussion
Report on MFA Status with Conditional Access
Is there any effective way to get a report of the actual MFA state of your users?
I mean, the individual MFA state as well as MFA enabled via Conditional Access.
It's easy to report on the individual MFA state. You get nice results: Enabled, Disabled, Enforced...
However, if MFA is enabled via Conditional Access I can't seem to find an effective way to report on them.
Below Powershell snippet is the closest I can get.
It will check if MFA is enabled individually. If not, it will check the "StrongAuthenticationMethods.IsDefault" attribute and report on that.
But this is not always accurate, because if the "Phone" or "Alternate Phone" are configured in the Azure user object, it will still report it here even if the user is not member of a Conditional Access policy.
There is a built-in Azure report for this, but it is completely incorrect. It says that, for instance, I'm not enabled for MFA even though I'm enabled for the last 6 years.
Report: https://portal.azure.com/#blade/Microsoft_AAD_IAM/AuthMethodsOverviewBlade
Has anyone figured this out yet?
$user = get-msoluser -UserPrincipalName yourUserName@contoso.com
$StrongAuthenticationMethodsresult = $user.StrongAuthenticationMethods | Select-Object MethodType, IsDefault
[PSCustomObject]@{
UserPrincipalName = $user.UserPrincipalName
ObjectID = $user.objectid
DisplayName = $user.DisplayName
AuthEmail = $user.StrongAuthenticationUserDetails.Email
AuthPhoneNumber = $user.StrongAuthenticationUserDetails.PhoneNumber
PhoneDeviceName = $user.StrongAuthenticationPhoneAppDetails.DeviceName
AuthAltPhone = $user.StrongAuthenticationUserDetails.AlternativePhoneNumber
State = if ($user.StrongAuthenticationRequirements.State -ne $null) { $user.StrongAuthenticationRequirements.State } elseif ( $user.StrongAuthenticationMethods.IsDefault -eq $true) { "ConditionalAccess ($(($user.StrongAuthenticationMethods| Where IsDefault -eq $True).MethodType))" } else { "Disabled" }
PhoneAppNotification = if ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "PhoneAppNotification" }) { $true } else { $false }
PhoneAppNotificationIsDefault = IF ( ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "PhoneAppNotification" }).isDefault -eq "True") { $true } Else { $false }
PhoneAppOTP = if ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "PhoneAppOTP" }) { $true } else { $false }
PhoneAppOTPIsDefault = IF ( ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "PhoneAppOTPIsDefault" }).isDefault -eq "True") { $true } Else { $false }
TwoWayVoiceMobile = if ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "TwoWayVoiceMobile" }) { $true } else { $false }
TwoWayVoiceMobileIsDefault = IF ( ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "TwoWayVoiceMobileIsDefault" }).isDefault -eq "True") { $true } Else { $false }
OneWaySMS = if ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "OneWaySMS" }) { $true } else { $false }
OneWaySMSIsDefault = IF ( ($StrongAuthenticationMethodsresult | Where-Object { $_.MethodType -eq "OneWaySMSIsDefault" }).isDefault -eq "True") { $true } Else { $false }
}
- n3versCopper Contributor
I've been using this script, it reports on users that are mfa enforced via CA policy and have a disabled mfa user state.
https://gallery.technet.microsoft.com/office/Export-Office-365-Users-81747c73
- NidalTBrass Contributor
n3vers
Thanks. I already came across that script.It basically does the same as mine.
It's not accurate.
If there is a Conditional Access policy, but due to some conditions a particular account is not affacted by it and he has an Authentication Phone configured, the script (like mine) will report that MFA is enabled even though it's not enforced.
We have a couple of these accounts in our environment.
While everything is under control here, I wanted to have a reliable report where I can look at occasionally to identify such accounts if they, for some reason, slip through.
- Tim_BixleyCopper Contributor
NidalT
Did you ever find an accurate way to report on MFA as have just found our current reporting have the same issue.
- SimonBrownCopper Contributor
Another flaw with the admindroid script is that it only report the admin status for users who are actively assigned admin roles. If users are eligible for use through PIM, it does not recognise them as admin accounts.
This will require use of the AzureADPreview module by the looks of it. I am not opening that can of worms today.