How the attack works
Diagnostic settings send Azure platform logs to a Log Analytics workspace, an event hub or a storage account: the subscription activity log, and resource logs such as Key Vault audit events or storage access logs. Resource logs are not collected at all without a diagnostic setting, and the activity log is kept in Azure for only 90 days, so these settings are what feeds the SIEM and long-term retention.
Attackers with write access to a resource or subscription delete its diagnostic setting so that their next actions, such as secret reads, data access or configuration changes, are no longer forwarded. The deletion is a control-plane operation recorded in the activity log as Microsoft.Insights/diagnosticSettings/delete. When the deleted setting is the one exporting the activity log itself, the deletion may be among the last records the SIEM receives, so pair this rule with an alert on sources that stop sending data.
What an attacker needs
Microsoft.Insights/diagnosticSettings/deleteon the resource or subscription (Owner, Contributor, or a monitoring role that includes it).
Impact
Loss of visibility over the affected resources or subscription, which hides follow-on activity; resource logs generated while the setting is missing are not recorded anywhere.
Detection rules
Azure Diagnostic Setting Deleted
Detects a successful deletion of an Azure Monitor diagnostic setting on a resource or subscription, which stops its logs from being sent to a workspace, event hub or storage account.
title: Azure Diagnostic Setting Deleted
id: f5136e1b-420c-48f3-8ee0-d6027f41e964
status: experimental
description: >-
Detects a successful deletion of an Azure Monitor diagnostic setting on a
resource or subscription, which stops its logs from being sent to a
workspace, event hub or storage account.
references:
- https://attack.mitre.org/techniques/T1685/002/
- https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/diagnostic-settings
- https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/monitor
author: Forestall
date: 2026-11-10
tags:
- attack.defense-impairment
- attack.t1685.002
logsource:
product: azure
service: activitylogs
detection:
selection:
OperationNameValue: MICROSOFT.INSIGHTS/DIAGNOSTICSETTINGS/DELETE
ActivityStatusValue:
- Success
- Succeeded
condition: selection
falsepositives:
- Decommissioning of resources or migration of logging to a new destination; correlate with change records and exclude infrastructure-as-code identities in a filter_ selection by Caller.
level: medium
False positives
- Decommissioning of resources or migration of logging to a new destination; correlate with change records and exclude infrastructure-as-code identities in a filter_ selection by Caller.
Triage
- Identify the Caller and the resource or subscription whose diagnostic setting was removed, and whether it exported the activity log.
- Look for activity by the same caller, or on the same resource, after the deletion; use the activity log in the Azure portal if the export stopped.
- Restore the setting, confirm that data arrives again and record the gap for the investigation.
Response
Once the attack is confirmed:
- Contain the caller. Revoke its sessions, rotate its credentials and remove its write access to the resource or subscription until the deletion is explained.
- Check every other diagnostic setting the caller could reach, across subscriptions and resources, for deletions and for edits that removed log categories or changed the destination.
- Export the subscription activity log for the gap from Azure before it ages out of the 90 days it is kept, and add it to the case.
- For resource logs, nothing was recorded during the gap. Assume the worst for the affected resource, for example by rotating the secrets of a Key Vault whose audit events were not collected.
Mitigation
- Deploy diagnostic settings through Azure Policy with a deploy-if-not-exists effect, so a deleted setting is detected as non-compliant and can be remediated.
- Restrict who can manage diagnostic settings; Contributor on a resource is enough to remove its logging.
- Alert when a log source stops sending data, not only on the deletion event.
Frequently asked questions
Is the activity during the gap lost for good?
It depends on the log. The subscription activity log is kept in Azure for 90 days whether or not it is exported, so control-plane operations can still be read in the portal. Resource logs, such as Key Vault audit events or storage access logs, are not collected without a diagnostic setting and are not recorded anywhere for that period.
Does the rule catch a diagnostic setting that was edited instead of deleted?
No. The rule matches the delete operation only. Removing log categories from a setting or pointing it to another destination is an update, recorded as `Microsoft.Insights/diagnosticSettings/write`, and it can silence a source just as well. An alert on sources that stop sending data covers both cases.
Will the SIEM receive the deletion event if the deleted setting exported the activity log itself?
Possibly, but do not count on more than that. When the deleted setting is the one that exports the activity log, the deletion may be among the last records the SIEM receives from that subscription. Pair the rule with an alert on log sources that stop sending data.