How to connect to Exchange Online PowerShell

PowerShell for Exchange online screenshot

Intro

As a Microsoft365 or formerly referred to as Office365 administrator there will come a time when you will need to make some changes using PowerShell for Exchange online, the most common reason for using PowerShell for Exchange online is calendar delegation.

If your administrative account has MFA (multifactor authentication) enabled, please see our article here

Process

  1. Run PowerShell as an administrator

    Step 1. Launch Powershell as an administrator

  2. Enter into the PowerShell window the below command, hit enter and then type ‘Y’ and hit enter –


    Set-ExecutionPolicy RemoteSigned

     

    Step 2 - allow execution of remote scripts PowerShell command

  3. Enter the below command and put in your Microsoft365 administrator credentials in the login box which pops-up –

    $UserCredential = Get-Credential


    Step 3 - Authenticate to Exchange Online Powershell
  4. Enter the following two commands one after the other –
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

    Then –

    Import-PSSession $Session
    You are now connected to Exchange Online PowerShell!

Leave a Comment

Your email address will not be published. Required fields are marked *