无法使用电源外壳连接到Exchange Server

问题描述

我正在尝试使用Power Shell连接到Office 365 Exchange服务器。我正在使用以下给定的命令进行连接

$cred=Get-Credential

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

但是我收到如下错误

New-PSSession : 
[outlook.office365.com] Connecting to Remote Server outlook.office365.com Failed with the following error message : The WinRM client cannot process the request. Basic
authentication is currently disabled in the client configuration. Change the client configuration and try the request again. For more information,see the about_Remote_Troubleshooting
Help topic.

请帮助我。

解决方法

您似乎需要使用现代身份验证:

GitHub issue

,

Windows远程管理(WinRM)需要允许基本身份验证才能创建Exchange会话。如果禁用了基本身份验证,则尝试连接时会出现上述错误。

要检查是否已启用基本身份验证,请在命令提示符下运行以下命令。

winrm get winrm/config/client/auth

如果未设置Basic = true,则需要运行以下命令来启用基本身份验证。

winrm set winrm/config/client/auth @{Basic="true"}

来源:https://o365reports.com/2019/04/17/connect-exchange-online-using-mfa/