Feb 29 2020
07:31 AM
- last edited on
May 24 2021
03:19 PM
by
TechCommunityAP
Feb 29 2020
07:31 AM
- last edited on
May 24 2021
03:19 PM
by
TechCommunityAP
We’ve been asked many times to do a bulk pre-registration for Azure Active Directory MFA to provide our customers’ users more Seamless Single Sign on and smooth for MFA rolling out.
This script helping you to:
NOTE : Before we proceed with MFA and SSPR Enablement and configuration, Users will be able to change their Authentication mobile phone number whenever they need to, Admins won’t have a control on Authentication mobile phone number however they can pre-define them but still users will be able to change it.
Keep in mind:
$UsersCSV = "<Users CSV File Path>" # Example C:\Temp\UsersMFA.csv
$OutPutFolder = "C:\Temp" # Example C:\Temp
Get-AzureADUser | select UserPrincipalName, Mobile | Where-Object { $_.Mobile -ne $null }
Get-AzureADUser | select UserPrincipalName, Mobile | Where-Object { $_.Mobile -eq $null }
Get-AzureADUser | select DisplayName, UserPrincipalName, otherMails, Mobile, TelephoneNumber | Format-Table
Get-MsolUser -All | select DisplayName -ExpandProperty StrongAuthenticationUserDetails | ft DisplayName, PhoneNumber, Email | Out-File $OutPutFolder"\StrongAuthenticationUserDetails.csv" -Verbose
Get-Msol User -All | select DisplayName -ExpandProperty StrongAuthenticationUserDetails | Where-Object { $_.PhoneNumber -eq $null } | ft DisplayName, PhoneNumber, Email | Out-File $OutPutFolder"\StrongAuthenticationUserPhoneNumberNull.csv" -Verbose
Get-MsolUser -All | select DisplayName, UserPrincipalName -ExpandProperty StrongAuthenticationMethods | select UserPrincipalName, IsDefault, MethodType
(get-msoluser -All | Where { $_.StrongAuthenticationUserDetails -ne $null })
(get-msoluser -All | Where { $_.StrongAuthenticationUserDetails -eq $null })
Import-CSV -Path $UsersCSV | ForEach-Object {
Set-AzureADUser -ObjectId $_.UserPrincipalName -Mobile $_.Mobile -ErrorAction SilentlyContinue}
$OneWaySMS = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod
$OneWaySMS.IsDefault = $false
$OneWaySMS.MethodType = "OneWaySMS"
$TwoWayVoiceMobile = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod
$TwoWayVoiceMobile.IsDefault = $true
$TwoWayVoiceMobile.MethodType = "TwoWayVoiceMobile"
$PhoneAppNotification = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod
$PhoneAppNotification.IsDefault = $false
$PhoneAppNotification.MethodType = "PhoneAppNotification"
$PhoneAppOTP = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod
$PhoneAppOTP.IsDefault = $false
$PhoneAppOTP.MethodType = "PhoneAppOTP"
$methods = @($OneWaySMS, $TwoWayVoiceMobile, $PhoneAppNotification, $PhoneAppOTP)
Import-CSV -Path $UsersCSV | Foreach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -StrongAuthenticationMethods $methods} -ErrorAction SilentlyContinue
Import-CSV -Path $UsersCSV | ForEach-Object {
Set-AzureADUser -ObjectId $_.UserPrincipalName -OtherMails $_.OtherMails -Mobile $_.Mobile -TelephoneNumber $_.TelephoneNumber -ErrorAction SilentlyContinue}
Jul 26 2021 11:56 AM