解决 SKU 不可用的错误Resolve errors for SKU not available

本文介绍如何解决 SkuNotAvailable 错误 。This article describes how to resolve the SkuNotAvailable error. 如果在该区域或满足业务需求的备用区域中找不到合适的 SKU,请将 SKU 请求提交到 Azure 支持。If you're unable to find a suitable SKU in that region or an alternative region that meets your business needs, submit a SKU request to Azure Support.

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

在部署资源(通常为虚拟机)时,收到以下错误代码和错误消息:When deploying a resource (typically a virtual machine), you receive the following error code and error message:

Code: SkuNotAvailable
Message: The requested tier for resource '<resource>' is currently not available in location '<location>'
for subscription '<subscriptionID>'. Please try another tier or deploy to a different location.

原因Cause

当所选的资源 SKU(如 VM 大小)不可用于所选的位置时,会收到此错误。You receive this error when the resource SKU you've selected (such as VM size) isn't available for the location you've selected.

解决方案 1 - PowerShellSolution 1 - PowerShell

要确定区域中可用的 SKU,请使用 Get-AzComputeResourceSku 命令。To determine which SKUs are available in a region, use the Get-AzComputeResourceSku command. 按位置筛选结果。Filter the results by location. 必须拥有最新版本 PowerShell 才能运行此命令。You must have the latest version of PowerShell for this command.

Get-AzComputeResourceSku | where {$_.Locations -icontains "chinaeast"}

结果包括位置的 SKU 列表以及针对该 SKU 的任何限制。The results include a list of SKUs for the location and any restrictions for that SKU. 请注意,SKU 可能被列为 NotAvailableForSubscriptionNotice that a SKU might be listed as NotAvailableForSubscription.

ResourceType          Name           Locations   Zone      Restriction                      Capability           Value
------------          ----           ---------   ----      -----------                      ----------           -----
virtualMachines       Standard_A0    chinaeast             NotAvailableForSubscription      MaxResourceVolumeMB   20480
virtualMachines       Standard_A1    chinaeast             NotAvailableForSubscription      MaxResourceVolumeMB   71680
virtualMachines       Standard_A2    chinaeast             NotAvailableForSubscription      MaxResourceVolumeMB  138240

一些其他示例:Some additional samples:

Get-AzComputeResourceSku | where {$_.Locations.Contains("chinaeast") -and $_.ResourceType.Contains("virtualMachines") -and $_.Name.Contains("Standard_DS14_v2")}
Get-AzComputeResourceSku | where {$_.Locations.Contains("chinaeast") -and $_.ResourceType.Contains("virtualMachines") -and $_.Name.Contains("v3")} | fc

在末尾追加“fc”会返回更多详细信息。Appending "fc" at the end returns more details.

解决方案 2 - Azure CLISolution 2 - Azure CLI

要确定区域中可用的 SKU,请使用 az vm list-skus 命令。To determine which SKUs are available in a region, use the az vm list-skus command. 使用 --location 参数将输出筛选到正在使用的位置。Use the --location parameter to filter output to location you are using. 使用 --size 参数按部分大小名称搜索。Use the --size parameter to search by a partial size name.

az vm list-skus --location chinaeast --size Standard_F --output table

该命令将返回类似下面的结果:The command returns results like:

ResourceType     Locations       Name              Zones    Capabilities    Restrictions
---------------  --------------  ----------------  -------  --------------  --------------
virtualMachines  chinaeast  Standard_F1                ...             None
virtualMachines  chinaeast  Standard_F2                ...             None
virtualMachines  chinaeast  Standard_F4                ...             None
...

解决方案 3 - Azure 门户Solution 3 - Azure portal

要确定区域中可用的 SKU,请使用门户To determine which SKUs are available in a region, use the portal. 登录到门户,并通过接口添加资源。Sign in to the portal, and add a resource through the interface. 设置值时,可看到该资源的可用 SKU。As you set the values, you see the available SKUs for that resource. 不需要完成部署。You don't need to complete the deployment.

例如,开始创建虚拟机的过程。For example, start the process of creating a virtual machine. 若要查看其他可用的大小,请选择“更改大小” 。To see other available size, select Change size.

创建 VM

可以筛选和滚动到可用的大小。You can filter and scroll through the available sizes.

可用的 SKU

解决方案 4 - RESTSolution 4 - REST

要确定区域中可用的 SKU,请使用资源 Sku - 列表操作。To determine which SKUs are available in a region, use the Resource Skus - List operation.

它会以下列格式返回可用 SKU 和区域:It returns available SKUs and regions in the following format:

{
  "value": [
    {
      "resourceType": "virtualMachines",
      "name": "Standard_A0",
      "tier": "Standard",
      "size": "A0",
      "locations": [
        "chinaeast"
      ],
      "restrictions": []
    },
    {
      "resourceType": "virtualMachines",
      "name": "Standard_A1",
      "tier": "Standard",
      "size": "A1",
      "locations": [
        "chinaeast"
      ],
      "restrictions": []
    },
    ...
  ]
}