[Hybrid Exchange] Connect Create PowerShell Session to Exchange Online

Contributor

I'm working with Windows 10, and want to connect to Exchange Online, but facing some errors.

It's my code:

$adm_credential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office.de/powershell-liveid/ -Credential $adm_credential -Authentication Basic -AllowRedirection
And I got this error:
New-PSSession : [outlook.office.de] Connecting to remote server outlook.office.de failed with the following error
message :
[ClientAccessServer=FRXPR01CA0067,BackEndServer=,RequestId=c4cbbb6f-9bc6-4b14-8d86-e15333e12777,TimeStamp=5/21/2019
6:54:32 AM] [FailureCategory=Cafe-HttpProxyException] Failed to resolve tenant name from SMTP address
'username@mydomain.com'. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
gTransportException
+ FullyQualifiedErrorId : -2144108477,PSSessionOpenFailed
I checked all prerequisites, and didn't find any exception.
PowerShell sessions could be established to on-premise AD, on-premise Exchange, AzureAD, msolService, and so on.
I googled the error, and tried every solution I could get.
 
How can I establish the connection? Thank you in advance.
 
3 Replies

@chenryleeIs MFA enabled in the tenant ? In case, you need to install and use appropriate Powershell modules

@chenrylee 

 

It seems that you've got the wrong ConnectionUri https://outlook.office.de/powershell-liveid/

- You should use this

 

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

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

Import-PSSession $Session -DisableNameChecking

 

- Most expected reason, your tenant is not registered in Germany.

 

Regards,

Akshay

Exchange admin | Apps4Rent

 

@chenrylee 

 

It seems that you've got the wrong ConnectionUri https://outlook.office.de/powershell-liveid/

- You should use this 

Set-ExecutionPolicy RemoteSigned

$UserCredential = Get-Credential

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

Import-PSSession $Session -DisableNameChecking

 

- Most expected reason, your tenant is not registered in Germany.

 

Regards,

Akshay

Exchange admin | Apps4Rent