为什么我会随机出现此错误。,Powershell脚本有时会正常工作,有时无法正常工作并抛出以下错误。
Connect-MsolService : An error occurred while making the HTTP request to
https://provisioningapi.microsoftonline.com/provisioningwebservice.svc. This could be due to the fact that the server
certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the
security binding between the client and the server.
At D:\O365License\Licensing.ps1:28 char:1
+ Connect-MsolService -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [Connect-MsolService], CommunicationException
+ FullyQualifiedErrorId :
System.ServiceModel.CommunicationException,Microsoft.Online.Administration.Automation.ConnectMsolService
答案 0 :(得分:0)
您可能会遇到与TLS 1.2有关的.NET相关问题。在运行Connect-MsolService
命令之前,请尝试运行此命令。
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12