59 lines
2.3 KiB
YAML
59 lines
2.3 KiB
YAML
id: azure-mysql-db-update-unalerted
|
|
info:
|
|
name: Azure MySQL Database Create/Update Alert Not Configured
|
|
author: princechaddha
|
|
severity: high
|
|
description: |
|
|
Ensure that an Azure activity log alert is fired whenever "Create/Update MySQL Database" events are triggered within your Microsoft Azure cloud account. The 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 MySQL Database (servers/databases)'".
|
|
impact: |
|
|
Without proper alert rules configured for monitoring "Create or Update MySQL Database" events, unauthorized or unwanted changes might go unnoticed, leading to potential security risks.
|
|
remediation: |
|
|
Ensure alert rules are properly configured to monitor and notify on "Create or Update MySQL Database" events by setting the alert condition to "Microsoft.DBforMySQL/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,mysql,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.DBforMySQL/servers/databases/write"
|
|
negative: true
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- 'id + " does not have the correct alert configuration for Create/Update MySQL Database events"'
|
|
# digest: 4b0a00483046022100a760d5614b2df1a25a1f64d4182047ebb4b11a2c6f43d3bbe84fc15a4043fdbe022100f8218222b097611cc173824f1ebfadcaa5ae461e92628797695ff6fdb87fbc36:922c64590222798bb761d5b6d8e72950 |