nuclei-templates/cloud/azure/activitylog/azure-policy-assignment-cre...

53 lines
2.0 KiB
YAML

id: azure-policy-assignment-create-alert-missing
info:
name: Azure Policy Assignment Create Alert Not Configured
author: princechaddha
severity: high
description: |
Ensure that an Azure activity log alert is used to detect "Create 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 "Create policy assignment (policyAssignments)" has "any" level, with "any" status and event is initiated by "any"'.
impact: |
Not having a specific alert for policy assignment creation events can lead to missing critical activities that could affect the security and compliance of your Azure environment.
remediation: |
Configure an Azure activity log alert for "Create Policy Assignment" events to ensure compliance and enhance security monitoring.
reference:
- https://docs.microsoft.com/en-us/azure/azure-monitor/platform/alerts-activity-log
tags: cloud,devops,azure,microsoft,azure-monitor,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:
- type: word
words:
- "Microsoft.Authorization/policyAssignments/write"
extractors:
- type: dsl
dsl:
- 'id + " alert does not detect Create Policy Assignment events"'
# digest: 4a0a00473045022058fda1d54f91c56eb4059e97711d603f204a20ee5ff8cd57a8ffceeb1507db54022100be85aac2ec5c344332d49255ada3ae9003f5c6298890188c8ac351e6533d360c:922c64590222798bb761d5b6d8e72950