Bylaw

Gallery › Mission › Azure built-in policies

Service Bus Premium namespaces should use a customer-managed key for encryption in mission platforms

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Requiring premium namespaces to encrypt with customer-managed keys keeps encryption-material control within the mission tenant and satisfies strict data-protection obligations.

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

Azure Policy JSONServiceBusEncryptWithCMK_Audit.json · 56 lines
{
  "properties": {
    "displayName": "Service Bus Premium namespaces should use a customer-managed key for encryption in mission platforms",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Requiring premium namespaces to encrypt with customer-managed keys keeps encryption-material control within the mission tenant and satisfies strict data-protection obligations.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled",
          "Deny"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ServiceBus/namespaces"
          },
          {
            "field": "Microsoft.ServiceBus/namespaces/sku.tier",
            "equals": "Premium"
          },
          {
            "not": {
              "field": "Microsoft.ServiceBus/namespaces/encryption.keySource",
              "equals": "Microsoft.Keyvault"
            }
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/9c376cb6-0545-4233-a22c-074540d4d935",
  "name": "9c376cb6-0545-4233-a22c-074540d4d935"
}
Bylaw9c376cb6-0545-4233-a22c-074540d4d935.bylaw.ps1 · 32 lines
# Converted from ServiceBusEncryptWithCMK_Audit.json by ConvertTo-Bylaw.
Policy '9c376cb6-0545-4233-a22c-074540d4d935' {

    Properties @{
        DisplayName   = 'Service Bus Premium namespaces should use a customer-managed key for encryption in mission platforms'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Requiring premium namespaces to encrypt with customer-managed keys keeps encryption-material control within the mission tenant and satisfies strict data-protection obligations.'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.ServiceBus/namespaces' {

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

        Require 'encryption.keySource is Microsoft.Keyvault' {
            Field encryption.keySource | Must -Be 'Microsoft.Keyvault'
        }
    }

    Effect (Param Effect)
}

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