Azure Quota Service API
The Azure Quota Service REST API is designed for viewing and managing quotas for Azure resource providers.
Important
Azure Quota Service API is Generally Available
A new Azure Quota API version is generally available. This API uses Microsoft.Quota Resource Provider, supports Azure virtual machines (cores/vCPU), Azure Machine Learning (dedicated/vCPUs), Networking, Azure HPC Cache, Storage and Azure Purview services.
A quota is the service limit or allowance set on a resource in your Azure subscription. Each Azure service defines its quotas and determines its default values. For more information on the most common Microsoft Azure quotas, see Azure subscription and service limits, quotas, and constraints.
Using Quota APIs
With Quota API you can:
- Get the current quotas and usages of a resource.
- Get a list of current quotas and usages of all the resources.
- Create or update quotas of a resource.
- Get the status of quota requests for a resource.
- Get the list of all quota requests of a resource for one year
Quota API PUT call and scope
The Quota API PUT request includes a "scope" parameter that can be customized to align with the requirements of resource providers seeking a quota increase, ensuring the API call remains uniform.
https://management.azure.com/<scope>/Microsoft.Quota/quotas/<resourceName>?api-version=2021-03-15-preview
Resource Provider | Scope |
---|---|
Microsoft.Compute | subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{azure location} |
Microsoft.HDInsight | subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{azure location} |
Microsoft.MachineLearningService | subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningService/locations/{azure location} |
Microsoft.Network | subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{azure location} |
Microsoft.Purview | subscriptions/{subscriptionId}/providers/Microsoft.Purview/locations/{azure location} |
Note: Example of PUT call for compute can be found here.
Prerequisites
Important
Before you can use Quota API, you must:
- Register the Microsoft.Quota resource provider for all your subscriptions using PowerShell.
- Assign the Quota Request Operator role to all user accounts and applications that will perform quota operations.
Registering the Microsoft Quota resource provider
To register the Microsoft Quota resource provider, use the below PowerShell command:
Register-AzResourceProvider -ProviderNamespace Microsoft.Quota
It returns results similar to the below output:
ProviderNamespace : Microsoft.Quota
RegistrationState : Registering
ResourceTypes : {usages, quotas, quotaRequests, operationsStatus...}
Locations : {West Europe, East US, South Central US...}
Once the Microsoft.Quota resource provider is registered, the RegistrationState
will be set to Registered
. For more information on managing Azure resource providers, see Azure resource providers.
Throttling
Every subscription-level and tenant-level API calls can be throttled if you send too many API requests. If your API call is throttled, you'll get an error message stating that the server rejected the API request. You can retry the API call after some time has elapsed.
For details on API throttling, how to troubleshoot throttling issues, and how to avoid being throttled, see Troubleshooting throttling errors in Azure.
Quota Request Operator Role
The Quota Request Operator is an Azure built-in role customized for quota operations. It grants permissions to read and create quota requests, get quota request status, and create support tickets. Assign this role to users, groups, service principals, managed identities, and applications that do quota operations. For reference, the Quota Request Operator role ID is 0e5f05e5-9ab9-446b-b98d-1e2157c94125.
The Quota Request Operator role is extended to include Quota Resource Provider Permissions.
Quota APIs best practices
Monitoring quota utiliztion: Utilize the Azure quota API to track your quota usage effectively. This API provides real-time information on your current usage and the available quota for a specific combination of subscription, VM family, and region. It's crucial to regularly check your quota utilization before considering any quota increase.
Requesting quota increase: Should your quota utilization exceed the predefined target, initiate a quota increase request using the Azure quota API to bring your utilization back in line with your goals. The process is straightforward - simply submit an API request that outlines the desired quota increase. For example, if the target utilization for the Dv2 VM family quota in Europe North, under "subscription1," is set at 80%, and your Azure quota API monitoring indicates an actual utilization of 85%, submit a quota increase of 10% to 20%.
Tip
It is advisable to request a quota increase of 10% to 20% of the resource utlization as it provides a resonalble buffer for unexpected spikes in resource usage, ensuring that you won't immediately hit your new quota limit after an increase . This approach minimizes the need for frequent API calls to request additional quota, improving your chances of approval.
- Quota increase respnose: Upon submitting a quota increase request, you will receive a response indicating whether your request has been approved or rejected. In the event of rejection, you can initiate a follow-up by logging a support request using the Azure Support REST API or using new support request in the Azure portal, including the specifics of the denied quota increase request and the reason for your inquiry.
Troubleshooting Quota API errors
Use the following tables to troubleshoot errors you might get while using Quota API.
Error code | How to solve it |
---|---|
ContactSupport | Open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas). You can also open it programmatically using the Azure Support REST API. |
InternalServerError | Internal server error. Retry the API call later. |
MissingRegistration | Register the Microsoft.Quota resource provider for each of your subscriptions. For troubleshooting guidance, see Resolve errors for resource provider registration. |
QuotaNotAvailableForResource | Quota is currently unavailable in the location for the requested resource. Open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas). You can also open it programmatically using the Azure Support REST API. |
QuotaReductionNotSupported | The current quota limit is higher than the requested quota or the current usage is higher than the requested quota. Reducing quotas is not supported. The quota cannot be reduced. |
RequestThrottled | Every subscription-level and tenant-level API requests may be throttled to help with the overall performance of the service. The number of requests exceeded the maximum allowed API request rate. Try again later. |
ResourceNotAvailableForOffer | The resource is currently unavailable in the location for the offer type. For the list of current and retired offers, see the Microsoft Azure Offer Details page. To change your offer type, see the Change your Azure subscription to a different offer page. You can also open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas). You can also open it programmatically using the Azure Support REST API. |
ResourceNotAvailableForSubscription | The resource is currently unavailable in the location for the requested subscription. Open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas). You can also open it programmatically using the Azure Support REST API. |
UnableToIncreaseQuota | Unable to increase quotas for the requested subscriptions. Open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas). |
MFA required | Quota requests needs Multi-Factor Authentication. Please enable Multi-Factor Authentication for your tenant/account by following the instructions at enable MFA and try again |
RequestPartiallyFulfilled | Quota request is partially fulfilled. For any questions, open a new support request in the Azure portal. Under Select an issue type, choose Service and subscription limits (quotas) |
Support in other languages and interfaces
The Quota REST API is available in the following language-specific Microsoft Azure SDKs:
- Microsoft Azure SDK for .NET: NuGet package
- Microsoft Azure SDK for Java: Java package
- Microsoft Azure SDK for Python: Py package
- Microsoft Azure SDK for JavaScript (NodeJS & Browser): JavaScript package
- Microsoft Azure SDK for Go: Go package
- Microsoft Azure CLI extensions: Cli package
Using Azure portal and Support API to manage quotas
Azure enables you to create and manage support requests, also known as support tickets. You can: