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

如何获取Azure中App Service Plan的正确引用用于CLI创建Web App?

如何获取Azure App Service Plan的正确引用以用于az webapp create命令?

当使用az webapp create指定已有App Service Plan时命令失败,通常是因为传入的计划引用格式不正确。以下是获取正确引用的具体方法:

  • 先确认计划的归属资源组
    用Azure CLI列出所有App Service Plan,定位目标计划的资源组和详细信息:

    az appservice plan list --output table
    

    该命令会输出计划的名称、所属资源组、位置、SKU等信息,重点记录目标计划对应的资源组名称。

  • 根据资源组匹配情况选择引用方式

    1. 计划与Web App在同一资源组:直接使用计划的完整名称即可(注意空格、特殊字符需完全匹配,Azure CLI对输入字符严格校验)。
      修正后的命令示例:
      az webapp create --resource-group my-group `
                       --name app-lication `
                       --plan "Enterprise MSDN Dev Test"
      
    2. 计划与Web App不在同一资源组:必须使用计划的完整资源ID。可通过以下命令直接获取目标计划的资源ID:
      az appservice plan show --name "Enterprise MSDN Dev Test" --resource-group <计划所在资源组名称> --query id --output tsv
      
      将输出的资源ID替换到--plan参数中,命令示例:
      az webapp create --resource-group my-group `
                       --name app-lication `
                       --plan "/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/plan-resource-group/providers/Microsoft.Web/serverfarms/Enterprise MSDN Dev Test"
      

内容的提问来源于stack exchange,提问作者Konrad Viltersten

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 02:50:14