Connecting to Remote Server outlook.office365.com Failed With the Following Error Message : Access is Denied

Connecting to remote server outlook.office365.com - access is denied

When you use PowerShell to connect to Exchange Online you may encounter an Access is Denied error message:

New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : 
Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
At line:2 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Import-PSSession : Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument,
and then try running the command again.
At line:3 char:18
+ Import-PSSession $Session -DisableNameChecking
+                  ~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Import-PSSession], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ImportPSSessionCommand

This error message is usually caused by one of the following three issues:

  1. You entered an invalid user name or password
  2. You do not have the proper permissions/roles
  3. You are using the old EXO module

The first and second issues are easily fixed by checking your credentials and role assignment in Office 365.

The solution to the third issue is to use the EXO V2 module to connect to Exchange Online.

Install EXO V2 using the following command:

Install-Module ExchangeOnlineManagement

Once the EXO V2 module is installed you can connect to Exchange Online with MFA using the following command:

Connect-ExchangeOnline

How to Manage Exchange Online Mailboxes From Active Directory

Easy365Manager is a snap-in to Active Directory Users & Computers that allows you to manage Office 365 licenses and mailboxes directly from AD user properties.

With Easy365Manager you no longer need to use PowerShell or the multiple Office 365 web consoles to manage Office 365.

The Easy365Manager snap-in gives you access to Office 365 license and mailbox management directly from AD Users & Computers:

Easy365Manager Office 365 user properties
User properties - Office 365 tab
Exchange Online Mailbox properties in AD Users & Computers
User properties - Mailbox tab

With these new tabs you can perform Office 365 mailbox management without leaving AD Users & Computers.

You can even perform tasks that are normally only available via PowerShell, e.g., like configuring calendar permissions:

Review the full feature list to see how Easy365Manager will consolidate your AD and Office 365 management and allow you to remove your on-premises Exchange Server.

You can try out Easy365Manager risk-free by downloading the fully functional 30-day trial here.