Skip to content
PowerShell and Exchange Online

Connect to Exchange Online for Microsoft 365 Using PowerShell

If you're managing Microsoft 365 for Business, you may eventually need to perform tasks in Exchange Online that aren’t available through the standard web interface. To do this, you’ll need to connect via PowerShell, which gives you direct access to advanced configuration options through command-line commands.

 

When I was first learning this process, I had no problem finding documentation on the individual commands for Exchange—but I struggled to find clear instructions on how to connect to a client’s Microsoft 365 tenant using PowerShell. This guide breaks down that connection process step by step. In future posts, I’ll dive deeper into useful Exchange Online commands, and I’ll be linking back to this post so it’s easy to follow along.

 

 

1 Open PowerShell

Note: Be sure to run PowerShell as Administrator

 

 

2 Set the Execution Policy

Before installing modules, you'll want to ensure PowerShell allows trusted remote scripts to run:

Set-ExecutionPolicy RemoteSigned

 

 

3 Install the Exchange Online Management Module

This command installs the module that gives you access to Exchange Online cmdlets:

Import-Module ExchangeOnlineManagement

💡 If prompted, go ahead and accept installation of NuGet and trust the repository.

 

 

4 Connect to Exchange Online

Now you're ready to sign in using your Microsoft 365 admin credentials:

Connect-ExchangeOnline -UserPrincipalName "admin-user@microsoftaccount-clientdomain.com"

Once connected, you're ready to start issuing Exchange Online commands.

You can contact my best friend and food provider with this form. Suggestions, corrections, and questions are always welcome! Please also message me French fries...

Scratch

Contact Form