Azure Diagnostic Settings Deleted

Last updated 2 months ago on 2026-09-21
Created 6 years ago on 2020-08-17

About

Identifies deletion of Azure diagnostic settings for a resource group that has not had this operation in the prior 7 days. Diagnostic settings send platform logs and metrics to Log Analytics, Event Hubs, or storage; removing them blinds monitoring and detection. This rule uses an ES|QL first-seen (new terms) approach keyed on the resource group so groups that constantly churn logging configuration are suppressed after the first occurrence, while a newly seen group still alerts.
Tags
Domain: CloudData Source: AzureData Source: Azure Activity LogsUse Case: Threat DetectionTactic: Defense EvasionNoise: LowPerformance: NormalProfile: RecommendedRule Type: ES|QLPlatform: AzureService: Azure Resource ManagerLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Defense Evasion (TA0005)(external, opens in a new tab or window)

False Positive Examples
Infrastructure-as-code, CI/CD, and platform automation (for example Crossplane, Terraform, ARM/Bicep) commonly delete diagnostic settings during environment teardown or redeploy. The first occurrence per resource group in 7 days will alert; groups that are rebuilt often will then go quiet. Microsoft-owned resource providers (for example Azure Cosmos DB networking) may remove diagnostic settings as part of private-endpoint or control-plane lifecycle. Confirm the actor, app, and whether the group is non-production before treating the event as malicious.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

azure(external, opens in a new tab or window)

Query
text code block:
FROM logs-azure.activitylogs-* | WHERE data_stream.dataset == "azure.activitylogs" AND event.action == "MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE" AND event.outcome IN ("success", "Success") AND azure.resource.group IS NOT NULL | STATS Esql.first_time_seen = MIN(@timestamp), Esql.last_time_seen = MAX(@timestamp), Esql.event_count = COUNT(*), Esql.event_action_values = VALUES(event.action), Esql.resource_name_values = VALUES(azure.resource.name), Esql.resource_id_values = VALUES(azure.resource.id), Esql.resource_provider_values = VALUES(azure.resource.provider), Esql.principal_id_values = VALUES(azure.activitylogs.identity.authorization.evidence.principal_id), Esql.principal_type_values = VALUES(azure.activitylogs.identity.authorization.evidence.principal_type), Esql.initiated_by_user_values = VALUES(azure.activitylogs.identity.claims_initiated_by_user.name), Esql.appid_values = VALUES(azure.activitylogs.identity.claims.appid), Esql.session_id_values = VALUES(azure.activitylogs.identity.claims.sid), Esql.unique_token_id_values = VALUES(azure.activitylogs.identity.claims.uti), Esql.correlation_id_values = VALUES(azure.correlation_id), Esql.role_values = VALUES(azure.activitylogs.identity.authorization.evidence.role), Esql.role_assignment_id_values = VALUES(azure.activitylogs.identity.authorization.evidence.role_assignment_id), Esql.role_assignment_scope_values = VALUES(azure.activitylogs.identity.authorization.evidence.role_assignment_scope), Esql.source_ip_values = VALUES(source.ip), Esql.source_country_values = VALUES(source.geo.country_name), Esql.source_as_number_values = VALUES(source.`as`.number), Esql.subscription_id_values = VALUES(azure.subscription_id) BY azure.resource.group // new terms emulation: fire when this resource group's first_seen falls in the current interval // (schedule + ingest-lag buffer), i.e. it was absent from the rest of the 7-day window | EVAL Esql.recent_minutes = DATE_DIFF("minute", Esql.first_time_seen, NOW()) | WHERE Esql.recent_minutes <= 10 | KEEP azure.*, Esql.*

Install detection rules in Elastic Security

Detect Azure Diagnostic Settings Deleted in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).