0

Microsoft Azure subscriptions are subject to a variety of quotas and limits, for example number of total CPU cores and number of VMs of a certain family.

How can I query the current quotas and actual usage, in a way that allows me to make forecasts and create alerts before I hit the quotas?

1 Answer 1

0

Some of this information is available in Azure Monitor, particularly Azure Resource Graph for VMs.

A query like this should work:

QuotaResources
| where type =~ "microsoft.compute/locations/usages"
| mv-expand json = properties.value limit 400 
| extend usagevCPUs = json.currentValue, QuotaLimit = json['limit'], quotaName = tostring(json['name'].localizedValue)
| where usagevCPUs > 0
| extend usagePercent = toint(usagevCPUs)*100 / toint(QuotaLimit)
| project subscriptionId,quotaName,usagevCPUs,QuotaLimit,usagePercent,location,json
| order by ['usagePercent'] desc

You can for example use it in Grafana with the Azure Monitor datasource, which can be used both for visualisations and for Grafana alerts.

Grafana panel with Azure Monitor datasource query

1
  • Query provided by a colleague of mine. :)
    – Nemo
    Commented Apr 5 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .