2017-02-07 48 views
5

运行所PowerShell ISE中(V4),我安装AzureRM模块如下PowerShell的天青Cmdlet的未认可

Import-Module AzureRM 

然后我检查版本

(get-module azurerm).Version 

返回

Major Minor Build Revision 
3  4  0  -1 

然后我尝试使用登录cmdlet

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 
    + FullyQualifiedErrorId : CommandNotFoundException 

我在做什么错?

注意 我的工作背后的代理,并已经使用下面的命令来避开它

[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials 

我还设置了PSGallery回购如下

Register-PSRepository -Name "PSGallery" -SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted 
+0

尝试重新安装整个模块? – 4c74356b41

+0

现在,在尝试“Install-Module AzureRm”时,出现错误“找不到指定搜索条件和模块名称AzureRm”的匹配项。与[this]类似(https://github.com/PowerShell/PowerShell/issues/1874)。将尝试再次安装'PowerShellGet'。 –

+0

没有。 Windows 8.1。我在一个代理的后面工作 - 不知道这是否导致我以前的评论中的错误。奇怪虽然我可以列出所有的Azure模块,但似乎无法使用它们。 –

回答

1

登录-AzureRmAccount只是Add-AzureRmAccount的别名,用于访问Azure帐户中的ARM资源。

Add-AzureAccount用于访问Azure帐户中的“经典”资源。

+0

因此'Add-AzureAccount'似乎工作 - 窗口打开我添加凭据等。运行'Get-AzureAccount'显示我的帐户。但是,试图使用像'New-AzureRmResourceGroup ...'只是错误告诉我'运行Login-AzureRmAccount' - 当我尝试这样做时,我得到了和以前一样的错误,即'..不被识别为cmdlet的名称...'。 –

+0

你能够运行'Add-AzureRmAccount'吗?您只能登录才能访问经典资源('Add-AzureAccount'),因此无法运行'New-AzureRmResoucegroup'。 – schruberg

+0

有道理,但仍然困扰我的困惑 - 显然,无法使用“Login-AzureRmAccount”,因为它无法识别。 –

2

我升级到Windows管理框架5,我现在可以运行 命令登录-AzureRMAccount

此外,我们可以下载Azure的PowerShell的安装文件并安装它。 我们可以从这个页面下载PS版3.3.0安装文件:

https://github.com/Azure/azure-powershell/releases/tag/v3.3.0-December2016

+0

只需登录即可查看提供的信息是否有帮助。如果您需要进一步的帮助,请告诉我。 –