Skip to content

Azure Policy Assignment Delete Alert Not Configured

ID: azure-policy-assignment-delete-unalerted

Severity: high

Author: princechaddha

Tags: cloud,devops,azure,microsoft,policy-assignment,azure-cloud-config

Ensure that an Azure activity log alert is used to detect “Delete Policy Assignment” events within your Microsoft Azure cloud account. Activity log alerts get activated when a new activity log event that matches the condition specified in the alert occurs. In this case, the condition used is ‘Whenever the Policy Activity Log “Delete policy assignment (policyAssignments)” has “any” level, with “any” status and event is initiated by “any”’.

id: azure-policy-assignment-delete-unalerted
info:
name: Azure Policy Assignment Delete Alert Not Configured
author: princechaddha
severity: high
description: |
Ensure that an Azure activity log alert is used to detect "Delete Policy Assignment" events within your Microsoft Azure cloud account. Activity log alerts get activated when a new activity log event that matches the condition specified in the alert occurs. In this case, the condition used is 'Whenever the Policy Activity Log "Delete policy assignment (policyAssignments)" has "any" level, with "any" status and event is initiated by "any"'.
impact: |
Failing to monitor "Delete Policy Assignment" events can lead to unauthorized policy changes that could affect resource compliance and security without notice.
remediation: |
Configure alert rules to monitor and notify on "Delete Policy Assignment" events by setting the alert condition to "Microsoft.Authorization/policyAssignments/delete" and ensuring that an action group is attached for notifications.
reference:
- https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-activity-log
tags: cloud,devops,azure,microsoft,policy-assignment,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.Authorization/policyAssignments/delete"
negative: true
extractors:
- type: dsl
dsl:
- 'id + " does not have the correct alert configuration for Delete Policy Assignment events"'
# digest: 4b0a00483046022100a352128a09f7396a4e8c1f2856b63b542cbbf164e1ed0644bb1f0687af35d452022100b725f82f43effbac428173c9878644416cdd3f75a799a9a576bbd09b0b933ab7:922c64590222798bb761d5b6d8e72950

This template is used to detect vulnerabilities in web applications. It can be used with the Nuclei tool to scan for specific patterns or behaviors.

Terminal window
$ nuclei -u "URL" -t "cloud/azure/activitylog/azure-policy-assignment-delete-unalerted.yaml"

View on Github