Connect to SharePoint Online Using PowerShell and MFA

In this blog post, I will show how to connect to Office 365, SharePoint Online using PowerShell with Multi-factor authentication (MFA).

If you have MFA enabled on your Office 365 account, you won’t be able to connect to Office 365 using PowerShell using the known MFA method.

Get Started

The first thing you need to do is install the SharePoint Online PowerShell module that supports MFA using the following command.

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

After installing the module, use the two-line below.

Enter your Office 365 organization name in the first line.

Run the second line.

$orgName="yourcompany"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
	

After running the two lines you will get the prompt to enter your username, password and approve the login request using MFA.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.