Ubuntu:'Login-AzureRmAccount'无法识别为cmdlet的名称

时间:2017-04-03 06:18:42

标签: powershell azure ubuntu

我在我的Ubuntu机器上安装了Powershell。当我在PowerShell中输入Login-AzureRmAccount时,我收到如下错误:

PS> Login-AzureRmAccount                                                                                              
Login-AzureRmAccount : The term 'Login-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
+ Login-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Login-AzureRmAccount:String) [], CommandNotFoundException

当我输入Get-Module -ListAvailable -Name Azure -Refresh时,我没有得到任何结果。

PowerShell版本:

powershell -version
powershell v6.0.0-alpha.17

如何解决上述错误?

1 个答案:

答案 0 :(得分:3)

您需要先安装Azure PowerShell模块:

#Azure RM NetCore Preview Module Install
powershell Install-Module AzureRM.NetCore.Preview
powershell Import-Module AzureRM.NetCore.Preview

这是我的考验。

root@shui:/home# powershell 
PowerShell 
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS /home> Login-AzureRmAccount                                             
VERBOSE: To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code F2RKUXRNE to authenticate.

有关详细信息,请参阅此link