question

RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 asked KaelYao-MSFT commented

unable to connect to exchange online powershell module


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

office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-itpro
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DimitriS-7800 avatar image
1 Vote"
DimitriS-7800 answered

Is there a reason you are not using the Connect-ExchangeOnline commandlet?

 Connect-ExchangeOnline -UserPrincipalName navin@contoso.com


https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell?view=exchange-ps


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KaelYao-MSFT avatar image
0 Votes"
KaelYao-MSFT answered KaelYao-MSFT commented

Hi @RogerRoger-2394

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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RogerRoger-2394

Just checking in to see if above information was helpful. Please let us know if you would like further assistance.

0 Votes 0 ·