58 lines
2.2 KiB
YAML
58 lines
2.2 KiB
YAML
|
id: azure-sql-db-update-unalerted
|
||
|
info:
|
||
|
name: Azure SQL Database Create/Update Alert Not Configured
|
||
|
author: princechaddha
|
||
|
severity: high
|
||
|
description: |
|
||
|
Ensure that an Azure activity log alert is fired whenever "Create/Update Azure SQL Database" events are triggered within your Microsoft Azure cloud account. Activity log alerts get triggered when a new activity log event that matches the condition specified in the alert configuration occurs. For this conformity rule, the matched condition is "Whenever the Activity Log has an event with Category='Administrative', Signal name='Create/Update Azure SQL Database (servers/databases)'".
|
||
|
impact: |
|
||
|
Not configuring alerts for monitoring "Create or Update Azure SQL Database" events can allow unauthorized changes to go unnoticed, potentially leading to data loss or security breaches.
|
||
|
remediation: |
|
||
|
Configure Azure activity log alerts to monitor and notify on "Create or Update Azure SQL Database" events by setting the alert condition to "Microsoft.Sql/servers/databases/write" and ensuring that an action group is attached to manage notifications.
|
||
|
reference:
|
||
|
- https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-activity-log
|
||
|
tags: cloud,devops,azure,microsoft,sql-database,azure-cloud-config
|
||
|
|
||
|
flow: |
|
||
|
code(1);
|
||
|
for (let AlertData of iterate(template.alertList)) {
|
||
|
set("id", AlertData);
|
||
|
code(2);
|
||
|
}
|
||
|
|
||
|
self-contained: true
|
||
|
code:
|
||
|
- engine:
|
||
|
- sh
|
||
|
- bash
|
||
|
source: |
|
||
|
az monitor activity-log alert list --output json --query '[?(enabled==`true`)].id'
|
||
|
extractors:
|
||
|
- type: json
|
||
|
name: alertList
|
||
|
internal: true
|
||
|
json:
|
||
|
- '.[]'
|
||
|
|
||
|
- engine:
|
||
|
- sh
|
||
|
- bash
|
||
|
source: |
|
||
|
az monitor activity-log alert show --ids "$id" --query 'condition'
|
||
|
|
||
|
matchers-condition: and
|
||
|
matchers:
|
||
|
- type: word
|
||
|
words:
|
||
|
- '"field": "operationName"'
|
||
|
|
||
|
- type: word
|
||
|
words:
|
||
|
- "Microsoft.Sql/servers/databases/write"
|
||
|
negative: true
|
||
|
|
||
|
extractors:
|
||
|
- type: dsl
|
||
|
dsl:
|
||
|
- 'id + " does not have the correct alert configuration for Create/Update Azure SQL Database events"'
|