← Back to SOC feed Coverage →

Device Logons from Unknown IPs

kql MEDIUM Azure-Sentinel
DeviceLogonEventsIdentityLogonEvents
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-23T11:00:00Z · Confidence: medium

Hunt Hypothesis

Adversaries may be using unknown IP addresses to establish unauthorized access to devices, bypassing network monitoring controls. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential lateral movement or command-and-control activities.

KQL Query

DeviceLogonEvents
| where RemoteIPType == "Public"
| join kind=leftanti (
    DeviceNetworkInfo
    | project NetworkInfo = todynamic(IPAddresses )
    | mvexpand NetworkInfo
    | project IpAddress = tostring(parse_json(NetworkInfo).IPAddress)
    | distinct IpAddress
) on $left.RemoteIP == $right.IpAddress // Removes any IP addresses assigned to a device
| join kind=leftanti (
    IdentityLogonEvents
    | where ISP != "INTERNAL_NETWORK"
) on $left.RemoteIP == $right.IPAddress // Remove any IP addresses identified as internal by Microsoft Cloud App Security
| summarize EarliestEvent = min(Timestamp), LatestEvent = max(Timestamp), Instances = count(), DistinctMachines = dcount(DeviceId) by AccountDomain, AccountName, LogonType, RemoteIP, ActionType

Analytic Rule Definition

id: a6d76204-efb2-4ccd-a068-d5a9e6876236
name: Device Logons from Unknown IPs
description: |
  Device Logons from Unknown IP Addresses.
  This query identifies device logons from IP addresses not associated with any machine in Defender ATP.
requiredDataConnectors:
- connectorId: MicrosoftThreatProtection
  dataTypes:
  - DeviceLogonEvents
  - DeviceNetworkInfo
  - IdentityLogonEvents
query: |
  DeviceLogonEvents
  | where RemoteIPType == "Public"
  | join kind=leftanti (
      DeviceNetworkInfo
      | project NetworkInfo = todynamic(IPAddresses )
      | mvexpand NetworkInfo
      | project IpAddress = tostring(parse_json(NetworkInfo).IPAddress)
      | distinct IpAddress
  ) on $left.RemoteIP == $right.IpAddress // Removes any IP addresses assigned to a device
  | join kind=leftanti (
      IdentityLogonEvents
      | where ISP != "INTERNAL_NETWORK"
  ) on $left.RemoteIP == $right.IPAddress // Remove any IP addresses identified as internal by Microsoft Cloud App Security
  | summarize EarliestEvent = min(Timestamp), LatestEvent = max(Timestamp), Instances = count(), DistinctMachines = dcount(DeviceId) by AccountDomain, AccountName, LogonType, RemoteIP, ActionType

Required Data Sources

Sentinel TableNotes
DeviceLogonEventsEnsure this data connector is enabled
IdentityLogonEventsEnsure this data connector is enabled

References

False Positive Guidance

Original source: https://github.com/Azure/Azure-Sentinel/blob/main/Hunting Queries/Microsoft 365 Defender/Lateral Movement/Device Logons from Unknown IPs.yaml