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

如何正确创建Bicep governanceRules模板?部署遇BadRequest问题

使用Bicep创建Azure Governance Rule的问题及后续

问题描述

  • 尝试通过Bicep创建Microsoft.Security/governanceRules资源,参考官方模板文档编写了仅包含必填属性的硬编码最简模板,但无论如何调整,请求始终返回(Code:BadRequest)错误,且无具体错误原因,只能反复试错。
  • 对conditionSets配置部分尤为困惑:文档中提及“governance rule的conditionSets - 查看示例”,但未找到任何相关示例。目前仅能通过ChatGPT生成如下示例模板,无法确认其有效性,希望获取更多可辅助正确配置的文档资源。

ChatGPT生成的示例Bicep模板

resource governanceRule 'Microsoft.Security/governanceRules@2022-01-01-preview' = {
  name: 'sampleRuleName'
  properties: {
    displayName: 'Sample Governance Rule'
    description: 'This is a sample governance rule for demonstration purposes.'
    ownerSource: {
      type: 'Manually'
    }
    rulePriority: 1
    ruleType: 'Integrated'
    sourceResourceType: 'Assessments'
    conditionSets: [
      {
        query: 'type eq "Microsoft.Security/complianceResults" and properties.state eq "NonCompliant"'
      }
    ]
  }
}

后续跟进

  • 使用他人提供的链接获取了有用信息,已确认能编写有效的模板,但部署仍失败,目前已确定问题出在微软端。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 10:52:42