Gallery › Monitoring › Azure built-in policies
Azure Log Search Alerts over Log Analytics workspaces should use customer-managed keys
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Ensure that Azure Log Search Alerts are implementing customer-managed keys, by storing the query text using the storage account that the customer had provided for the queried Log Analytics workspace. For more information, visit https://docs.microsoft.com/azure/azure-monitor/platform/customer-managed-keys#customer-managed-key-overview.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONScheduledQueryRules_CMKEnabled_Deny.json · 50 lines
{
"properties": {
"displayName": "Azure Log Search Alerts over Log Analytics workspaces should use customer-managed keys",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Ensure that Azure Log Search Alerts are implementing customer-managed keys, by storing the query text using the storage account that the customer had provided for the queried Log Analytics workspace. For more information, visit https://docs.microsoft.com/azure/azure-monitor/platform/customer-managed-keys#customer-managed-key-overview.",
"metadata": {
"version": "1.0.0",
"category": "Monitoring"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match"
},
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Insights/scheduledqueryrules"
},
{
"field": "Microsoft.Insights/scheduledqueryrules/checkWorkspaceAlertsStorageConfigured",
"notEquals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/94c1f94d-33b0-4062-bd04-1cdc3e7eece2",
"name": "94c1f94d-33b0-4062-bd04-1cdc3e7eece2"
}Bylaw94c1f94d-33b0-4062-bd04-1cdc3e7eece2.bylaw.ps1 · 28 lines
# Converted from ScheduledQueryRules_CMKEnabled_Deny.json by ConvertTo-Bylaw.
Policy '94c1f94d-33b0-4062-bd04-1cdc3e7eece2' {
Properties @{
DisplayName = 'Azure Log Search Alerts over Log Analytics workspaces should use customer-managed keys'
Description = 'Ensure that Azure Log Search Alerts are implementing customer-managed keys, by storing the query text using the storage account that the customer had provided for the queried Log Analytics workspace. For more information, visit https://docs.microsoft.com/azure/azure-monitor/platform/customer-managed-keys#customer-managed-key-overview.'
Version = '1.0.0'
Category = 'Monitoring'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match'
}
Resource 'Microsoft.Insights/scheduledqueryrules' {
Require 'checkWorkspaceAlertsStorageConfigured is true' {
Field checkWorkspaceAlertsStorageConfigured | Must -Be 'true'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Monitoring/ScheduledQueryRules_CMKEnabled_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw