Connect-AzureRMAccount:术语“Connect-AzureRMAccount”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

Ami*_*shi 3 powershell azure azure-rm

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

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

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

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

我期待第 5 步会弹出登录窗口。请帮忙

小智 9

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
Run Code Online (Sandbox Code Playgroud)