Connect to Office 365 Exchange Online using PowerShell
Any Exchange admin will be used to administering their environment with PowerShell. Here is how to connect to your Office 365 Exchange Online environment with just a few commands:
$UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session
Note: If multi-factor authentication is enabled you will need to download and install the Exchange Online PowerShell Module:
- Log in to the Exchange admin centre
- Click the Hybrid link from the navigation pane on the left
- Click the configure button for the Exchange Online PowerShell Module
- Click Install when prompted
- Click Run if prompted
- Connect using the following command and authenticate as normal when prompted:
Connect-EXOPSSession -UserPrincipalName user@domain.com