Azure策略定义未按预期进行评估

tsm1rwdh  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(89)

我正在尝试配置Azure策略,该策略将(目前)针对以下条件审核恢复服务保险库:

  1. softDeleteSettings必须为“已启用”
  2. softDeleteRetentionPeriodInDays必须为14
    对于确实正确设置了这些的保险库,策略仍然评估为不符合。需要一些关于我的语法的指导,因为它显然是不正确的。我已经尝试了两次迭代,都没有产生我想要的结果。

当前尝试

"policyRule": {
      "if": {
        "anyOf": [
          {
            "anyOf": [
              {
                "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteState",
                "notEquals": "Enabled"
              },
              {
                "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteRetentionPeriodInDays",
                "notEquals": 14
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "audit"
      }
    }

字符串

上一次尝试

"policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "equals": "Microsoft.RecoveryServices/vaults"
                    },
                    {
                        "value": "[contains(resourcegroup().tags['exempt'], 'rv01')]",
                        "equals": false
                    },
                    {
                        "anyOf": [
                            {
                                "allOf": [
                                    {
                                        "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings",
                                        "exists": "true"
                                    },
                                    {
                                        "anyOf": [
                                            {
                                                "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteState",
                                                "notEquals": "Enabled"
                                            },
                                            {
                                                "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteRetentionPeriodInDays",
                                                "notEquals": 14
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "audit"
            }
        }

当前错误


的数据

voase2hg

voase2hg1#

在以下情况下对Audit Recovery Services Vault进行审核:

  1. softDeleteSettings必须为“已启用”
  2. softDeleteRetentionPeriodInDays必须为14
    您的策略中存在一些语法问题。这里是更新后的策略,用于检查是否满足这两个条件。它将审核为合规;否则,不合规
{
      "mode": "All",
      "policyRule": {
        "if": {
          "allOf": [
            {
              "field": "type",
              "equals": "Microsoft.RecoveryServices/vaults"
            },
            {
              "not": {
                "field": "tags['exempt']",
                "equals": "rv01"
              }
            },
            {
              "not": {
                "allOf": [
                  {
                    "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteState",
                    "equals": "Enabled"
                  },
                  {
                    "field": "Microsoft.RecoveryServices/vaults/securitySettings.softDeleteSettings.softDeleteRetentionPeriodInDays",
                    "equals": 14
                  }
                ]
              }
            }
          ]
        },
        "then": {
          "effect": "audit"
        }
      },
      "parameters": {}
    }

字符串
如果这两个条件都满足,则策略是兼容的,如下所示。
x1c 0d1x的数据
如果两个条件都不满足,则策略为不符合,如下所示。


合规报告


相关问题