Syntax
# connect MSOL Services
Connect-MsolService
#Get MFA Detail of all users
Get-MsolUser -All | select DisplayName,BlockCredential,UserPrincipalName,@{N=”MFA Status”; E={ if( $_.StrongAuthenticationRequirements.State -ne $null){ $_.StrongAuthenticationRequirements.State} else { “Disabled”}}}
#Enable MFA for Single users
$mf= New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$mf.RelyingParty = “*”
$mfa = @($mf)
Download Full Script
| Purpose: | Enable or disable MFA in O365 for a single user and multiple |
| Modification: | - |
| Type: | PowerShell (.ps1) |
| Compatibility: | Run with PowerShell |
| Tags: | MFA, O365, M365, Microsoft |
| Reference link: |