Bylaw

Gallery › Event Hub › Azure built-in policies

Event Hub namespaces should have double encryption enabled

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Enabling double encryption helps protect and safeguard your data to meet your organizational security and compliance commitments. When double encryption has been enabled, data in the storage account is encrypted twice, once at the service level and once at the infrastructure level, using two different encryption algorithms and two different keys.

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

Azure Policy JSONInfrastructureEncryptionEnabled_Audit.json · 54 lines
{
  "properties": {
    "displayName": "Event Hub namespaces should have double encryption enabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Enabling double encryption helps protect and safeguard your data to meet your organizational security and compliance commitments. When double encryption has been enabled, data in the storage account is encrypted twice, once at the service level and once at the infrastructure level, using two different encryption algorithms and two different keys.",
    "metadata": {
      "version": "1.0.0",
      "category": "Event Hub"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the audit policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.EventHub/namespaces"
          },
          {
            "field": "Microsoft.EventHub/namespaces/clusterArmId",
            "exists": "true"
          },
          {
            "field": "Microsoft.EventHub/namespaces/encryption.requireInfrastructureEncryption",
            "notEquals": "true"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/836cd60e-87f3-4e6a-a27c-29d687f01a4c",
  "name": "836cd60e-87f3-4e6a-a27c-29d687f01a4c"
}
Bylaw836cd60e-87f3-4e6a-a27c-29d687f01a4c.bylaw.ps1 · 32 lines
# Converted from InfrastructureEncryptionEnabled_Audit.json by ConvertTo-Bylaw.
Policy '836cd60e-87f3-4e6a-a27c-29d687f01a4c' {

    Properties @{
        DisplayName   = 'Event Hub namespaces should have double encryption enabled'
        Description   = 'Enabling double encryption helps protect and safeguard your data to meet your organizational security and compliance commitments. When double encryption has been enabled, data in the storage account is encrypted twice, once at the service level and once at the infrastructure level, using two different encryption algorithms and two different keys.'
        Version       = '1.0.0'
        Category      = 'Event Hub'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the audit policy'
    }

    Resource 'Microsoft.EventHub/namespaces' {

        When {
            Field clusterArmId | Must -Exist
        }

        Require 'encryption.requireInfrastructureEncryption is true' {
            Field encryption.requireInfrastructureEncryption | Must -Be 'true'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Event Hub/InfrastructureEncryptionEnabled_Audit.json in Azure/azure-policy, under the MIT licence.