21V账号运行powershell命令报错
Set-ExecutionPolicy RemoteSigned
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell-LiveID/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
该命令是基本身份认证连接O365的,现在必须使用新式认证来连接:
1)请您使用管理员身份打开PowerShell,以下命令只需要运行一次,选择Y:
Set-ExecutionPolicy remotesigned
2)黄字部分更改为自己的管理员用户名;链接成功后会有进度条显示;
install-Module -Name ExchangeOnlineManagement #安装一次即可
Import-module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName edward@supere3.partner.onmschina.cn -AzureADAuthorizationEndpointUri https://login.chinacloudapi.cn/common/oauth2/v2.0/token -ConnectionUri https://partner.outlook.cn/PowerShell
报错原因,旧式身份验证的停止使用与新式身份验证的开始。