解决资源配额错误Resolve errors for resource quotas

本文介绍部署资源时可能遇到的配额错误。This article describes quota errors you may encounter when deploying resources.

Note

本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

症状Symptom

如果部署一个创建超过 Azure 配额的资源的模板,则会收到如下所示的部署错误:If you deploy a template that creates resources that exceed your Azure quotas, you get a deployment error that looks like:

Code=OperationNotAllowed
Message=Operation results in exceeding quota limits of Core.
Maximum allowed: 4, Current in use: 4, Additional requested: 2.

或者,可能会看到:Or, you may see:

Code=ResourceQuotaExceeded
Message=Creating the resource of type <resource-type> would exceed the quota of <number>
resources of type <resource-type> per resource group. The current resource count is <number>,
please delete some resources of this type before creating a new one.

原因Cause

按每个资源组、订阅、帐户和其他作用域应用配额。Quotas are applied per resource group, subscriptions, accounts, and other scopes. 例如,订阅可能配置为限制某个区域的核心数目。For example, your subscription may be configured to limit the number of cores for a region. 如果尝试部署超过允许核心数目的虚拟机,则会收到指出超过配额的错误消息。If you attempt to deploy a virtual machine with more cores than the permitted amount, you receive an error stating the quota has been exceeded. 有关完整的配额信息,请参阅 Azure 订阅和服务限制、配额与约束For complete quota information, see Azure subscription and service limits, quotas, and constraints.

故障排除Troubleshooting

Azure CLIAzure CLI

对于 Azure CLI,使用 az vm list-usage 命令查找虚拟机配额。For Azure CLI, use the az vm list-usage command to find virtual machine quotas.

az vm list-usage --location "China East"

返回:Which returns:

[
  {
    "currentValue": 0,
    "limit": 2000,
    "name": {
      "localizedValue": "Availability Sets",
      "value": "availabilitySets"
    }
  },
  ...
]

PowerShellPowerShell

对于 PowerShell,可使用 Get-AzVMUsage 命令查找虚拟机配额 。For PowerShell, use the Get-AzVMUsage command to find virtual machine quotas.

Get-AzVMUsage -Location "China East"

返回:Which returns:

Name                             Current Value Limit  Unit
----                             ------------- -----  ----
Availability Sets                            0  2000 Count
Total Regional Cores                         0   100 Count
Virtual Machines                             0 10000 Count

解决方案Solution

若要请求增加配额,请转到门户并提出支持问题。To request a quota increase, go to the portal and file a support issue. 在支持问题中,为你想要在其中进行部署的区域请求增加配额。In the support issue, request an increase in your quota for the region into which you want to deploy.

Note

请记住,对于资源组,配额针对每个单独的区域,而不是针对整个订阅。Remember that for resource groups, the quota is for each individual region, not for the entire subscription. 如果需要在中国北部部署 30 个核心,则必须在中国北部寻求 30 个 Resource Manager 核心。If you need to deploy 30 cores in China North, you have to ask for 30 Resource Manager cores in China North. 如果需要在有权访问的任何区域内部署总共 30 个核心,则应在所有区域内请求总共 30 个 Resource Manager 核心。If you need to deploy 30 cores in any of the regions to which you have access, you should ask for 30 Resource Manager cores in all regions.

  1. 选择 订阅Select Subscriptions.

    订阅

  2. 选择需要增加配额的订阅。Select the subscription that needs an increased quota.

    选择订阅

  3. 选择“使用情况 + 配额” Select Usage + quotas

    选择使用情况和配额

  4. 在右上角选择“请求增加” 。In the upper right corner, select Request increase.

    请求增加

  5. 在完成“常规信息”和“问题”部分后,请填写你需要增加的配额类型的表单。 Fill in the forms for the type of quota you need to increase after you complete the General information and Problem section.

    填写表单