← Back to SOC feed Coverage →

Map external devices (1)

kql MEDIUM Azure-Sentinel
DeviceEvents
huntingmicrosoftofficial
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Azure-Sentinel →
Retrieved: 2026-05-21T11:00:00Z · Confidence: medium

Hunt Hypothesis

An adversary may be attempting to establish unauthorized access by connecting external devices to the network, which could indicate the use of compromised or rogue hardware. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential lateral movement or persistence mechanisms early.

KQL Query

// Query #2: map uncommon storage devices across the org
// This is a noisy query - but it can serve as reference for working with this event
DeviceEvents
| where ActionType == "PnpDeviceConnected"
| extend parsed=parse_json(AdditionalFields)
| extend
    DeviceDescription=tostring(parsed.DeviceDescription),
    ClassName=tostring(parsed.ClassName)
| where
    ClassName in ("DiskDrive", "CDROM")
    or ClassName contains "nas"
    or ClassName contains "SCSI"
    or (ClassName == "USB" and DeviceDescription contains "storage")
| summarize ComputerCount=dcount(DeviceName) by ClassName, DeviceDescription
| where ComputerCount < 5

Analytic Rule Definition

id: a091241a-5df7-497f-b4fa-b36641e7373d
name: Map external devices (1)
description: |
  Action "PnpDeviceConnected" reports the connection of any plug and play device.
  Read more online on event 6416: https://docs.microsoft.com/windows/security/threat-protection/auditing/event-6416.
  Query #1: look for rare one-time devices connected to a specific machine.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceEvents
query: |
  // Query #2: map uncommon storage devices across the org
  // This is a noisy query - but it can serve as reference for working with this event
  DeviceEvents
  | where ActionType == "PnpDeviceConnected"
  | extend parsed=parse_json(AdditionalFields)
  | extend
      DeviceDescription=tostring(parsed.DeviceDescription),
      ClassName=tostring(parsed.ClassName)
  | where
      ClassName in ("DiskDrive", "CDROM")
      or ClassName contains "nas"
      or ClassName contains "SCSI"
      or (ClassName == "USB" and DeviceDescription contains "storage")
  | summarize ComputerCount=dcount(DeviceName) by ClassName, DeviceDescription
  | where ComputerCount < 5

Required Data Sources

Sentinel TableNotes
DeviceEventsEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Exfiltration/Map external devices (1).yaml