我在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。我无法弄清楚出了什么问题,有人可以指导吗?
请参阅MS PowerShell GitHub上的这两个未解决的问题
适用于Mac OSX的Powershell Core安装
https://github.com/PowerShell/PowerShell/issues/7178
文档:Connect-AzureRmAccount是错误的?
这意味着…
术语“Connect-AzureRmAccount”未被识别为名称
...它无法找到,所以表现得不像是自动加载。
因此,明确导入模块。
Get-Module -ListAvailable
Import-Module -Name AzureRM -DisableNameChecking -Force