New-AzureRmResourceGroup command not working in powershell

女生的网名这么多〃 提交于 2021-02-10 17:47:06

问题


I have logged into my Azure account and selected the appropriate subscription. But it always gives the same error

PS C:\WINDOWS\system32> New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location "East US"
New-AzureRmResourceGroup : Run Login-AzureRmAccount to login.
At line:1 char:1
+ New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-AzureRmResourceGroup], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzur
   eResourceGroupCmdlet

回答1:


I have selected the subscription too using select-azuresubscription

select-azuresubscription is used for ASM mode.

For ARM mode, you need use Get-AzureRmSubscription -SubscriptionName "your sub" | Select-AzureRmSubscription to select your subscription.

More information please refer to this example.

Update:

You could use the following cmdlet to check Azure PowerShell version.

Get-Module -ListAvailable -Name Azure -Refresh

You could install the latest PowerShell from the link.




回答2:


I had the same problem and I solved it by changing the environment setting from Bash to Powershell in the upper left corner of the Cloud Shell Window.



来源:https://stackoverflow.com/questions/42827788/new-azurermresourcegroup-command-not-working-in-powershell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!