Gallery › Service Bus › Azure Community Policy
Service Bus Namespace - Customer Managed Keys AUDIT
Converted Policy Audit Disabled Mode All Version 1.0.0
This Azure Policy creates an audit event when the 'Customer-managed key' setting is not enabled as this implies that a Microsoft Managed Key is used.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 50 lines
{
"name": "ff100af1-70f2-4521-8c0e-d3b90ae13741",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Service Bus Namespace - Customer Managed Keys AUDIT",
"description": "This Azure Policy creates an audit event when the 'Customer-managed key' setting is not enabled as this implies that a Microsoft Managed Key is used.",
"metadata": {
"version": "1.0.0",
"category": "Service Bus"
},
"mode": "All",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Audit or Disabled 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')]"
}
}
}
}Bylawff100af1-70f2-4521-8c0e-d3b90ae13741.bylaw.ps1 · 31 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'ff100af1-70f2-4521-8c0e-d3b90ae13741' {
Properties @{
DisplayName = 'Service Bus Namespace - Customer Managed Keys AUDIT'
Description = 'This Azure Policy creates an audit event when the ''Customer-managed key'' setting is not enabled as this implies that a Microsoft Managed Key is used.'
Version = '1.0.0'
Category = 'Service Bus'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Audit or Disabled 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: policyDefinitions/Service Bus/service-bus-namespace-customer-managed-keys-audit/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw