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

PowerShell配置带区域冗余的New-AzAppServicePlan失败,求解决方法

解决PowerShell部署区域冗余应用服务计划的问题

问题根源与修正步骤

首先你的脚本存在语法错误,同时对PowerShell参数的使用有误解,以下是具体解决方法:

1. 修正脚本中的语法错误

你写的--Tier "PremiumV3"多了一个减号,PowerShell参数只需要单个减号,正确写法是-Tier "PremiumV3",这个错误会直接导致命令执行失败。

2. 正确使用区域冗余参数

Azure PowerShell的New-AzAppServicePlan没有-Zone参数(该参数属于Azure CLI),实现区域冗余只需要设置-ZoneRedundant $true即可,Azure会自动在目标区域的可用区中分配实例。

3. 确保Az.Websites模块版本达标

旧版本的Az.Websites模块可能不支持-ZoneRedundant参数,建议先更新到最新版本:

Update-Module -Name Az.Websites -Force -AllowClobber

修正后的完整脚本

##Part 1 - Create a new Linux App Service Plan

# 建议资源组和服务计划名称不要以减号开头,避免潜在解析问题
$ResourceGroupName = "sandbox-ASE"
$ServicePlanName = "service-plan01"
$location = "southafricanorth"

# 更新模块到最新版本
Update-Module -Name Az.Websites -Force -AllowClobber

New-AzAppServicePlan `
-ResourceGroupName $ResourceGroupName `
-Name $ServicePlanName `
-Location $location `
-Tier "PremiumV3" `
-NumberofWorkers 1 `
-WorkerSize "Small" `
-Linux `
-ZoneRedundant $true

额外注意事项

  • 确认目标区域(southafricanorth)支持Premium V3层级的区域冗余(该区域是支持的)
  • 区域冗余仅适用于Premium V3及以上层级的应用服务计划,你的Tier选择符合要求

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.04 06:32:51