Aug 06 2019
03:48 AM
- last edited on
Jan 14 2022
04:38 PM
by
TechCommunityAP
Aug 06 2019
03:48 AM
- last edited on
Jan 14 2022
04:38 PM
by
TechCommunityAP
Hi All
Is it possible to create a report showing users with / without an Alternative Authentication Phone Number?
Info greatly appreciated
Aug 06 2019 06:48 AM
Aug 06 2019 05:53 PM
Great article, however, nothing happens when the following command is run:
$Result | Where {$_.MFAStatus -ne "Disabled" -and $_.AlternativePhoneNumber -eq $null}
Any ideas?
Aug 08 2019 04:25 AM
Hi Kevin
I do hope you are well.
Anyway, I did manage to get the following script running
However the output list Users, including myself that DO actually have a 2nd auth phone.
Any ideas?
Aug 09 2019 03:46 AM - edited Aug 09 2019 03:51 AM
Can you run the below command (after replacing your account's UPN) to check the "AlternativePhoneNumber" is configured or not.
$user = Get-MsolUser -UserPrincipalName "UserName@Domain.onmicrosoft.com" $alternativePhoneNumber = $user.StrongAuthenticationUserDetails.AlternativePhoneNumber if($alternativePhoneNumber -ne $null) { Write-Host "AlternativePhoneNumber:" $alternativePhoneNumber -ForegroundColor Green } Else { Write-Host "Alternative auth phone number not configured" -ForegroundColor Red }
Note : This script extracting 2nd auth phone number from MFA Authentication User Details, not from user's Alternative Mobile Number : $user.AlternateMobilePhones
Aug 09 2019 04:00 AM
Hi Kevin
Yes this works, it displays my alternative mob number.
Can this be done tenant wide?
Stuart
Aug 09 2019 05:11 AM - edited Aug 09 2019 05:17 AM
Solution
Can you try the below script to list all users without alternative auth phone number.
$Result=@() $users = Get-MsolUser -All $users | ForEach-Object { $user = $_ $alternativePhoneNumber = $user.StrongAuthenticationUserDetails.AlternativePhoneNumber if($alternativePhoneNumber -eq $null) { $Result += New-Object PSObject -property @{ UserName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName } } } $Result | Select UserName,UserPrincipalName
Or you can try below script to list only MFA enabled users without alternative auth phone.
$Result=@() $users = Get-MsolUser -All | Where {$_.StrongAuthenticationMethods -ne $null -or $_.StrongAuthenticationRequirements.State -ne $nul} $users | ForEach-Object { $user = $_ $alternativePhoneNumber = $user.StrongAuthenticationUserDetails.AlternativePhoneNumber if($alternativePhoneNumber -eq $null) { $Result += New-Object PSObject -property @{ UserName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName } } } $Result | Select UserName,UserPrincipalName
Aug 09 2019 05:27 AM
2nd script looks good.
Your an absolute genius, thank you so much.
Marked your answer as the Best Response.
Have yourself a fab day.
Stuart