Bicep部署Windows App Service Plan失败,始终生成Linux实例求助
问题原因及解决方法
问题核心出在properties.reserved属性的设置上:
- 在Azure App Service Plan的配置逻辑里,
reserved: true是Linux环境专属的强制标识——只要这个值设为true,哪怕你把kind指定为windows,Azure也会自动创建Linux类型的App Service Plan。 - 对于Windows类型的App Service Plan,你需要将
reserved设为false,或者直接删除这个属性(因为Windows环境的reserved默认值就是false)。
修改后的BICEP代码
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { name: appServicePlanName location: location kind: 'windows' tags: tagValues properties: { reserved: false // 改为false,或直接删除该属性 } sku: { name: sku tier: skucode } }
补充说明
kind字段仅用于标识资源的通用类型,但reserved属性才是区分Linux/Windows App Service Plan的核心配置项,优先级更高。- 你使用的P1V2(PremiumV2)SKU同时支持Windows和Linux环境,所以SKU配置本身没有问题,只需修正
reserved的取值即可。
内容的提问来源于stack exchange,提问作者Stephen Rushton
相关产品推荐
相关产品推荐

