首页 > 解决方案 > 无法从 Mac 连接到 Azure

问题描述

我在 AzureRM.Profile 下看到 Connect-AzureRmAccount 命令:

Get-Command -Module AzureRM.Profile* 
CommandType Name                    Version
Cmdlet      Connect-AzureRmAccount  0.13.1

但是当我运行它时,会出现以下错误:

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

我搜索了 stackoverflow,检查了我有最新的 Powershell 版本,安装了 NetCore.Preview。我无法弄清楚出了什么问题,有人可以指导吗?

标签: macosazurepowershellazure-powershell

解决方案


在 MS PowerShell GitHub 上查看这两个未解决的问题

Mac OSX 的 Powershell Core 安装

https://github.com/PowerShell/PowerShell/issues/7178

文档:Connect-AzureRmAccount 错误?

https://github.com/Azure/azure-docs-powershell/issues/552

这意味着……</p>

术语“Connect-AzureRmAccount”未被识别为名称

…它找不到,所以表现得好像它不是自动加载。

因此,对模块进行显式导入。

Get-Module -ListAvailable
Import-Module -Name AzureRM -DisableNameChecking -Force

推荐阅读