You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: defender-xdr/custom-detection-rules.md
+35-36Lines changed: 35 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,11 +38,11 @@ Custom detection rules are rules you can design and tweak using [advanced huntin
38
38
39
39
To manage custom detections, you need to be assigned one of these roles:
40
40
41
-
-**Security settings (manage)**— Users with this [Microsoft Defender XDR permission](manage-rbac.md) can manage security settings in the Microsoft Defender portal.
41
+
-**Security settings (manage)**- Users with this [Microsoft Defender XDR permission](manage-rbac.md) can manage security settings in the Microsoft Defender portal.
42
42
43
-
-**Security Administrator**— Users with this [Microsoft Entra role](/azure/active-directory/roles/permissions-reference#security-administrator) can manage security settings in the Microsoft Defender portal and other portals and services.
43
+
-**Security Administrator**- Users with this [Microsoft Entra role](/azure/active-directory/roles/permissions-reference#security-administrator) can manage security settings in the Microsoft Defender portal and other portals and services.
44
44
45
-
-**Security Operator**— Users with this [Microsoft Entra role](/azure/active-directory/roles/permissions-reference#security-operator) can manage alerts and have global read-only access to security-related features, including all information in the Microsoft Defender portal. This role is sufficient for managing custom detections only if role-based access control (RBAC) is turned off in Microsoft Defender for Endpoint. If you have RBAC configured, you also need the *Manage Security Settings permission for Defender for Endpoint.
45
+
-**Security Operator**- Users with this [Microsoft Entra role](/azure/active-directory/roles/permissions-reference#security-operator) can manage alerts and have global read-only access to security-related features, including all information in the Microsoft Defender portal. This role is sufficient for managing custom detections only if role-based access control (RBAC) is turned off in Microsoft Defender for Endpoint. If you have RBAC configured, you also need the *Manage Security Settings permission for Defender for Endpoint.
46
46
47
47
You can manage custom detections that apply to data from specific Microsoft Defender XDR solutions if you have the right permissions for them. For example, if you only have manage permissions for Microsoft Defender for Office 365, you can create custom detections using `Email*` tables but not `Identity*` tables.
48
48
@@ -73,8 +73,8 @@ In the Microsoft Defender portal, go to **Advanced hunting** and select an exist
73
73
74
74
To create a custom detection rule, the query must return the following columns:
75
75
76
-
-`Timestamp`—used to set the timestamp for generated alerts
77
-
-`ReportId`—enables lookups for the original records
76
+
-`Timestamp`- Used to set the timestamp for generated alerts
77
+
-`ReportId`- Enables lookups for the original records
78
78
- One of the following columns that identify specific devices, users, or mailboxes:
79
79
-`DeviceId`
80
80
-`DeviceName`
@@ -117,24 +117,24 @@ DeviceEvents
117
117
118
118
With the query in the query editor, select **Create detection rule** and specify the following alert details:
119
119
120
-
-**Detection name**— name of the detection rule; should be unique
121
-
-**Frequency**— interval for running the query and taking action. [See more guidance in the rule frequency section](#rule-frequency)
122
-
-**Alert title**— title displayed with alerts triggered by the rule; should be unique
123
-
-**Severity**— potential risk of the component or activity identified by the rule
124
-
-**Category**— threat component or activity identified by the rule
125
-
-**MITRE ATT&CK techniques**— one or more attack techniques identified by the rule as documented in the [MITRE ATT&CK framework](https://attack.mitre.org/). This section is hidden for certain alert categories, including malware, ransomware, suspicious activity, and unwanted software
126
-
-**Description**— more information about the component or activity identified by the rule
127
-
-**Recommended actions**— additional actions that responders might take in response to an alert
120
+
-**Detection name**- Name of the detection rule; should be unique
121
+
-**Frequency**-Interval for running the query and taking action. [See more guidance in the rule frequency section](#rule-frequency)
122
+
-**Alert title**- Title displayed with alerts triggered by the rule; should be unique.
123
+
-**Severity**- Potential risk of the component or activity identified by the rule.
124
+
-**Category**- Threat component or activity identified by the rule.
125
+
-**MITRE ATT&CK techniques**- One or more attack techniques identified by the rule as documented in the [MITRE ATT&CK framework](https://attack.mitre.org/). This section is hidden for certain alert categories, including malware, ransomware, suspicious activity, and unwanted software.
126
+
-**Description**- More information about the component or activity identified by the rule.
127
+
-**Recommended actions**- Additional actions that responders might take in response to an alert.
128
128
129
129
#### Rule frequency
130
130
131
131
When you save a new rule, it runs and checks for matches from the past 30 days of data. The rule then runs again at fixed intervals, applying a lookback duration based on the frequency you choose:
132
132
133
-
-**Every 24 hours**— runs every 24 hours, checking data from the past 30 days
134
-
-**Every 12 hours**— runs every 12 hours, checking data from the past 48 hours
135
-
-**Every 3 hours**— runs every 3 hours, checking data from the past 12 hours
136
-
-**Every hour**— runs hourly, checking data from the past 4 hours
137
-
-**Continuous (NRT)**— runs continuously, checking data from events as they're collected and processed in near real-time (NRT), see [Continuous (NRT) frequency](custom-detection-rules.md#continuous-nrt-frequency)
133
+
-**Every 24 hours**- Runs every 24 hours, checking data from the past 30 days.
134
+
-**Every 12 hours**- Runs every 12 hours, checking data from the past 48 hours.
135
+
-**Every 3 hours**- Runs every 3 hours, checking data from the past 12 hours.
136
+
-**Every hour**- Runs hourly, checking data from the past 4 hours.
137
+
-**Continuous (NRT)**- Runs continuously, checking data from events as they're collected and processed in near real-time (NRT), see [Continuous (NRT) frequency](custom-detection-rules.md#continuous-nrt-frequency).
138
138
139
139
> [!TIP]
140
140
> Match the time filters in your query with the lookback duration. Results outside of the lookback duration are ignored.
@@ -154,13 +154,12 @@ Selecting **Migrate now** gives you a list of all compatible rules according to
154
154
155
155
:::image type="content" source="media/custom-detection-compatible-queries.png" alt-text="Screenshot of the continuous frequency compatible queries in advanced hunting." lightbox="media/custom-detection-compatible-queries.png":::
156
156
157
-
158
157
Once you click **Save**, the selected rules' frequency gets updated to Continuous (NRT) frequency.
159
-
160
158
161
159
###### Queries you can run continuously
162
160
163
161
You can run a query continuously as long as:
162
+
164
163
- The query references one table only.
165
164
- The query uses an operator from the list of supported KQL operators. **[Supported KQL features](/azure/azure-monitor/essentials/data-collection-transformations-structure#supported-kql-features)**
166
165
- The query doesn't use joins, unions, or the `externaldata` operator.
@@ -191,7 +190,6 @@ Near real-time detections are supported for the following tables:
191
190
-`IdentityQueryEvents`
192
191
-`UrlClickEvents`
193
192
194
-
195
193
> [!NOTE]
196
194
> Only columns that are generally available can support **Continuous (NRT)** frequency.
197
195
@@ -211,11 +209,11 @@ Your custom detection rule can automatically take actions on devices, files, use
211
209
212
210
These actions are applied to devices in the `DeviceId` column of the query results:
213
211
214
-
-**Isolate device**— uses Microsoft Defender for Endpoint to apply full network isolation, preventing the device from connecting to any application or service. [Learn more about Microsoft Defender for Endpoint machine isolation](/windows/security/threat-protection/microsoft-defender-atp/respond-machine-alerts#isolate-devices-from-the-network)
215
-
-**Collect investigation package**— collects device information in a ZIP file. [Learn more about the Microsoft Defender for Endpoint investigation package](/windows/security/threat-protection/microsoft-defender-atp/respond-machine-alerts#collect-investigation-package-from-devices)
216
-
-**Run antivirus scan**— performs a full Microsoft Defender Antivirus scan on the device
217
-
-**Initiate investigation**— initiates an [automated investigation](m365d-autoir.md) on the device
218
-
-**Restrict app execution**— sets restrictions on device to allow only files that are signed with a Microsoft-issued certificate to run. [Learn more about app restrictions with Microsoft Defender for Endpoint](/defender-endpoint/respond-machine-alerts#restrict-app-execution)
212
+
-**Isolate device**- Uses Microsoft Defender for Endpoint to apply full network isolation, preventing the device from connecting to any application or service. [Learn more about Microsoft Defender for Endpoint machine isolation](/windows/security/threat-protection/microsoft-defender-atp/respond-machine-alerts#isolate-devices-from-the-network).
213
+
-**Collect investigation package**- Collects device information in a ZIP file. [Learn more about the Microsoft Defender for Endpoint investigation package](/windows/security/threat-protection/microsoft-defender-atp/respond-machine-alerts#collect-investigation-package-from-devices).
214
+
-**Run antivirus scan**- Performs a full Microsoft Defender Antivirus scan on the device.
215
+
-**Initiate investigation**- Initiates an [automated investigation](m365d-autoir.md) on the device.
216
+
-**Restrict app execution**- Sets restrictions on device to allow only files that are signed with a Microsoft-issued certificate to run. [Learn more about app restrictions with Microsoft Defender for Endpoint](/defender-endpoint/respond-machine-alerts#restrict-app-execution).
219
217
220
218
#### Actions on files
221
219
@@ -238,6 +236,7 @@ For more details on user actions, read [Remediation actions in Microsoft Defende
238
236
- If the custom detection yields email messages, you can select **Move to mailbox folder** to move the email to a selected folder (any of **Junk**, **Inbox**, or **Deleted items** folders). Specifically, you can move email results from quarantined items (for instance, in the case of false positives) by selecting the **Inbox** option.
239
237
240
238
:::image type="content" source="media/advanced-hunting-custom-quarantine-results.png" alt-text="Screenshot of the Inbox option under custom detections in the Microsoft Defender portal." lightbox="media/advanced-hunting-custom-quarantine-results.png":::
239
+
:::image type="content" source="media/advanced-hunting-custom-quarantine-results.png" alt-text="Screenshot of the Inbox option under custom detections in the Microsoft Defender portal." lightbox="media/advanced-hunting-custom-quarantine-results.png":::
241
240
242
241
- Alternatively, you can select **Delete email** and then choose to either move the emails to Deleted Items (**Soft delete**) or delete the selected emails permanently (**Hard delete**).
243
242
@@ -277,24 +276,24 @@ You can view the list of existing custom detection rules, check their previous r
277
276
278
277
To view all existing custom detection rules, navigate to **Hunting** > **Custom detection rules**. The page lists all the rules with the following run information:
279
278
280
-
-**Last run**— when a rule was last run to check for query matches and generate alerts
281
-
-**Last run status**— whether a rule ran successfully
282
-
-**Next run**— the next scheduled run
283
-
-**Status**— whether a rule has been turned on or off
279
+
-**Last run**- When a rule was last run to check for query matches and generate alerts
280
+
-**Last run status**- Whether a rule ran successfully
281
+
-**Next run**- The next scheduled run
282
+
-**Status**- Whether a rule has been turned on or off
284
283
285
284
### View rule details, modify rule, and run rule
286
285
287
286
To view comprehensive information about a custom detection rule, go to **Hunting** > **Custom detection rules** and then select the name of rule. You can then view general information about the rule, including information, its run status, and scope. The page also provides the list of triggered alerts and actions.
288
287
289
-
:::image type="content" source="/defender/media/custom-detect-rules-view.png" alt-text="The Custom detection rule details page in the Microsoft Defender portal" lightbox="/defender/media/custom-detect-rules-view.png":::
288
+
:::image type="content" source="/defender/media/custom-detect-rules-view.png" alt-text="Screenshot of the Custom detection rule details page in the Microsoft Defender portal." lightbox="/defender/media/custom-detect-rules-view.png":::
290
289
291
290
You can also take the following actions on the rule from this page:
292
291
293
-
-**Run**— run the rule immediately. This also resets the interval for the next run.
294
-
-**Edit**— modify the rule without changing the query
295
-
-**Modify query**— edit the query in advanced hunting
296
-
-**Turn on** / **Turn off**— enable the rule or stop it from running
297
-
-**Delete**— turn off the rule and remove it
292
+
-**Run**- Run the rule immediately. This also resets the interval for the next run.
293
+
-**Edit**- Modify the rule without changing the query.
294
+
-**Modify query**- Edit the query in advanced hunting.
295
+
-**Turn on** / **Turn off**- Enable the rule or stop it from running.
0 commit comments