2017-04-03 130 views
0

我在我的Ubuntu机器中安装了Powershell。当我进入到Login-AzureRmAccount PowerShell中,我得到如下错误:Ubuntu:无法将“Login-AzureRmAccount”识别为cmdlet的名称

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 

如何解决上面的错误?

+0

您可以尝试“Get-Module -ListAvailable”查看所有模块,并查看是否可以使用azure。如果没有,则不安装。 – Aravind

+0

嗨,你的Ubuntu版本是什么? Ubuntu 14.0.4或16? –

回答

3

您需要首先安装在Azure PowerShell的模块:

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

这是我的测试。

[email protected]:/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

+0

现在有效。有什么用途首先安装PowerShell版本? – karan

+0

你是什么意思? –

+0

为什么我需要执行“powershell安装模块AzureRM.NetCore.Preview”和“powershell导入模块AzureRM.NetCore.Preview”? – karan

相关问题