Skip to content

Commit 54f80af

Browse files
committed
Update custom-detection-rules.md
1 parent ca6c0d7 commit 54f80af

File tree

1 file changed

+38
-43
lines changed

1 file changed

+38
-43
lines changed

defender-xdr/custom-detection-rules.md

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,33 @@ Custom detection rules are rules you can design and tweak using [advanced huntin
3030

3131
## Required permissions for managing custom detections
3232

33+
> [!IMPORTANT]
34+
> Microsoft recommends that you use roles with the fewest permissions. This helps improve security for your organization. Global Administrator is a highly privileged role that should be limited to emergency scenarios when you can't use an existing role.
35+
3336
To manage custom detections, you need to be assigned one of these roles:
3437

35-
- **Security settings (manage)**—Users with this [Microsoft Defender XDR permission](manage-rbac.md) can manage security settings in the Microsoft Defender portal.
36-
- **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.
38+
- **Security settings (manage)** — Users with this [Microsoft Defender XDR permission](manage-rbac.md) can manage security settings in the Microsoft Defender portal.
3739

38-
- **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.
40+
- **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.
41+
42+
- **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.
3943

4044
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.
4145

4246
Likewise, since the `IdentityLogonEvents` table holds authentication activity information from both Microsoft Defender for Cloud Apps and Defender for Identity, you need to have manage permissions for both services to manage custom detections querying the said table.
4347

4448
> [!NOTE]
45-
> To manage custom detections, **security operators** will need the **manage security settings** permission in Microsoft Defender for Endpoint if RBAC is turned on.
49+
> To manage custom detections, Security Operators must have the Manage Security Settings permission in Microsoft Defender for Endpoint if RBAC is turned on.
50+
51+
To manage required permissions, a Global Administrator can:
4652

47-
To manage required permissions, a **global administrator** can:
53+
- Assign the Security Administrator or Security Operator role in [Microsoft 365 admin center](https://admin.microsoft.com/) under **Roles** \> **Security Administrator**.
4854

49-
- Assign the **security administrator** or **security operator** role in [Microsoft 365 admin center](https://admin.microsoft.com/) under **Roles** \> **Security admin**.
5055
- Check RBAC settings for Microsoft Defender for Endpoint in [Microsoft Defender XDR](https://security.microsoft.com/) under **Settings** \> **Permissions** > **Roles**. Select the corresponding role to assign the **manage security settings** permission.
5156

5257
> [!NOTE]
5358
> A user also needs to have the appropriate permissions for the devices in the [device scope](#5-set-the-rule-scope) of a custom detection rule that they are creating or editing before they can proceed. A user can't edit a custom detection rule that is scoped to run on all devices, if the same user does not permissions for all devices.
5459
55-
56-
5760
## Create a custom detection rule
5861

5962
### 1. Prepare the query
@@ -111,31 +114,30 @@ DeviceEvents
111114

112115
With the query in the query editor, select **Create detection rule** and specify the following alert details:
113116

114-
- **Detection name**name of the detection rule; should be unique
115-
- **Frequency**interval for running the query and taking action. [See more guidance in the rule frequency section](#rule-frequency)
116-
- **Alert title**title displayed with alerts triggered by the rule; should be unique
117-
- **Severity**potential risk of the component or activity identified by the rule
118-
- **Category**threat component or activity identified by the rule
119-
- **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
120-
- **Description**more information about the component or activity identified by the rule
121-
- **Recommended actions**additional actions that responders might take in response to an alert
117+
- **Detection name**name of the detection rule; should be unique
118+
- **Frequency**interval for running the query and taking action. [See more guidance in the rule frequency section](#rule-frequency)
119+
- **Alert title**title displayed with alerts triggered by the rule; should be unique
120+
- **Severity**potential risk of the component or activity identified by the rule
121+
- **Category**threat component or activity identified by the rule
122+
- **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
123+
- **Description**more information about the component or activity identified by the rule
124+
- **Recommended actions**additional actions that responders might take in response to an alert
122125

123126
#### Rule frequency
124127

125128
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:
126129

127-
- **Every 24 hours**runs every 24 hours, checking data from the past 30 days
128-
- **Every 12 hours**runs every 12 hours, checking data from the past 48 hours
129-
- **Every 3 hours**runs every 3 hours, checking data from the past 12 hours
130-
- **Every hour**runs hourly, checking data from the past 4 hours
131-
- **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)
130+
- **Every 24 hours**runs every 24 hours, checking data from the past 30 days
131+
- **Every 12 hours**runs every 12 hours, checking data from the past 48 hours
132+
- **Every 3 hours**runs every 3 hours, checking data from the past 12 hours
133+
- **Every hour**runs hourly, checking data from the past 4 hours
134+
- **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)
132135

133136
> [!TIP]
134137
> Match the time filters in your query with the lookback duration. Results outside of the lookback duration are ignored.
135138
136139
When you edit a rule, it will run with the applied changes in the next run time scheduled according to the frequency you set. The rule frequency is based on the event timestamp and not the ingestion time.
137140

138-
139141
##### Continuous (NRT) frequency
140142

141143
Setting a custom detection to run in Continuous (NRT) frequency allows you to increase your organization's ability to identify threats faster.
@@ -180,8 +182,6 @@ Near real-time detections are supported for the following tables:
180182
> [!NOTE]
181183
> Only columns that are generally available can support **Continuous (NRT)** frequency.
182184
183-
184-
185185
### 3. Choose the impacted entities
186186

187187
Identify the columns in your query results where you expect to find the main affected or impacted entity. For example, a query might return sender (`SenderFromAddress` or `SenderMailFromAddress`) and recipient (`RecipientEmailAddress`) addresses. Identifying which of these columns represent the main impacted entity helps the service aggregate relevant alerts, correlate incidents, and target response actions.
@@ -198,11 +198,11 @@ Your custom detection rule can automatically take actions on devices, files, use
198198

199199
These actions are applied to devices in the `DeviceId` column of the query results:
200200

201-
- **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)
202-
- **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)
203-
- **Run antivirus scan**performs a full Microsoft Defender Antivirus scan on the device
204-
- **Initiate investigation**initiates an [automated investigation](m365d-autoir.md) on the device
205-
- **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)
201+
- **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)
202+
- **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)
203+
- **Run antivirus scan**performs a full Microsoft Defender Antivirus scan on the device
204+
- **Initiate investigation**initiates an [automated investigation](m365d-autoir.md) on the device
205+
- **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)
206206

207207
#### Actions on files
208208

@@ -227,10 +227,8 @@ For more details on user actions, read [Remediation actions in Microsoft Defende
227227

228228
- 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**).
229229

230-
231230
The columns `NetworkMessageId` and `RecipientEmailAddress` must be present in the output results of the query to apply actions to email messages.
232231

233-
234232
### 5. Set the rule scope
235233

236234
Set the scope to specify which devices are covered by the rule. The scope influences rules that check devices and doesn't affect rules that check only mailboxes and user accounts or identities.
@@ -245,8 +243,6 @@ Only data from devices in the scope will be queried. Also, actions are taken onl
245243
> [!NOTE]
246244
> Users are able to create or edit a custom detection rule only if they have the corresponding permissions for the devices included in the scope of the rule. For instance, admins can only create or edit rules that are scoped to all device groups if they have permissions for all device groups.
247245
248-
249-
250246
### 6. Review and turn on the rule
251247

252248
After reviewing the rule, select **Create** to save it. The custom detection rule immediately runs. It runs again based on configured frequency to check for matches, generate alerts, and take response actions.
@@ -267,10 +263,10 @@ You can view the list of existing custom detection rules, check their previous r
267263

268264
To view all existing custom detection rules, navigate to **Hunting** > **Custom detection rules**. The page lists all the rules with the following run information:
269265

270-
- **Last run**when a rule was last run to check for query matches and generate alerts
271-
- **Last run status**whether a rule ran successfully
272-
- **Next run**the next scheduled run
273-
- **Status**whether a rule has been turned on or off
266+
- **Last run**when a rule was last run to check for query matches and generate alerts
267+
- **Last run status**whether a rule ran successfully
268+
- **Next run**the next scheduled run
269+
- **Status**whether a rule has been turned on or off
274270

275271
### View rule details, modify rule, and run rule
276272

@@ -280,12 +276,11 @@ To view comprehensive information about a custom detection rule, go to **Hunting
280276

281277
You can also take the following actions on the rule from this page:
282278

283-
- **Run**—run the rule immediately. This also resets the interval for the next run.
284-
- **Edit**—modify the rule without changing the query
285-
- **Modify query**—edit the query in advanced hunting
286-
- **Turn on** / **Turn off**—enable the rule or stop it from running
287-
- **Delete**—turn off the rule and remove it
288-
279+
- **Run** — run the rule immediately. This also resets the interval for the next run.
280+
- **Edit** — modify the rule without changing the query
281+
- **Modify query** — edit the query in advanced hunting
282+
- **Turn on** / **Turn off** — enable the rule or stop it from running
283+
- **Delete** — turn off the rule and remove it
289284

290285
### View and manage triggered alerts
291286

0 commit comments

Comments
 (0)