1. Home
  2. Office 365
  3. Connect to Office 365 Via PowerShell With MFA Enabled Account
  1. Home
  2. PowerShell
  3. Connect to Office 365 Via PowerShell With MFA Enabled Account

Connect to Office 365 Via PowerShell With MFA Enabled Account

When trying to connect to Office 365 via PowerShell with an MFA enabled account you will need to install the Microsoft Azure Active Directory Module. The steps below will show you how to download and install the module and then connect using an MFA enabled account.

  • Open the Start menu on your computer and search for ‘Powershell
  • Right-click on Windows PowerShell and choose ‘Run as administrator’
  • Once the PowerShell window opens type in the following command
    Install-Module -Name MSOnline
  • Press Enter
  • When prompted to install and import the NuGet provider now type ‘Y’
  • Press Enter
  • If/When prompted to use an Untrusted repository type ‘Y
  • Press Enter
  • The Azure AD Module will now install
  • Once the modules have installed type the following command
    Connect-MsolService
  • Press Enter
  • The Microsoft Sign in Window will appear. Enter your Office 365 username and click Next
  • Enter you Office 365 password and click Sign in
  • You are now connected to Azure AD/Office 365.

Note: You only need to install the Azure AD Module once per machine. To connect to Office 365 after the module is installed you can just enter the command Connect-MsolService to connect.

If you wish to perform PowerShell commands for Exchange Online you will need run additional PowerShell commands to connect. Leave the Powershell window open and connect to Exchange Online using the steps on the following link
http://itwalkthroughs.com/knowledge-base/how-to-connect-to-exchange-online-via-powershell/

Updated on April 1, 2019

Was this article helpful?

Related Articles

Leave a Comment