【问题标题】:Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, function, script file, or operable programConnect-AzureRMAccount:术语“Connect-AzureRMAccount”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称
【发布时间】:2019-10-07 20:37:10
【问题描述】:

我在 Azure PowerShell 中遇到问题。我无法连接到 AzureRM 帐户。它显示此错误:

Connect-AzureRMAccount :术语“Connect-AzureRMAccount”不是 识别为 cmdlet、函数、脚本文件或可操作的名称 程序。检查名称的拼写,或者是否包含路径, 验证路径是否正确,然后重试。在行:1 字符:1 + 连接 AzureRMAccount + ~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Connect-AzureRMAccount:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

我在 Mac OS 中执行此操作。首先,我使用以下命令安装了 PowerShell:brew cask install PowerShell。 然后我做了以下事情:

  1. 安装模块 AzureRM -AllowClobber -Scope CurrentUser。
  2. 安装模块 Azure。
  3. 安装模块 AzureRM。
  4. 导入模块 AzureRM。
  5. Connect-AzureRMAccount(显示上述错误)。

我希望第 5 步会弹出登录窗口。请帮忙

【问题讨论】:

  • 我前段时间遇到了同样的问题,我在安装 AzureRM PS 模块之前通过安装 NuGet 包来修复它,但它是 Windows 10 设备,所以无法确认它是否可以在 Mac 上运行.
  • get-command *azurerm* 的输出是什么,你可以按照这个在 mac 上安装 PowerShell,thatlazyadmin.com/2169-2
  • 我已经尝试了懒惰管理员的解决方案。没有帮助!并且 get-command azurerm 给出了 1978 个命令输出
  • NUGet 包有什么作用?

标签: azure powershell azure-rm


【解决方案1】:

AzureRM 模块在 macOS 上不可用。您将需要 Az 模块。它有大量的奇偶校验和启用兼容别名的选项 (Enable-AzureRmAlias): https://azure.microsoft.com/en-us/blog/azure-powershell-cross-platform-az-module-replacing-azurerm/

请记住,这个模块通常是未来(Windows、macOS 和 Linux...以及 Azure Cloud Shell 中的)。

以下 cmdlet 很有用:

Install-Module -Name Az -AllowClobber
Import-Module Az
Connect-AzAccount

【讨论】:

  • 如何安装 Az 模块?然后我需要登录到 azureRM 帐户。有可能吗?
  • @AmitJoshi Install-Module Az - 但请注意:您不应将 Az 与 AzureRM 并排安装。在安装 Az 之前删除所有 AzureRM 模块。
  • 在这一点上,在执行此操作之前,还值得阅读有关新 Az 模块和迁移到它的文档:docs.microsoft.com/en-us/powershell/azure/…
猜你喜欢
  • 2017-08-11
  • 2018-10-08
  • 2021-11-01
  • 2021-05-23
  • 2020-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多