Reputation: 3761
I'm trying to create a new web app service in Azure from powershell, but running into the following error:
New-AzureRmResourceGroup : 'this.Client.SubscriptionId' cannot be null.
$webAppName = "powershelldemowebapp"
$ResourceGroupName = "PowerShellResourceGroup"
$Location = "East Asia"
Login-AzureRmAccount -ServicePrincipal -Tenant 000000-0000-0000-0000-00000 -Credential $psCred
Get-AzureSubscription
Select-AzureSubscription -SubscriptionId 00000-0000-0000-000-0000
New-AzureRmWebApp -Name $webAppName -ResourceGroupName $ResourceGroupName -Location $Location
Upvotes: 5
Views: 13502
Reputation: 1128
This is just building up @Shui.Sklinar's answer. Below are similar commands in Azure CLI in powershell if anyone is using that.
Get-AzSubscription
# Get all the available subscriptions under your account.Select-AzSubscription -SubscriptionId 00000-0000-0000-000-0000
# Select a particular subscription.Upvotes: 0
Reputation: 19195
Get-AzureSubscription
and Select-AzureSubscription
are ASM cmdlets. I notice that you want to create a ARM webapp. If you have multiple ARM subscriptions, using Select-AzureSubscription
you could not change the default subscription. The cmdlet only change classic subscriptions.
You need use ARM cmdlets.
Get-AzureRmSubscription
Select-AzureRmSubscription -SubscriptionId 00000-0000-0000-000-0000
Upvotes: 11