运行PowerShell ISE(V4),我按如下方式安装AzureRM模块
Import-Module AzureRM
Run Code Online (Sandbox Code Playgroud)
然后我查看版本
(get-module azurerm).Version
Run Code Online (Sandbox Code Playgroud)
返回
Major Minor Build Revision
3 4 0 -1
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用登录cmdlet
Login-AzureRmAccount
Run Code Online (Sandbox Code Playgroud)
但得到错误
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
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
注意 我在代理后面工作,并使用以下命令来绕过它
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
Run Code Online (Sandbox Code Playgroud)
我还设置了PSGallery回购如下
Register-PSRepository -Name "PSGallery" -SourceLocation "https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted
Run Code Online (Sandbox Code Playgroud)
小智 1
Login-AzureRmAccount 只是 Add-AzureRmAccount 的别名,用于访问 Azure 帐户中的 ARM 资源。
Add-AzureAccount 用于访问 Azure 帐户中的“经典”资源。