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

如何排除BlobStorage类型存储账户下的Table Service适配Azure诊断策略?

解决方案:排除BlobStorage类型存储账户下的Table Service

你的写法不可行,问题出在直接引用kind字段会读取Table Service自身的属性,而它并没有这个属性,同时你用的parent字段也是不存在的。要排除父存储账户为BlobStorage类型的Table Service,需要通过Azure Policy的跨资源字段引用来获取父存储账户的kind属性。

正确的策略规则结构如下:

"policyRule": {
  "if": {
    "allOf": [
      {
        "field": "type",
        "equals": "Microsoft.Storage/storageAccounts/tableservices"
      },
      {
        "not": {
          "field": "Microsoft.Storage/storageAccounts/kind",
          "equals": "BlobStorage"
        }
      }
    ]
  },
  "then": {
    // 保留原策略中的合规动作(如deployIfNotExists等逻辑)
  }
}

关键说明:

  • Microsoft.Storage/storageAccounts/kind这个字段路径会自动关联到当前Table Service所属的父存储账户,读取它的类型属性
  • 通过not条件排除掉所有kind为BlobStorage的存储账户下的Table Service,这样策略就不会对这类资源执行,自然避免了OperationNotAllowedOnKind错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 21:05:56