Connect/Disconnect Powershell to Exchange Online

Requirements: Windows Azure Cmdlets for Windows Powershell.

First thing first, start your Powershell with Windows Azure Cmdlets

Create a placeholder for your credentials:

$LiveCred = Get-Credential

Popup box will ask for your Office 365 Global Administrator credentials.

Create a placeholder for your Powershell Session towards Exchange Online.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $LiveCred -Authentication Basic -AllowRedirection

Import your Powershell Session to connect to Exchange Online.

Import-PSSession $Session

Disconnect your Powershell from Exchange Online to prevent you from reaching the limit of connections to Exchange Online.

Remove-PSSession $Session

If you don’t disconnect your session it will meintane a session for another 15 minutes.

Leave a Reply


I am Roy Apalnes, a Microsoft Cloud Evangelist working av Sopra Steria. Main focus in Microsoft Security and Endpoint Management, with a bigger picture in mind.

Featured Posts