Elevate your telemetry using custom data collection in Microsoft Defender
At Ignite in November, we announced that Microsoft Defender is now the only endpoint protection solution that allows data-hungry security teams to meet specific telemetry needs by optimizing their data collection right within the Defender portal, without the need to rely on fragmented and siloed solutions. Since then, we've heard from customers that this tool has been a game changer, enabling them to hunt through new data types as well as richer data on events already reported. The release of custom data collection was a key milestone in our ongoing journey to make Defender easy to manage and customize.
Security teams have been asking for guidance and examples of how to get the most out of the tool, so today we're sharing how some organizations can use custom data collection and dynamic tagging to detect command and control (C2) communications, giving defenders elevated visibility and deeper telemetry into attacker activity across the environment.
See the data you want to see
Defender's default telemetry is tuned to balance performance and signal-to-noise across millions of devices, so it focuses on the events most useful for high-fidelity detection at fleet scale, but many organizations want richer, more granular signals for deeper hunting, compliance, or auditing purposes. Custom data collection lets you go beyond what Defender already captures without ever leaving the Defender portal. Easily build custom collection rules based on your organization’s specific needs using natural language; no PhD required! It includes several highly requested data types, including AMSI for hunting over script content, and Kerberos for hunting auth-based and network attacks.
This truly integrated custom data offering is possible thanks to Microsoft’s platform approach, as the additional telemetry can be collected and analyzed via Defender and stored via Microsoft Sentinel. It puts you in complete control of any customized, add-on data, including exactly which data types are collected and how long they are stored. No other security solution has fully integrated and customizable telemetry collection and analysis.
Example custom telemetry scenario: detecting C2 communications
Many organizations have a set of assets that require special attention, like internet-facing servers, domain controllers, and other high-value endpoints where deeper telemetry can make the difference between catching an intrusion early and discovering it after the damage is done.
Imagine your organization has received threat intelligence on attacks using stealthy C2 frameworks: HTTPS beacons with jittered intervals, DNS-based data exchange, and persistence via scheduled tasks and registry modifications. You want richer visibility into those internet-facing servers and high-value endpoints so you can hunt for these patterns proactively, instead of reconstructing them after the fact.
Dynamic tags scope these high-value devices into a targeted group, and custom data collection captures the extra process, network, and registry events from them, giving analysts the telemetry they need to hunt for beaconing, suspicious DNS patterns, and persistence before attackers establish a foothold.
To detect C2 communications using dynamic tagging, follow these steps:
Step 1: Tag your devices
Custom Data Collection rules are scoped to dynamic tags; once set, those tags are automatically applied and removed based on conditions you define. Configure them in Settings > Microsoft Defender XDR > Asset Rule Management.
|
Tag |
Rule name |
Conditions |
Tag to apply |
|
Internet-facing servers |
InternetFacing-Servers |
Internet facing = true AND OS platform equals Windows Server 2022 |
C2-Watchlist |
|
Devices under active investigation |
HighSev-Investigation |
Manual tag equals UnderInvestigation |
HighSev-Verbose |
Bringing manual tags into the dynamic model
Custom data collection is built around dynamic tags by design: one leading, unified tagging experience that's more flexible and customizable. Dynamic tags can be driven by device properties, group membership, OS, or by existing manual tags, so anything your team already tags manually flows naturally into custom data collection through a simple Asset Rule Management rule, exactly as Tag 2 above does.
In this example, analysts manually tag a device UnderInvestigation during incident response. The dynamic rule picks up that manual tag and applies HighSev-Verbose, which custom data collection rules can target. The analyst doesn't need to know about dynamic tags they tag the device the way they always have, and custom data collection activates automatically.
Step 2: Build your collection rules
Navigate to Settings > Endpoints > Rules > Custom Data Collection. Select your Microsoft Sentinel workspace in the top-right corner.
Before creating rules, confirm you meet every prerequisite in the custom data collection documentation , in particular, your tenant must be onboarded to the Unified Security Operations Platform (USOP).
Rule 1: Outbound network connections from high-risk processes
Capture connections from processes commonly abused by C2 frameworks living-off-the-land binaries and scripting engines.
|
Setting |
Value |
|
Rule name |
C2-OutboundConnections |
|
Table |
DeviceCustomNetworkEvents |
|
Action |
Connection Success |
|
Condition |
InitiatingProcessFileName Equals: powershell.exe, rundll32.exe, regsvr32.exe, mshta.exe, certutil.exe, msiexec.exe |
|
Scope |
Devices tagged C2-Watchlist |
Rule 2: DNS query activity
Many C2 frameworks use DNS for beaconing or data exchange. Default telemetry captures limited DNS data. This rule collects all DNS queries from monitored devices.
|
Setting |
Value |
|
Rule name |
C2-DNSActivity |
|
Table |
DeviceCustomNetworkEvents |
|
Action |
Connection Success |
|
Condition |
RemotePort equals 53 |
|
Scope |
Devices tagged C2-Watchlist |
Rule 3: Persistence mechanisms
C2 implants establish persistence via scheduled tasks, registry run keys, or services. Capture process creation events for common persistence tools.
|
Setting |
Value |
|
Rule name |
C2-Persistence |
|
Table |
DeviceCustomProcessEvents |
|
Action |
Process Created |
|
Condition |
FileName in (schtasks.exe, reg.exe, sc.exe, at.exe) |
|
Scope |
Devices tagged C2-Watchlist |
Rule 4: Full process and script telemetry during investigations
When a device gets the HighSev-Verbose tag, collect everything.
|
Setting |
Value |
|
Rule name |
HighSev-AllProcesses |
|
Table |
DeviceCustomProcessEvents |
|
Action |
Process Created |
|
Condition |
Broad (all process creation events) |
|
Scope |
Devices tagged HighSev-Verbose |
|
Setting |
Value |
|
Rule name |
HighSev-ScriptCapture |
|
Table |
DeviceCustomScriptEvents |
|
Action |
Script execution |
|
Condition |
Broad (all script events) – add a condition which is always true such as FileName not equals “” |
|
Scope |
Devices tagged HighSev-Verbose |
Collection profiles summary
|
Tag |
Rules active |
What gets collected |
Use case |
|
C2-Watch list |
OutboundConnections, DNSActivity, Persistence |
Network connections from, DNS queries, persistence tool usage, DLL sideloading |
Persistent C2 monitoring |
|
HighSev-Verbose |
AllProcesses, ScriptCapture |
Every process creation, all script execution |
Full-depth incident response |
Important: when you remove the HighSev-Verbose tag after closing an incident, collection automatically drops back to baseline, no manual rule cleanup needed. This is what makes verbose collection safe to leave configured: it's only active while the tag is.
Step 3: Hunt
Rules deploy within 20 minutes to an hour. Query the data in AH directly.
Detect beaconing patterns processes making regular-interval outbound connections:
Find DNS queries to high-entropy domains (potential DGA):
Spot persistence being established:
Leverage the telemetry from your new collection rule into a Custom Detection so high-value findings raise alerts automatically, instead of waiting for the next manual hunt.
Custom data collection effectively extends your endpoint protection into a targeted, general-purpose log collector, one that's now ready to serve advanced hunting, custom detections, and auditing or regulatory use cases, while default fleet-wide telemetry stays tuned for performance and signal-to-noise. By combining dynamic tagging with purpose-built collection rules, your highest-risk devices are always streaming the signals that matter most, ready for detection and investigation before and during an incident.
Learn more
- To learn more about endpoint protection with Microsoft Defender, check out our website.
- To learn more about Microsoft Security solutions, visit our website. Bookmark the Security blog to keep up with our expert coverage on security matters. Follow us on LinkedIn (Microsoft Security) and X (@MSFTSecurity) for the latest news and updates on cybersecurity.
- To learn more about custom data collection and how to get started, see our documentation.
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0
Comments (0)