Home

[Hybrid Exchange] Connect Create PowerShell Session to Exchange Online

%3CLINGO-SUB%20id%3D%22lingo-sub-622118%22%20slang%3D%22en-US%22%3E%5BHybrid%20Exchange%5D%20Connect%20Create%20PowerShell%20Session%20to%20Exchange%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-622118%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20working%20with%20Windows%2010%2C%20and%20want%20to%20connect%20to%20Exchange%20Online%2C%20but%20facing%20some%20errors.%3C%2FP%3E%3CP%3EIt's%20my%20code%3A%3C%2FP%3E%3CPRE%3E%24adm%3CSPAN%3E_credential%20%3D%20Get-Credential%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%24Session%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%3D%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3ENew-PSSession%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-ConfigurationName%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BMicrosoft.Exchange%20%3C%2FSPAN%3E%3CSPAN%3E-ConnectionUri%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bhttps%3A%2F%2Foutlook.office.de%2Fp%3C%2FSPAN%3E%3CSPAN%3Eowershell-liveid%2F%20%3C%2FSPAN%3E%3CSPAN%3E-Credential%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%24adm_credential%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E-Authentication%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BBasic%20%3C%2FSPAN%3E%3CSPAN%3E-AllowRedirection%3C%2FSPAN%3E%3C%2FPRE%3E%3CDIV%20class%3D%22190331%22%3E%3CSPAN%3EAnd%20I%20got%20this%20error%3A%3C%2FSPAN%3E%3C%2FDIV%3E%3CBLOCKQUOTE%3E%3CDIV%20class%3D%22190331%22%3E%3CSPAN%3ENew-PSSession%20%3A%20%5Boutlook.office.de%5D%20Connecting%20to%20remote%20server%20outlook.office.de%20failed%20with%20the%20following%20error%3CBR%20%2F%3Emessage%20%3A%3CBR%20%2F%3E%5BClientAccessServer%3DFRXPR01CA0067%2CBackEndServer%3D%2CRequestId%3Dc4cbbb6f-9bc6-4b14-8d86-e15333e12777%2CTimeStamp%3D5%2F21%2F2019%3CBR%20%2F%3E6%3A54%3A32%20AM%5D%20%5BFailureCategory%3DCafe-HttpProxyException%5D%20Failed%20to%20resolve%20tenant%20name%20from%20SMTP%20address%3CBR%20%2F%3E'username%40mydomain.com'.%20For%20more%20information%2C%20see%20the%20about_Remote_Troubleshooting%20Help%20topic.%3CBR%20%2F%3EAt%20line%3A1%20char%3A12%3CBR%20%2F%3E%2B%20%24Session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-Conne%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20OpenError%3A%20(System.Manageme....RemoteRunspace%3ARemoteRunspace)%20%5BNew-PSSession%5D%2C%20PSRemotin%3CBR%20%2F%3EgTransportException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20-2144108477%2CPSSessionOpenFailed%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FBLOCKQUOTE%3E%3CDIV%20class%3D%22190331%22%3EI%20checked%20all%20prerequisites%2C%20and%20didn't%20find%20any%20exception.%3C%2FDIV%3E%3CDIV%20class%3D%22190331%22%3EPowerShell%20sessions%20could%20be%20established%20to%20on-premise%20AD%2C%20on-premise%20Exchange%2C%20AzureAD%2C%20msolService%2C%20and%20so%20on.%3C%2FDIV%3E%3CDIV%20class%3D%22190331%22%3EI%20googled%20the%20error%2C%20and%20tried%20every%20solution%20I%20could%20get.%3C%2FDIV%3E%3CDIV%20class%3D%22190331%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22190331%22%3EHow%20can%20I%20establish%20the%20connection%3F%20Thank%20you%20in%20advance.%3C%2FDIV%3E%3CDIV%20class%3D%22190331%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-622118%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EHybrid%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-622689%22%20slang%3D%22en-US%22%3ERe%3A%20%5BHybrid%20Exchange%5D%20Connect%20Create%20PowerShell%20Session%20to%20Exchange%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-622689%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F318077%22%20target%3D%22_blank%22%3E%40chenrylee%3C%2FA%3EIs%20MFA%20enabled%20in%20the%20tenant%20%3F%20In%20case%2C%20you%20need%20to%20install%20and%20use%20appropriate%20Powershell%20modules%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-638861%22%20slang%3D%22en-US%22%3ERe%3A%20%5BHybrid%20Exchange%5D%20Connect%20Create%20PowerShell%20Session%20to%20Exchange%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-638861%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F318077%22%20target%3D%22_blank%22%3E%40chenrylee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20seems%20that%20you've%20got%20the%20wrong%20ConnectionUri%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Foutlook.office.de%2Fpowershell-liveid%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office.de%2Fpowershell-liveid%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E-%20You%20should%20use%20this%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3ESet-ExecutionPolicy%20RemoteSigned%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%24UserCredential%20%3D%20Get-Credential%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%24Session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%3C%2FA%3E%20-Credential%20%24UserCredential%20-Authentication%20Basic%20-AllowRedirection%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EImport-PSSession%20%24Session%20-DisableNameChecking%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%20Most%20expected%20reason%2C%20your%20tenant%20is%20not%20registered%20in%20Germany.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EAkshay%3C%2FP%3E%3CP%3EExchange%20admin%20%7C%20Apps4Rent%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-638869%22%20slang%3D%22en-US%22%3ERe%3A%20%5BHybrid%20Exchange%5D%20Connect%20Create%20PowerShell%20Session%20to%20Exchange%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-638869%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F318077%22%20target%3D%22_blank%22%3E%40chenrylee%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20seems%20that%20you've%20got%20the%20wrong%20ConnectionUri%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Foutlook.office.de%2Fpowershell-liveid%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office.de%2Fpowershell-liveid%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E-%20You%20should%20use%20this%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3ESet-ExecutionPolicy%20RemoteSigned%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%24UserCredential%20%3D%20Get-Credential%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%24Session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%3C%2FA%3E%20-Credential%20%24UserCredential%20-Authentication%20Basic%20-AllowRedirection%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EImport-PSSession%20%24Session%20-DisableNameChecking%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-%20Most%20expected%20reason%2C%20your%20tenant%20is%20not%20registered%20in%20Germany.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EAkshay%3C%2FP%3E%3CP%3EExchange%20admin%20%7C%20Apps4Rent%3C%2FP%3E%3C%2FLINGO-BODY%3E
chenrylee
Occasional 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