azure - Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, 函数、脚本文件或可运行程序

标签 azure powershell azure-rm

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

Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Connect-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 模块在 macOS 上不可用。您将需要 Az 模块。它具有大量奇偶校验和用于启用兼容别名的选项 (Enable-AzureRmAlias): https://azure.microsoft.com/en-us/blog/azure-powershell-cross-platform-az-module-replacing-azurerm/

请记住,一般而言,此模块代表 future (Windows、macOS 和 Linux...以及 Azure Cloud Shell)。

以下 cmdlet 很有用:

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

关于azure - Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, 函数、脚本文件或可运行程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56238475/

相关文章:

azure - 本地运行具有 nuget 包引用的 Azure Functions 时出错

powershell - 通过NSIS静默运行Powershell

arrays - 使用 Powershell,如何计算数组中每个元素的出现次数?

events - PowerShell中的.NET事件

azure - 无法使用 VS2022 部署通过 Terraform 创建的 Azure 容器应用程序

azure - 未为 "CSPack"任务指定所需参数 "ServiceDefinitionFile"的值

node.js - 如何从 Azure Blob 存储查看图像而不是下载图像?

azure - 尝试使用用户管理身份向 Azure 进行身份验证失败并显示 401

azure - 如何使用 Terraform azurerm 指定 Microsoft Azure API 操作的响应表示的示例

azure - 如何在 Azure Function App 中使用 System.Runtime.Caching