我在Windows Server 2012 R2上安装了AzureRm和Azure模块。我可以从此模块运行其他cmdlet(例如,AddAdzureRmAccount,Get-AzureRmSubscription)但是Login-AzureRmAccount和Select-AzureRmSubscription抛出了无法识别的错误:
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
我已经尝试卸载 - 重新安装并重新启动VM。
我在这里做错了什么?如果有人之前已经解决了这个问题,请提出解决方案。
答案 0 :(得分:2)
好像他们的powergallery设置已损坏,我使用webPI安装它并且工作正常。
对于webPI下载说明:
https://regularitguy.com/2014/03/13/installing-the-windows-azure-powershell-cmdlets/
答案 1 :(得分:1)
登录-AzureRmAccount
安装模块AzureRM -Scope CurrentUser
Get-Module -List
答案 2 :(得分:0)
注意::请使用azure RM
登录名通过服务主体进行连接:
$applicationId = "$securePassword = "ServicePrincipal Passowrd" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword
Connect-AzureRmAccount -ServicePrincipal -Credential $credential -TenantId "ServicePrincipal Tenant ID"