Azure Workbooks: Query Azure Subscription Limits

Azure Workbooks are incredibly flexible and dynamic. If this happens to be your first trip to my blog, I am a big fan of using Workbooks to accomplish almost all your data visualization needs, observability of your Azure resources, inventory, even querying cost management and Azure Policy. In this post I’ll show you how to query Azure Resource Management (ARM) to find out subscription limits.

TLDR: Example Workbook here.

Subscription Limits

Despite marketing hype and “elastic cloud scale” there are in fact limits to what you can deploy. Some of these limits are hard caps, and some are soft caps that can be expanded upon request. Either way it may be useful for you to have an easy way to query the API and determine where you are at with your limits. You can see all limits here. However, at this time we can only query Compute and Machine Learning services. You can see the full Quota API docs here.

Workbook Parameters

Like all good Workbooks we have some parameters. We have Subscription, Location and ResourceType parameters.

For Location and ResourceType we’re using drop down with JSON that we fill out ourselves.

Similarly, with ResourceType we fill out a JSON parameter for microsoft.compute and microsoft.machinelearningservices, as our two resource types.

Be sure not to select “allow multiple selections” as the API cannot accept the values that the Workbook would send if you had multiple selected at the same time.

Query ARM

With our parameters set, we’ll do a new widget where we select ARM as our data source. We want a GET HTTP method. Then our path is where we fill in the parameters.

/subscriptions/{Subscription:id}/providers/Microsoft.Capacity/resourceProviders/{ResourceType}/locations/{Location}/serviceLimits?api-version=2020-10-25

This allows us to query different subscriptions and locations for the Quotas in that region.

Under Result Settings, switch the Result Format to JSON Path, and then for the JSON Path Table put $.value. This will make the results much more readable.

Once run you’ll return back a list of Core Types, where “cores” is the total aggregate of all types, and then a breakdown beneath it of each type of core available.

 

Hopefully you find this Workbook useful. And hopefully in the future the Quota API will be opened up to more resource types as Compute and Machine Learning Service aren’t the only resources with Quota Limits.