id: azure-storage-account-delete-unalerted info: name: Azure Storage Account Delete Alert Not Configured author: princechaddha severity: high description: | Ensure that a Microsoft Azure activity log alert is fired whenever a "Delete Storage Account" event is triggered within your cloud account. An Azure activity log alert fires each time the event that matches the condition specified in the alert configuration is triggered. The alert condition that this conformity rule checks for is "Whenever the Administrative Activity Log 'Delete Storage Account (Microsoft.Storage/storageAccounts)' has 'any' Event level, with 'any' status and event is initiated by 'any'". impact: | Failure to have alert rules for the deletion of storage accounts can allow malicious or accidental deletions to go unnoticed, potentially leading to data loss and security breaches. remediation: | Ensure alert rules are configured to fire on "Delete Storage Account" events by setting the alert condition to "Microsoft.Storage/storageAccounts/delete" 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,storage-account,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.Storage/storageAccounts/delete" negative: true extractors: - type: dsl dsl: - 'id + " does not have the correct alert configuration for Delete Storage Account events"' # digest: 4a0a0047304502205e71de1ab0d9adcac6f6e267f056a7d953053ded1dcf4468759402c58835f8a1022100e0da4926bd854666290f2ea1a76421aa429cad45903bfe7eaa87654904572ba9:922c64590222798bb761d5b6d8e72950