Fetching your Azure core count limit for each region using PowerShell (ARM)
With the move to Azure Resource Manager, it looks like the core-count limits are now per-region-per-subscription instead of just per-subscription. How do you find out what your limits are?
I was asked that question, so threw together this PowerShell script to give us the answer:
Add-AzureRmAccount
$regionlist = (Get-AzureLocation).Name
$limits = foreach ($region in $regionlist) {
Get-AzureRmVmUsage –Location $region | where {$_.Name.LocalizedValue -eq “Total Regional Cores”} | Select @{label="Region";Expression ={$region}}, CurrentValue, Limit
}
$limits | Format-Table -AutoSize
This will return a table showing each region, the currently used core count (CurrentValue) and the corresponding core limits (Limit), like this:
[caption id="attachment_1105" align="alignnone" width="320"] azure core limits by region[/caption]
Comments
- Anonymous
July 20, 2017
Thanks for the script, How could we use a particular subscription in case we have multiple subscription?appreciate much - Anonymous
July 24, 2017
$regionlist = (Get-AzureLocation).Name seems missing RM for (Get-AzureRMLocation) - Anonymous
November 27, 2017
The post was helpful. Looks Get-AzureLocation was deprecated or just not working for me. So slightly modified the snippet to work with new Get-AzureRMLocation and added another loop to get information from multiple subscriptions. Also for selected regions, since we would only need data from datacenters we use.$SubscrList = Get-AzureRmSubscription$regionlist = (Get-AzureRMLocation).Location |?{$_ -eq "northeurope" -or $_ -eq "eastasia" -or $_ -eq "eastus"}$limits = foreach ($Subscription in $SubscrList) { $SSubscription = Select-AzureRmSubscription -SubscriptionName $Subscription.Name foreach ($region in $regionlist) { Get-AzureRmVmUsage –Location $region| where {$_.Name.LocalizedValue -eq “Total Regional vCPUs”} | Select @{label = "Subscription"; Expression = {$SSubscription.Subscription.Name}},@{label="Region";Expression ={$region}}, CurrentValue, Limit } }$limits | Format-Table -AutoSize