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

如何正确向az appservice plan update的--add参数传递键值对?

Azure CLI中az appservice plan update的--add参数使用问题

问题场景

尝试执行以下命令更新App Service计划的perSiteScaling设置:

az appservice plan update --id $plan --add "perSiteScaling=true"

错误信息

执行后抛出错误:

ERROR: Couldn't find 'perSiteScaling=true' in ''. Available options: ['elasticScaleEnabled', 'extendedLocation', 'freeOfferExpirationTime', 'geoRegion', 'hostingEnvironmentProfile', 'hyperV', 'id', 'isSpot', 'isXenon', 'kind', 'kubeEnvironmentProfile', 'location', 'maximumElasticWorkerCount', 'maximumNumberOfWorkers', 'name', 'numberOfSites', 'numberOfWorkers', 'perSiteScaling', 'provisioningState', 'reserved', 'resourceGroup', 'sku', 'spotExpirationTime', 'status', 'subscription', 'tags', 'targetWorkerCount', 'targetWorkerSizeId', 'type', 'workerTierName', 'zoneRedundant']

问题原因与解决方案

根据Azure CLI对--add参数的定义:

通过指定路径和键值对向对象列表中添加对象。示例:--add property.listProperty <键=值、字符串或JSON字符串>

perSiteScaling是App Service计划的单个布尔属性,并非列表类型的对象集合,因此不应该使用--add参数,而是要用--set参数来修改现有属性值。

正确的命令如下:

az appservice plan update --id $plan --set perSiteScaling=true

额外说明

如果需要操作列表类型的属性(比如tags),才适合用--add,格式示例:

az appservice plan update --id $plan --add tags.environment=production

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.31 17:10:26