Forum Discussion
[Hybrid Exchange] Connect Create PowerShell Session to Exchange Online
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
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
3 Replies
- Akshay_ManeIron Contributor
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
- Akshay_ManeIron Contributor
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
- GiuseppeStrozziCopper Contributor
chenryleeIs MFA enabled in the tenant ? In case, you need to install and use appropriate Powershell modules