unable to connect to exchange online powershell module

Roger Roger 5,046 Reputation points
2021-08-26T19:09:53.313+00:00

Hi All

i am getting below error when connecting to exchange online PowerShell module.
I have global admin rights and also i have Organization Management admin role in exchange admin center.

Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

PS C:\windows\system32> $UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
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
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,317 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,438 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Kael Yao-MSFT 37,586 Reputation points Microsoft Vendor
    2021-08-27T05:22:33.383+00:00

    Hi @Roger Roger

    It seems you are trying to use basic authentication to connect to EXO powershell.
    Please note that basic authentication is a less secure authentication method and is suggested to be turned-off in your Microsoft 365 tenants.

    As DimitriS suggested, please consider using modern auth to connect to EXO powershell.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.