Gallery › SignalR › Azure built-in policies
Azure SignalR Service should enable diagnostic logs
Uses Condition Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0
Audit enabling of diagnostic logs. This enables you to recreate activity trails to use for investigation purposes; when a security incident occurs or when your network is compromised
ConvertTo-Bylaw converted this policy, and proved it compiles back to the same definition. Conditions the language can't express yet are written as raw JSON with Condition.
Azure Policy JSONDiagnosticLog_AINE.json · 54 lines
{
"properties": {
"displayName": "Azure SignalR Service should enable diagnostic logs",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Audit enabling of diagnostic logs. This enables you to recreate activity trails to use for investigation purposes; when a security incident occurs or when your network is compromised",
"metadata": {
"version": "1.0.0",
"category": "SignalR"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.SignalRService/SignalR"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Insights/diagnosticSettings",
"existenceCondition": {
"count": {
"field": "Microsoft.Insights/diagnosticSettings/logs[*]",
"where": {
"field": "Microsoft.Insights/diagnosticSettings/logs.enabled",
"equals": "true"
}
},
"greaterOrEquals": 1
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/d9f1f9a9-8795-49f9-9e7b-e11db14caeb2",
"name": "d9f1f9a9-8795-49f9-9e7b-e11db14caeb2"
}Bylawd9f1f9a9-8795-49f9-9e7b-e11db14caeb2.bylaw.ps1 · 30 lines
# Converted from DiagnosticLog_AINE.json by ConvertTo-Bylaw.
Policy 'd9f1f9a9-8795-49f9-9e7b-e11db14caeb2' {
Properties @{
DisplayName = 'Azure SignalR Service should enable diagnostic logs'
Description = 'Audit enabling of diagnostic logs. This enables you to recreate activity trails to use for investigation purposes; when a security incident occurs or when your network is compromised'
Version = '1.0.0'
Category = 'SignalR'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.SignalRService/SignalR'
AuditIfNotExists 'Microsoft.Insights/diagnosticSettings' -Effect (Param Effect) {
Require 'logs and logs.enabled are as required' {
Count 'logs[*]' -Where {
Condition '{ "field": "Microsoft.Insights/diagnosticSettings/logs.enabled", "equals": "true" }'
} | Must -BeGreaterOrEqual 1
}
}
}Source: built-in-policies/policyDefinitions/SignalR/DiagnosticLog_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw