Search code examples
azureazure-cliazure-machine-learning-service

Is there a way to access compute quotas with the Azure CLI or Python SDK?


I want to tabulate the compute quotas for each Azure ML workspace, in each Azure location, for my organization's Azure subscription. Although it is possible to look at the quotas manually through the Azure Portal (link), I have not found a way to do this with the Azure CLI or Python SDK for Azure. Since there are many resource groups and AML workspaces for different teams under my Azure subscription, it would be much more efficient to do this programmatically rather than manually through the portal. Is this even possible, and if so how can it be done?


Solution

  • It does look like these commands are currently in the CLI or the Python SDK. The CLI uses the Python SDK, so what's missing from one does tend to be missing from the other.

    Fortunately, you can invoke the rest endpoints directly, either in Python or by using the az rest command in the CLI.

    There are a few commands that may interest you:

    Usage and Quotas for a region: /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages?api-version=2019-05-01 /subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas?api-version=2020-04-01

    The process for updating REST specs to the offical documentation is fairly lengthy so it isn't published yet, but if you are willing to use Swagger docs to explore what is available, the 2020-06-01 version of the API is on Github, which includes endpoints for updating quotas as well as retrieving them: https://github.com/Azure/azure-rest-api-specs/tree/master/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2020-06-01