Bylaw

Gallery › Resilience › Azure built-in policies

[Preview]: Azure Data Explorer Clusters should be Zone Redundant

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0-preview Preview

Azure Data Explorer Clusters can be configured to be Zone Redundant or not. An Azure Data Explorer Cluster is considered Zone Redundant if it has at least two entries in its zones array. This policy helps ensure the your Azure Data Explorer Clusters are Zone Redundant.

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONKusto_clusters_ZoneRedundant_Audit.json · 53 lines
{
  "properties": {
    "displayName": "[Preview]: Azure Data Explorer Clusters should be Zone Redundant",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Azure Data Explorer Clusters can be configured to be Zone Redundant or not. An Azure Data Explorer Cluster is considered Zone Redundant if it has at least two entries in its zones array. This policy helps ensure the your Azure Data Explorer Clusters are Zone Redundant.",
    "metadata": {
      "category": "Resilience",
      "version": "1.0.0-preview",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "This parameter lets you choose the effect of the policy. If you choose Audit (default), the policy will only audit resources for compliance. If you choose Deny, the policy will deny the creation of non-compliant resources. If you choose Disabled, the policy will not enforce compliance (useful, for example, as a second assignment to ignore a subset of non-compliant resources in a single resource group)."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "equals": "Microsoft.Kusto/clusters",
            "field": "type"
          },
          {
            "count": {
              "field": "Microsoft.Kusto/clusters/zones[*]"
            },
            "less": 2
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/cbe58ab0-07a8-43ea-9ccc-8ea33e4d6aa5",
  "name": "cbe58ab0-07a8-43ea-9ccc-8ea33e4d6aa5"
}
Bylawcbe58ab0-07a8-43ea-9ccc-8ea33e4d6aa5.bylaw.ps1 · 29 lines
# Converted from Kusto_clusters_ZoneRedundant_Audit.json by ConvertTo-Bylaw.
Policy 'cbe58ab0-07a8-43ea-9ccc-8ea33e4d6aa5' {

    Properties @{
        DisplayName   = '[Preview]: Azure Data Explorer Clusters should be Zone Redundant'
        Description   = 'Azure Data Explorer Clusters can be configured to be Zone Redundant or not. An Azure Data Explorer Cluster is considered Zone Redundant if it has at least two entries in its zones array. This policy helps ensure the your Azure Data Explorer Clusters are Zone Redundant.'
        Category      = 'Resilience'
        Version       = '1.0.0-preview'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'This parameter lets you choose the effect of the policy. If you choose Audit (default), the policy will only audit resources for compliance. If you choose Deny, the policy will deny the creation of non-compliant resources. If you choose Disabled, the policy will not enforce compliance (useful, for example, as a second assignment to ignore a subset of non-compliant resources in a single resource group).'
    }

    Resource 'Microsoft.Kusto/clusters' {

        Require 'zones is as required' {
            Count 'zones[*]' | Must -BeGreaterOrEqual 2
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Resilience/Kusto_clusters_ZoneRedundant_Audit.json in Azure/azure-policy, under the MIT licence.