Sometimes you need to use Powershell to manipulate Exchange Online. When MFA is enabled, you may get something like the following error:
New-PSSession : [ps.outlook.com] Connecting to remote server ps.outlook.com failed with the following error message :Access is denied.
To fix this situation, you’ll need to setup EXO V2 on your local PC. To do this:
- Make sure EXO V2 is installed on your local PC – https://docs.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps#install-and-maintain-the-exo-v2-module
- Make sure WINRM is running. Do this by opening a command prompt (in admin mode) and running: winrm quickconfig
- Then connect to Exchange using the following instructions: https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps
- Use the following command to connect: Connect-ExchangeOnline -UserPrincipalName [admin-account] -ShowProgress $true