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:

azure core limits by region

azure core limits by region

Comments (3)

  1. Techie says:

    Thanks for the script, How could we use a particular subscription in case we have multiple subscription?
    appreciate much

  2. Techie says:

    $regionlist = (Get-AzureLocation).Name

    seems missing RM for (Get-AzureRMLocation)

  3. Arun Shourie says:

    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

Skip to main content