Charu
Charu

Reputation: 2749

New-AzureRmResourceGroup command not working in powershell

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

Upvotes: 1

Views: 1718

Answers (2)

Droobie
Droobie

Reputation: 101

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.

Upvotes: 0

Shui shengbao
Shui shengbao

Reputation: 19195

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.

Upvotes: 3

Related Questions