【发布时间】:2017-02-08 09:50:39
【问题描述】:
运行 PowerShell ISE (V4),我安装 AzureRM 模块如下
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
【问题讨论】:
-
尝试重新安装整个模块?
-
现在尝试
Install-Module AzureRm时,我收到错误No match was found for the specified search criteria and module name AzureRm。类似于this。将尝试再次安装PowerShellGet。 -
不。视窗 8.1。我在代理后面工作 - 不确定这是否导致我之前评论中的错误。很奇怪,因为我可以列出所有 Azure 模块,但似乎无法使用它们。
-
你从中得到了什么:Get-Module -ListAvailable -Name Azure -Refresh
-
@juvchan:我使用该命令时没有显示任何内容。但是如果我使用
Get-Module -ListAvailable -Name Azure* -Refresh,我确实会得到一个很长的列表。我需要Install-Module Azure和Install-Module AzureRM吗?我认为前者仅适用于 ASM。
标签: powershell azure