If you are running Windows 2012 R2 or higher you can jump straight to running the commands. If you are running an older version of Windows Server then you will need to install WMF 4.0. You’ll also need to enable remote-signed powershell scripts for the below commands to work.
Connect to Exchange Online PowerShell:
Initiate a prompt in which you enter your Office 365 admin credentials:
$UserCredential = Get-Credential
Prep to import the office 365 powershell commandlets: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import commandlets: Import-PSSession $Session
Disconnect your session when finished (this is critical):