Microsoft Defender XDR
Hunting and detection

Advanced Hunting Query Builder

In brief

Updated the publication date, clarified wording for the Run query and All filters controls, improved screenshot descriptions, and renamed the Related content section with an anchor.

What Defender admins need to know

Administrators get clearer guidance for interpreting query-builder controls and screenshots; no configuration change is indicated.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

Screenshot of the guided mode query builder with endpoint-specific filters displayed after selecting the Endpoints domain

Once the query is ready, select the blue Run query button. If the button is grayed out, it means the query needs to be filled out or edited further.

To restore the complete list of sample queries, select All domains then reopen Load sample queries.

If the loaded sample query uses filters outside of the basic filter set, the All filters toggle is grayed out. To go back to the basic filter set, select Clear all then toggle All filters.

Use more filters

To view more filter groups and conditions, select Toggle to see more filters and conditions.

Screenshot of the guided mode query builder showing the toggle option for enabling additional filters and conditions

When the All filters toggle is active, you can now use the full range of filters and conditions in guided mode.

Screenshot of the guided mode query builder with All filters enabled, showing expanded filter categories available for building more complex conditions

Create conditions

Screenshot of the guided mode query builder showing the filter selection list for choosing a field to add as a query condition

Type a section title in the search box at the top of the list to find the filter you want. Sections ending in info contain filters that provide information about the different components you can look at and filters for the states of entities. Sections ending in events contain filters that allow you to look for any monitored event on the entity. For instance, to hunt for activities involving certain devices, you can use the filters under the Device events section.

In the Getting started section of the hunting page, we have provided three guided query examples that you can load. The query examples contain some of the most common filters and inputs you would typically need in your hunting. Loading any of the three sample queries opens a guided tour of how you would construct the entry using guided mode.

Screenshot of the Getting started section showing sample guided queries that open step-by-step teaching bubbles for building a query

Follow the instructions in the blue teaching bubbles to construct your query. Select Run query.

To hunt for successful network communications to a specific IP address, start typing "ip" to get suggested filters:

Screenshot of the guided mode query builder showing IP-related filter suggestions after typing ip in the search box to hunt for connections to a specific IP address

To look for events involving a specific IP address where the IP is the destination of the communication, select DestinationIPAddress under the IP Address Events section. Then select the equals operator. Type the IP in the third dropdown menu and press Enter:

Screenshot of the guided mode query builder with a DestinationIPAddress equals condition set to the specified IP address

Then, to add a second condition which searches for successful network communication events, search for the filter of a specific event type:

Screenshot of the guided mode query builder adding an EventType condition to filter for successful network communication events

The EventType filter looks for the different event types logged. It is equivalent to the ActionType column which exists in most of the tables in advanced hunting. Select it to choose one or more event types to filter for. To look for successful network communication events, expand the DeviceNetworkEvents section and then choose ConnectionSuccess:

Screenshot of the guided mode query builder with the ConnectionSuccess event type selected under DeviceNetworkEvents as a condition for the IP address hunt

Finally, select Run query to hunt for all successful network communications to the 52.168.117.170 IP address:

Screenshot of query results showing successful network communication events to the specified destination IP address

Hunt for high confidence phish or spam emails delivered to inbox

To look for all high confidence phish and spam emails that were delivered to the inbox folder at the time of delivery, first select ConfidenceLevel under Email Events, select equals and choose High under both Phish and Spam from the suggested closed list which supports multi-selection:

Screenshot of the guided mode query builder with ConfidenceLevel set to High for both Phish and Spam under Email Events

Then, add another condition, this time specifying the folder or DeliveryLocation, Inbox/folder.

Screenshot of the guided mode query builder adding a DeliveryLocation condition set to Inbox/folder for the phishing email hunt

Related content