Gallery › Service Bus › Azure built-in policies
Service Bus Premium namespaces should use a customer-managed key for encryption
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
Azure Service Bus supports the option of encrypting data at rest with either Microsoft-managed keys (default) or customer-managed keys. Choosing to encrypt data using customer-managed keys enables you to assign, rotate, disable, and revoke access to the keys that Service Bus will use to encrypt data in your namespace. Note that Service Bus only supports encryption with customer-managed keys for premium namespaces.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "Service Bus Premium namespaces should use a customer-managed key for encryption",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Service Bus supports the option of encrypting data at rest with either Microsoft-managed keys (default) or customer-managed keys. Choosing to encrypt data using customer-managed keys enables you to assign, rotate, disable, and revoke access to the keys that Service Bus will use to encrypt data in your namespace. Note that Service Bus only supports encryption with customer-managed keys for premium namespaces.",
"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 policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"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/295fc8b1-dc9f-4f53-9c61-3f313ceab40a",
"name": "295fc8b1-dc9f-4f53-9c61-3f313ceab40a"
}# Converted from CustomerManagedKeyEnabled_Audit.json by ConvertTo-Bylaw.
Policy '295fc8b1-dc9f-4f53-9c61-3f313ceab40a' {
Properties @{
DisplayName = 'Service Bus Premium namespaces should use a customer-managed key for encryption'
Description = 'Azure Service Bus supports the option of encrypting data at rest with either Microsoft-managed keys (default) or customer-managed keys. Choosing to encrypt data using customer-managed keys enables you to assign, rotate, disable, and revoke access to the keys that Service Bus will use to encrypt data in your namespace. Note that Service Bus only supports encryption with customer-managed keys for premium namespaces.'
Version = '1.0.0'
Category = 'Service Bus'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
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/Service Bus/CustomerManagedKeyEnabled_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw