Bylaw

Gallery › Service Bus › Azure built-in policies

Service Bus 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": "Service Bus 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": "Service Bus"
    },
    "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.ServiceBus/namespaces"
          },
          {
            "field": "Microsoft.ServiceBus/namespaces/sku.tier",
            "equals": "Premium"
          },
          {
            "field": "Microsoft.ServiceBus/namespaces/encryption.requireInfrastructureEncryption",
            "notEquals": "true"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/ebaf4f25-a4e8-415f-86a8-42d9155bef0b",
  "name": "ebaf4f25-a4e8-415f-86a8-42d9155bef0b"
}
Bylawebaf4f25-a4e8-415f-86a8-42d9155bef0b.bylaw.ps1 · 32 lines
# Converted from InfrastructureEncryptionEnabled_Audit.json by ConvertTo-Bylaw.
Policy 'ebaf4f25-a4e8-415f-86a8-42d9155bef0b' {

    Properties @{
        DisplayName   = 'Service Bus 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      = 'Service Bus'
        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.ServiceBus/namespaces' {

        When {
            Field sku.tier | Must -Be 'Premium'
        }

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

    Effect (Param Effect)
}

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