TLS安全通道建立信任关系

TLS安全通道建立信任关系

本文介绍了Login-AzureRmAccount无法为SSL/TLS安全通道建立信任关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Powershell连接到Azure.当我尝试使用命令Login-AzureRmAccount时,会弹出一个窗口,输入我的凭据.但是,此后我立即收到错误消息:

I am trying to connect to Azure using Powershell. When I try the command Login-AzureRmAccount, I get a pop-up to enter my credentials. But, immediately after that I get an error:

Login-AzureRmAccount : Service returned error. Check InnerException for more details: The underlying connection was
closed: Could not establish trust relationship for the SSL/TLS secure channel.
At line:1 char:1
+ Login-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzureRmAccount], AadAuthenticationFailedException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.AddAzureRMAccountCommand

有人可以阐明这一点吗?

Can someone shed some light on this?

更新以下是我看到的内部异常:

UpdateThe below inner exception is what I see:

推荐答案

我相当确定这会绕过您的问题,但实际上并没有解决.

I'm fairly certain this will bypass your problem but not actually solve it.

免责声明:这是不安全的,如果您确定所收到的证书错误是误报,或者您确实不愿意这样做,则应该仅 完成.不在乎!这种方法使您可以轻松建立与恶意和/或受感染站点的连接.这是PowerShell的等效功能,等同于转到Internet Explorer中的网页,获取证书错误,然后单击仍然继续"链接.

DISCLAIMER: This is not secure, and should only be done if you are certain that the certificate error you are getting is a false positive, or you truly don't care! This method leaves you open to establishing connections to malicious and/or compromised sites. This is the PowerShell equivalent to going to a web page in Internet Explorer, getting a certificate error, and clicking the Continue Anyway link.

如果尝试手动登录并出现证书错误,但可以继续进行,则可以在PowerShell中禁用证书检查,使其行为类似.在尝试登录到Azure之前运行此行将禁用当前会话的证书检查.只要有证书错误,您每次都要登录Azure都必须运行此程序.

If you try to manually login, and get a certificate error, but are ok with continuing past it then you can disable certificate checking in PowerShell so that it behaves similarly. Running this line before you try to login to Azure will disable certificate checking for the current session. You will have to run this each time you want to login to Azure, so long as there is a certificate error.

 [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

一个更好的解决方案可能是解决您看到的SSL/TLS问题,但这很可能更适合 ServerFault 之类的.

A better solution would probably be to resolve the SSL/TLS issue that you are seeing, but that is most likely something better suited for ServerFault or something.

这篇关于Login-AzureRmAccount无法为SSL/TLS安全通道建立信任关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:42