You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure ML Compute配额无法在门户查看,如何通过SDK/CLI/REST API查询?

Querying Azure Machine Learning Compute Quotas via SDK, CLI, or REST API

Absolutely! Even though Azure Machine Learning Compute quotas aren’t visible in the Azure portal (depending on your subscription type), you can easily retrieve current quota values using the Azure CLI, Python SDK, or REST API. Here’s how to do it with each tool:

Using Azure CLI

First, ensure you have the Azure ML CLI extension installed (run az extension add -n ml if you haven’t already). Then execute this command, replacing the placeholders with your resource group and workspace name:

az ml compute list-usage --resource-group <your-resource-group> --workspace-name <your-workspace-name>

This returns a JSON output with details like quota category, current usage, limit, and unit for each compute type.

Using Python SDK

With the Azure Machine Learning Python SDK v2, use the MLClient to fetch quota information. Here’s a practical example:

from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

# Initialize MLClient with your workspace details
ml_client = MLClient(
    credential=DefaultAzureCredential(),
    subscription_id="<your-subscription-id>",
    resource_group_name="<your-resource-group>",
    workspace_name="<your-workspace-name>"
)

# Fetch and display compute quota data
usage_list = ml_client.compute.list_usage()
for usage in usage_list:
    print(f"Compute type: {usage.name.value}")
    print(f"Current usage: {usage.current_value}")
    print(f"Quota limit: {usage.limit}")
    print(f"Unit: {usage.unit}\n")

This loops through each quota category and prints your current usage alongside the assigned limit.

Using REST API

You can also call the Azure ML REST API directly. Send a GET request to the following endpoint, replacing placeholders with your own values:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/usages?api-version=2024-04-01

Authenticate using an Azure AD access token (you can get one via az account get-access-token). The response will be a JSON object with full quota usage details for your workspace.

内容的提问来源于stack exchange,提问作者Vassily L.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:45:47