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

相关内容

热门资讯

9分钟安装!微乐小程序免费黑科... 9分钟安装!微乐小程序免费黑科技,微乐小程序免费黑科技下载方法(开挂)好像有挂(2026)微乐小程序...
透视挂!微乐小程序黑科技,微乐... 透视挂!微乐小程序黑科技,微乐小程序黑科技辅助工具2026最新推荐(透视)切实是有挂(哔哩哔哩)1)...
第8分钟辅助!微乐小程序黑科技... 第8分钟辅助!微乐小程序黑科技,陕西微乐挖坑控制器(开挂)果然真的有挂(2026)一、微乐小程序黑科...
辅助透视!微乐小程序免费黑科技... 辅助透视!微乐小程序免费黑科技,陕西微乐小程序攻略(透视)确实真的是有挂(哔哩哔哩)1、微乐小程序免...
第9分钟下载!微乐小程序黑科技... 第9分钟下载!微乐小程序黑科技,微乐小程序黑科技辅助工具2026最新推荐(开挂)一直是有挂(2026...
透视安装!微乐小程序免费黑科技... 透视安装!微乐小程序免费黑科技,微乐智能插件激活码(透视)切实有挂(哔哩哔哩)1)微乐小程序免费黑科...
第九分钟工具!微乐小程序黑科技... 第九分钟工具!微乐小程序黑科技,微信小程序微乐安徽辅助器(开挂)其实是有挂(2026)1、这是跨平台...
2026版规律!微乐小程序免费... 2026版规律!微乐小程序免费黑科技,小程序跑得快的技巧(透视)好像是有挂(哔哩哔哩)在进入微乐小程...
第7分钟透视!微乐小程序黑科技... 您好,微乐小程序黑科技这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054】很多玩...
无独有偶!微乐小程序黑科技,微... 无独有偶!微乐小程序黑科技,微信小程序辅助器免费版(透视)果然真的有挂(哔哩哔哩)1、金币登录送、破...