AzureBicep-如何避免在what-if输出中产生不必要的噪音?
创始人
2024-09-29 13:30:38
0

使用Bicep的isPreview参数来限制what-if输出,只显示实际变更的资源。

示例代码如下:

param location string = 'eastus'
param functionAppName string
param appInsightsName string

resource appServicePlan 'Microsoft.Web/serverfarms@2018-02-01' = {
  name: format('{0}-plan', functionAppName)
  location: location
  sku: {
    name: 'P1V2'
    tier: 'PremiumV2'
  }
  kind: 'functionapp'
  properties: {
    reserved: true
  }
}

resource appService 'Microsoft.Web/sites@2018-02-01' = {
  name: functionAppName
  location: location
  dependsOn: [
    appServicePlan
  ]
  properties: {
    serverFarmId: appServicePlan.id
  }
}

resource appInsights 'Microsoft.Insights/components@2015-05-01' = if(appInsightsName != '') {
  name: appInsightsName
  location: location
  kind: 'web'
  properties: {}
} else {
  name: ''
  url: ''
}

output appServiceId string = appService.id
output appInsightsId string = appInsights.id

如果这个模板被用于部署新的资源,可以设置isPreview参数为false,以获得详细和准确的what-if输出:

az deployment sub create -n  --template-file  --parameters functionAppName= appInsightsName= --location eastus --mode Complete --isPreview false

如果该模板被用于更新现有资源,则应该将isPreview参数设置为true,以排除不必要的噪音:

az deployment sub create -n  --template-file  --parameters functionAppName= appInsightsName= --location eastus --mode Incremental --isPreview true

相关内容

热门资讯

wepokeai机器人!wpk... wepokeai机器人!wpk机制(透视)原来是真的有挂(详细辅助安装教程);无聊就玩这款wepok...
透视ai代打!hhpoker透... 透视ai代打!hhpoker透视脚本安卓,wepoker模拟器哪个(详细辅助AA德州教程);1、每一...
aapoker有挂!wpkpl... aapoker有挂!wpkplus有辅助器吗(透视)原先是真的有挂(详细辅助科技教程)是一款可以让一...
透视教学!wepoker辅助器... 透视教学!wepoker辅助器是真的的吗,pokemmo脚本辅助器(详细辅助可靠技巧);1、金币登录...
aapoker辅助!德州全自动... aapoker辅助!德州全自动辅助(透视)真是真的是有挂(详细辅助解密教程)1.aapoker辅助 ...
透视攻略!hhpoker透视脚... 透视攻略!hhpoker透视脚本,hhpoker作弊码(详细辅助德州论坛)1、该软件可以轻松地帮助玩...
德州ai机器人!wpk ai机... 德州ai机器人!wpk ai机器人和真的的区别(透视)一直是有挂(详细辅助2025新版)德州ai机器...
透视黑科技!wepoker辅助... 透视黑科技!wepoker辅助工具,wepoker私人局辅助器怎么用(详细辅助详细教程);1、下载好...
aapoker有外挂!wepo... aapoker有外挂!wepoke辅助技巧(透视)原生是有挂(详细辅助软件教程)您好,wepoke辅...
透视规律!wepoker透视脚... 透视规律!wepoker透视脚本网页,wepoker俱乐部辅助(详细辅助微扑克教程)1、很好的工具软...