Azure Resource Group Deleted by Unusual Principal

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

About

Identifies Azure resource group deletions by a principal that has not performed this operation in the prior 7 days. Deletion of a resource group is permanent and removes all resources in the group. This rule uses an ES|QL first-seen (new terms) approach keyed on the acting principal so routine infrastructure-as-code teardown is suppressed after the first occurrence, while still surfacing first-time or unusual identities performing the delete.
Tags
Domain: CloudData Source: AzureUse Case: Log AuditingTactic: ImpactNoise: LowPerformance: FastProfile: RecommendedTactic: Defense EvasionRule Type: ES|QLPlatform: AzureData Source: Azure Activity LogsService: Azure Resource ManagerLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Impact (TA0040)(external, opens in a new tab or window)

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, AKS control plane) commonly delete resource groups during environment teardown. The first occurrence per principal will alert; baseline expected service principals and exclude them if the activity is authorized. Administrators may delete resource groups during decommissioning, lab cleanup, or organizational restructuring. Verify the actor, change ticket, and whether the deleted group was 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-*, filebeat-* | WHERE data_stream.dataset == "azure.activitylogs" AND event.action == "MICROSOFT.RESOURCES/SUBSCRIPTIONS/RESOURCEGROUPS/DELETE" AND event.outcome IN ("success", "Success") AND azure.activitylogs.identity.authorization.evidence.principal_id IS NOT NULL | STATS Esql.first_time_seen = MIN(@timestamp), Esql.last_time_seen = MAX(@timestamp), Esql.event_count = COUNT(*), Esql.resource_group_values = VALUES(azure.resource.group), Esql.resource_name_values = VALUES(azure.resource.name), Esql.resource_id_values = VALUES(azure.resource.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.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.activitylogs.identity.authorization.evidence.principal_id // new terms emulation: fire when this principal'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 Resource Group Deleted by Unusual Principal 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).