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
- Run PowerShell as an administrator
- Enter into the PowerShell window the below command, hit enter and then type ‘Y’ and hit enter –
Set-ExecutionPolicy RemoteSigned - Enter the below command and put in your Microsoft365 administrator credentials in the login box which pops-up –
$UserCredential = Get-Credential
- 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!