Skip to content
Home » Blog » How to set up a quick connection to Exchange Online

How to set up a quick connection to Exchange Online

If you’re going to be working with Office 365 via PowerShell, it’s a good idea to set up your computer with the appropriate PowerShell cmdlets and versions.

It’s also a good idea to create shortcuts to the various Office 365 services, so you can quickly log on to them without having to copy and paste commands one by one.

Here are some instructions on TechNet that detail the prerequisites for a connection to Exchange Online, though you might find you’ve got these installed already:

Easily connect to Exchange Online via PowerShell

Open PowerShell as an administrator

Go to Start, search for PowerShell, right click Windows Powershell and Run as Administrator

Create a PowerShell profile with a function

Run this:

New-item –type file –force $profile

Then this:

notepad $profile

Now copy the following PowerShell function into the notepad document and save it:

(Be sure to replace [email protected] with a global admin).

Function Connect-ExchOnline{

$credentials = Get-Credential -Credential [email protected]
Write-Output “Loading the Exchange Online cmdlets”

$Session = New-PSSession -ConnectionUri `
-ConfigurationName Microsoft.Exchange -Credential $credentials `
-Authentication Basic -AllowRedirection
Import-PSSession $Session

Use the new function to connect quickly to Exchange Online
Close Powershell and run it again.

From now on you can just type Connect-ExchOnline to connect.

Run the new Function To Connect To Exchange Online
Enter your password and away you go.