skip to Main Content

Enable MFA Office 365 with PowerShell

We need to enable MFA for Office 365 users for extra security. What is the fastest and safest way to enable Office 365 MFA? In this article, you will learn how to enable MFA Office 365 for all users and one user with PowerShell.


Why do you need to enable MFA Office 365? A couple of reasons are:

  • Secure environment from attacks
  • Move from another MFA vendor

Note: Do you have Azure AD Premium plan 1 or 2? We recommend you configure Azure AD Multi-Factor Authentication instead of per-user MFA (this article).

Connect to Azure AD PowerShell

Start Windows PowerShell and connect to Azure AD PowerShell.


Enable MFA Office 365 for single user

Enable MFA for a single Office 365 user.

$mf= New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$mf.RelyingParty = "*"
$mfa = @($mf)

Set-MsolUser -UserPrincipalName "" -StrongAuthenticationRequirements $mfa

Enable MFA Office 365 for all users

Enable MFA for all Office 365 users.

$mf= New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$mf.RelyingParty = "*"
$mfa = @($mf)

Get-MsolUser -All | Set-MsolUser -StrongAuthenticationRequirements $mfa

Export Office 365 MFA status

Do you like to verify that MFA for the users is successfully enabled? An excellent way is to export Office 365 users MFA status report with PowerShell.

Enable MFA Office 365 with PowerShell

That’s it!

Important: Always use MFA to protect the accounts from attacks and compromised passwords. It adds another layer of protection that helps organizations.

Read more: Disable MFA Office 365 with PowerShell »


You learned how to enable MFA Office 365 with PowerShell. Connect to Azure AD with PowerShell and run the command to enable MFA for all Office 365 users or single user. Don’t forget to always use MFA for extra protection.

Did you enjoy this article? You may also like Move from per-user MFA to Conditional Access MFA. Don’t forget to follow us and share this article.



ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 4 Comments

  1. This method appears to have stopped working in the last week 🙁

    It returns an error:
    Cannot convert value “System.Object[]” to type “System.Management.Automation.SwitchParameter”. Boolean parameters accept
    only Boolean values and numbers, such as $True, $False, 1 or 0.
    At line:3 char:1
    + $mfa = @($mf)

    Any ideas what’s happened?

Leave a Reply

Your email address will not be published.