Howto – Install and Connect to Office 365 remote powershell with 2FA

Step 1: Install required software

These steps are required once on your computer, not every time you connect. However, you’ll likely need to install newer versions of the software periodically.

  1. Open an elevated Windows PowerShell command prompt (run Windows PowerShell as an administrator).
  2. In the Administrator: Windows PowerShell command window, run this command:
  • Install-Module -Name AzureAD -AllowClobber

Step 2: Connect to your Office 365 subscription

To connect with just an account name and password :

  • $UserCredential = Get-Credential
  • Connect-AzureAD -Credential $UserCredential

To connect with multi-factor authentication (MFA) :

  • Connect-AzureAD

After connecting, you can use the new cmdlets for the 
Azure Active Directory V2 PowerShell module.

Advertisement

Published by

Ronny Van den Broeck

I'm a network and system engineer for more than 20 years now. During this period I became a pro in hunting down one's and zero's, with an eager mindset to help people accomplish the same or abstract them away from the matrix.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s