如何通过编程方式检测Azure应用服务计划是否支持P1V3层级
Azure应用服务计划P1V3升级支持性批量查询方案
核心结论
你可以通过Azure CLI或Az PowerShell模块批量拉取指定区域内不支持P1V3层级的应用服务计划列表,具体操作方法如下。
前置说明
所有待排查的应用服务计划均位于az appservice list-locations --sku P1V3命令返回的支持P1V3 SKU的区域范围内,排查逻辑为:先筛选出上述区域内的所有应用服务计划,再校验每个计划的支持能力属性,过滤出不包含P1V3支持项的计划。
Azure CLI 查询方法
步骤1:提取P1V3支持的区域列表
supported_regions=$(az appservice list-locations --sku P1V3 --query "[].name" -o tsv)
步骤2:输出不支持P1V3的服务计划列表
for region in $supported_regions; do az appservice plan list \ --query "[?location=='$region' && !contains(supportedCapabilities[].name, 'P1V3')].{服务计划名称:name, 资源组:resourceGroup, 区域:location, 当前层级:sku.tier}" \ -o table done
Az PowerShell 查询方法
步骤1:提取P1V3支持的区域列表
$supportedRegions = (Get-AzAppServiceLocation -Sku P1V3).Name
步骤2:输出不支持P1V3的服务计划列表
$unsupportedPlans = foreach ($region in $supportedRegions) { Get-AzAppServicePlan -Location $region | Where-Object { -not ($_.SupportedCapabilities.Name -contains "P1V3") } | Select-Object @{Name='服务计划名称';Expression={$_.Name}}, @{Name='资源组';Expression={$_.ResourceGroupName}}, @{Name='区域';Expression={$_.Location}}, @{Name='当前层级';Expression={$_.Sku.Tier}} } $unsupportedPlans | Format-Table -AutoSize
补充说明
查询到的不支持P1V3的服务计划多为创建时间较早的旧版资源,你可以将计划内的应用迁移到同区域新建的支持P1V3的服务计划中完成升级。
内容的提问来源于stack exchange,提问作者Alexey Auslender
相关产品推荐
相关产品推荐

