Connect to Exchange Online with PowerShell
Connecting to Exchange Online via PowerShell offers more administrative control than you otherwise have available in the web interface. It's very useful for bulk changes, automation and situations where finer administrative control is required.
The Exchange Online PowerShell module is the easiest way to connect to your instance. It has built-in support for MFA so you don't need to generate an app password to interact and prevents non MFA credentials from leaking. To get working with the Exchange Online PowerShell module follow the steps below:
Install the Exchange Online PowerShell Module:
- Open https://admin.microsoft.com
- Click 'Admin Centers'
- Click 'Exchange' on the left
- Click 'hybrid' on the left
- Click 'configure' under '…Exchange Online PowerShell Module supports…'
- Install the module
Connect to your instance:
- Open the 'Exchange Online PowerShell Module'
- Run the following command to connect:
Connect-EXOPSSession -UserPrincipalName <365 Username>
3. Login to the prompt
4. Check if you can successfully query your instance by listing any available mailbox's:
Get-Mailbox