【问题标题】:Connect-AzureRmAccount - Cannot connect to AzureConnect-AzureRmAccount - 无法连接到 Azure
【发布时间】:2019-10-24 22:38:52
【问题描述】:

尝试从 Powershell 连接 Azure 时出现以下错误:

PS H:\> Connect-AzureRmAccount
Connect-AzureRmAccount : An error occurred while sending the request.
At line:1 char:1
+ Connect-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Connect-AzureRmAccount], HttpRequestException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

【问题讨论】:

  • 您是否尝试使用 Connect-AzureRmAccount -debug 查看详细错误?
  • 这有点不相关,但 AzureRM 已弃用,如果可能,您应该尝试使用 Az powershell 模块:docs.microsoft.com/en-us/powershell/azure/…。至少如果你要开始一个新项目:-)

标签: azure powershell azure-rm


【解决方案1】:

尝试几件事:

有时,powershell cmdlet 不会给出正确的错误消息,因为它会抑制它,要获得实际错误,您可以尝试使用 -debug 属性执行,或者您可以尝试使用DebugPreference,如下所示。

$DebugPreference = "Continue"
Write-Debug -Message "Hello, World"

或者,Connect-AzureRMAccount cmdlet 默认使用 TLS 1.0 连接到 azure,有时它会被组织安全策略阻止,

你可以设置如下:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

补充参考:

Connect-AzureRmAccount : accessing_ws_metadata_exchange_failed

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 2018-11-04
    • 1970-01-01
    • 2023-02-04
    • 1970-01-01
    相关资源
    最近更新 更多