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: articles/sentinel/sentinel-analytic-rules-creation.md
+78-75Lines changed: 78 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ ms.date: 1/27/2025
12
12
13
13
# Create and publish analytics rules for Microsoft Sentinel solutions
14
14
15
-
Microsoft Sentinel analytics rules are sets of criteria. They define how data is monitored, what is detected, and what actions are taken when specific conditions are met. These rules help identify suspicious behavior, anomalies, and potential security threats by analyzing logs and signals from various data sources.
15
+
Microsoft Sentinel analytics rules are sets of criteria. They define how data is monitored, what's detected, and what actions are taken when specific conditions are met. These rules help identify suspicious behavior, anomalies, and potential security threats by analyzing logs and signals from various data sources.
16
16
17
-
Microsoft Sentinel analytics rules are powerful tools for enhancing an organization's security posture because they proactively detect and respond to potential threats. By following a structured approach to creating and managing these rules, organizations can use Microsoft Sentinel's capabilities to protect their digital assets and maintain a robust security infrastructure. For more information, see [Threat detection in Microsoft Sentinel](/azure/sentinel/threat-detection).
17
+
Microsoft Sentinel analytics rules are powerful tools for enhancing an organization's security posture because they proactively detect and respond to potential threats. By following a structured approach to creating and managing these rules, organizations can use the capabilities of Microsoft Sentinel to protect their digital assets and maintain a robust security infrastructure. For more information, see [Threat detection in Microsoft Sentinel](/azure/sentinel/threat-detection).
18
18
19
19
This article walks you through the process of creating and publishing analytics rules to Microsoft Sentinel solutions.
20
20
@@ -37,7 +37,7 @@ Microsoft Sentinel analytics rules can be applied to a wide range of scenarios t
37
37
38
38
You create analytics rules in [YAML](https://yaml.org/) format. You can use this example of an analytics rule as a reference to create your own queries: [Sample analytics rule in GitHub](https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft%20Entra%20ID/Analytic%20Rules/FailedLogonToAzurePortal.yaml).
39
39
40
-
In this section, we provide a detailed walkthrough of various attributes of an analytics rule.
40
+
The following sections provide a detailed walkthrough of various attributes of an analytics rule.
41
41
42
42
### ID
43
43
@@ -55,25 +55,25 @@ This field is mandatory.
55
55
56
56
### Name
57
57
58
-
The `name` attribute provides a brief label that summarizes the detection. Make sure the label is clear and concise to help users understand the purpose of the rule. Use `alertDetailsOverride` to generate dynamic names to help analysts understand the alert. See the following requirements:
58
+
The `name` attribute provides a brief label that summarizes the detection. Make sure the label is clear and concise to help users understand the purpose of the rule. Use `alertDetailsOverride` to generate dynamic names to help analysts understand the alert. This attribute:
59
59
60
-
* Uses sentence-case capitalization
61
-
* Doesn't end in a period
62
-
* Has a maximum length of 50 characters (whenever possible)
60
+
* Uses sentence-case capitalization.
61
+
* Doesn't end in a period.
62
+
* Has a maximum length of 50 characters (whenever possible).
63
63
64
64
This field is mandatory.
65
65
66
66
### Description
67
67
68
-
The `description` attribute provides a detailed description of the detection. The description includes information about the behavior being detected, the potential effect, and any recommended actions. See the following requirements:
68
+
The `description` attribute provides a detailed description of the detection. The description includes information about the behavior being detected, the potential effect, and any recommended actions. This attribute:
69
69
70
-
* Uses sentence case capitalization
71
-
* Starts with "This query searches for" or "Identifies"
72
-
* Is different from and more descriptive than the name field
73
-
* Has a maximum length of 255 characters
74
-
* Is five sentences or less
75
-
* Doesn't describe the data source (connector or data type)
76
-
* Doesn't provide a technical explanation for the query language
70
+
* Uses sentence case capitalization.
71
+
* Starts with "This query searches for" or "Identifies."
72
+
* Is different from and more descriptive than the name field.
73
+
* Has a maximum length of 255 characters.
74
+
* Is five sentences or less.
75
+
* Doesn't describe the data source (connector or data type).
76
+
* Doesn't provide a technical explanation for the query language.
77
77
78
78
This field is mandatory.
79
79
@@ -99,31 +99,31 @@ The `dataTypes` attribute represents the data types that the analytics rule depe
99
99
100
100
### Query period
101
101
102
-
The `queryPeriod` attribute represents a specified period during which the query runs. For example: the last three days.
102
+
The `queryPeriod` attribute represents a specified period during which the query runs. For example: the last 3 days. For this attribute:
103
103
104
-
* Use Kusto Query Language (KQL) `TimeSpan` format (for example, three days is `3d`, 2 hours is `2h`).
104
+
* Use Kusto Query Language (KQL) `TimeSpan` format (for example, 3 days is `3d`, 2 hours is `2h`).
105
105
* Ensure that any learning or reference period is within this time frame.
106
106
* Don't use a value higher than the maximum supported value, which is `14d`.
107
107
108
108
This field is mandatory for scheduled analytics rules.
109
109
110
110
### Query frequency
111
111
112
-
The `queryFrequency` attribute represents the frequency at which the query runs.
112
+
The `queryFrequency` attribute represents the frequency at which the query runs. For this attribute:
113
113
114
-
* Use KQL `TimeSpan` format (for example, three days is `3d`, 2 hours is `2h`).
114
+
* Use KQL `TimeSpan` format (for example, 3 days is `3d`, 2 hours is `2h`).
115
115
* Use a `queryFrequency` that is less than or equal to the `queryPeriod`.
116
-
* Follow this rule: if the `queryPeriod` is greater than or equal to two days (`2d`), the `queryFrequency` value can't be less than 1 hour (`1h`) and is only used for high-severity detections.
116
+
* Follow this rule: if the `queryPeriod` is greater than or equal to 2 days (`2d`), the `queryFrequency` value can't be less than 1 hour (`1h`) and is only used for high-severity detections.
117
117
118
118
This field is mandatory for scheduled analytics rules.
119
119
120
120
### Trigger operator
121
121
122
122
The `triggerOperator` attribute indicates the mechanism that triggers the alert. For example: greater than (`gt`) the number set in the `triggerThreshold` attribute (see [Trigger threshold](#trigger-threshold)).
123
123
124
-
*`gt`: Greater than
125
-
*`lt`: Less than
126
-
*`eq`: Equal to
124
+
*`gt`: Greater than.
125
+
*`lt`: Less than.
126
+
*`eq`: Equal to.
127
127
128
128
This field is mandatory for scheduled analytics rules.
129
129
@@ -137,7 +137,7 @@ This field is mandatory for scheduled analytics rules.
137
137
138
138
### Tactics
139
139
140
-
The `tactics` attribute defines the [`MITRE ATT&CK tactics`](https://attack.mitre.org/versions/v13/matrices/enterprise/) that the detection relates to. When you define the tactics, it helps users understand the context of the detection and how it fits into the overall threat landscape.
140
+
The `tactics` attribute defines the [`MITRE ATT&CK tactics`](https://attack.mitre.org/versions/v13/matrices/enterprise/) that the detection relates to. When you define the tactics, it helps users understand the context of the detection and how it fits into the overall threat landscape. For this attribute:
141
141
142
142
*`ATT&CK Framework v13` is supported.
143
143
* Names can't include spaces. For example: `InitialAccess` or `LateralMovement`.
@@ -146,17 +146,17 @@ This field is mandatory.
146
146
147
147
### Relevant techniques
148
148
149
-
The `relevantTechniques` attribute defines the [`MITRE ATT&CK techniques`](https://attack.mitre.org/versions/v13/matrices/enterprise/) that the detection relates to. When you define the techniques, it helps users understand the context of the detection and how it fits into the overall threat landscape.
149
+
The `relevantTechniques` attribute defines the [`MITRE ATT&CK techniques`](https://attack.mitre.org/versions/v13/matrices/enterprise/) that the detection relates to. When you define the techniques, it helps users understand the context of the detection and how it fits into the overall threat landscape. For this attribute:
150
150
151
151
*`ATT&CK Framework v13` is supported.
152
-
*It matches `MITRE` tactics.
152
+
*Attribute matches `MITRE` tactics.
153
153
* Names can't include spaces. For example: `T1078` or `T1078.001`.
154
154
155
155
This field is mandatory.
156
156
157
157
### Query
158
158
159
-
The `query` attribute defines the detection logic. We recommend that you write the query in KQL and make sure that it's well-structured and easy to understand. We recommend that you create an efficient query that's optimized for performance to ensure it can be run against large datasets without affecting performance. Make sure that your query meets the following criteria.
159
+
The `query` attribute defines the detection logic. We recommend that you write the query in KQL and make sure that it's structured and easy to understand. We recommend that you create an efficient query that's optimized for performance to ensure it can be run against large datasets without affecting performance. Make sure that your query meets the following criteria.
160
160
161
161
Limit the query to 10,000 characters. If the query section exceeds this limit, consider reducing the number of characters. A static list of items used for comparison within the query body can cause you to go over the limit. We recommend that you move these lists to one of the following options:
162
162
@@ -176,8 +176,9 @@ Define human-readable names for explicit constants:
176
176
We highly recommend that you use comments to clarify the query. Avoid adding comments at the end of a query statement line. Instead, add your comments on a separate line. For example:
177
177
178
178
```
179
-
// Removing noisy processes for an environment, adjust as needed
179
+
// Removing noisy processes for an environment, adjust as needed
180
180
```
181
+
181
182
If you're referencing a parser instead of a table name, ensure clarity in the description by including a comment next to the parser function reference. The parser must be imported into the workspace first. Otherwise, the queries don't recognize it as valid.
182
183
183
184
Ensure that every available entity field is returned for mapping purposes. (Refer to the [Entity mappings section](#entity-mappings).) Sanitize the returned table so that it provides only the properties that you need to investigate further. You don't need a `TimeGenerated` filter when you use a simple `lookback` command across the entire query. The `queryPeriod` value in the YAML controls this process.
@@ -195,16 +196,18 @@ This field is mandatory.
195
196
The `eventGroupingSettings` attribute relates to alerts. An alert rule can generate a separate alert for each query result. For instance, a rule that identifies non-Microsoft alerts in the event stream could create a Microsoft Sentinel alert for each source alert.
196
197
197
198
* To produce a single alert for all query results (the default), use:
198
-
```json
199
-
eventGroupingSettings:
200
-
aggregationKind: SingleAlert
201
-
```
199
+
200
+
```json
201
+
eventGroupingSettings:
202
+
aggregationKind: SingleAlert
203
+
```
202
204
203
205
* To produce a separate alert for each query result, use:
204
-
```json
205
-
eventGroupingSettings:
206
-
aggregationKind: AlertPerResult
207
-
```
206
+
207
+
```json
208
+
eventGroupingSettings:
209
+
aggregationKind: AlertPerResult
210
+
```
208
211
209
212
### Entity mappings
210
213
@@ -216,40 +219,40 @@ This field is mandatory.
216
219
217
220
### Field mappings
218
221
219
-
The `fieldMappings` attribute represents the identifier of the field in the query output that corresponds to the entity type. See allowed values under the identifiers column value at [Entity mapping table](/azure/sentinel/entities-reference#entity-types-and-identifiers).
222
+
The `fieldMappings` attribute represents the identifier of the field in the query output that corresponds to the entity type. See allowed values under the identifiers column value at [Entity mapping table](/azure/sentinel/entities-reference#entity-types-and-identifiers). For this attribute:
220
223
221
224
* Each template can have up to 10 entity mappings.
222
225
* Each entity mapping can have up to three field mappings (that is, identifiers).
223
226
224
-
```json
225
-
entityMappings:
226
-
- entityType: Account
227
-
fieldMappings:
228
-
- identifier: FullName
229
-
columnName: AccountCustomEntity
230
-
- entityType: Host
231
-
fieldMappings:
232
-
- identifier: FullName
233
-
columnName: HostCustomEntity
234
-
- entityType: IP
235
-
fieldMappings:
236
-
- identifier: Address
237
-
columnName: ClientIP
238
-
- entityType: DNS
239
-
fieldMappings:
240
-
- identifier: DomainName
241
-
columnName: Name
242
-
243
-
```
227
+
```json
228
+
entityMappings:
229
+
- entityType: Account
230
+
fieldMappings:
231
+
- identifier: FullName
232
+
columnName: AccountCustomEntity
233
+
- entityType: Host
234
+
fieldMappings:
235
+
- identifier: FullName
236
+
columnName: HostCustomEntity
237
+
- entityType: IP
238
+
fieldMappings:
239
+
- identifier: Address
240
+
columnName: ClientIP
241
+
- entityType: DNS
242
+
fieldMappings:
243
+
- identifier: DomainName
244
+
columnName: Name
245
+
246
+
```
244
247
245
248
### Custom details
246
249
247
250
The `customDetails` attribute integrates event data into alerts, making it visible in security incidents for faster triaging, investigation, and response. Custom details are key/value pairs of property and column names. For more information, see [Surface custom event details in alerts in Microsoft Sentinel](/azure/sentinel/surface-custom-details-in-alerts). Up to 20 custom details (that is, key/value pairs) can be defined per template.
248
251
249
252
```json
250
-
customDetails:
251
-
Computers: Computer
252
-
IPs: ComputerIP
253
+
customDetails:
254
+
Computers: Computer
255
+
IPs: ComputerIP
253
256
```
254
257
255
258
### Alert details override
@@ -260,25 +263,25 @@ The `alertDetailsOverride` attribute is a dynamic field that you can use to over
260
263
* The `name` must not exceed 256 characters, while the `description` is limited to 5,000 characters.
261
264
* The column name within the curly braces must precisely match the expected column name, without any leading or trailing white space (for example, `{{columnName}}`, not `{{ columnName }}`). In the following example, `columnName1`, `columnName2`, `dynamicTactic`, and `dynamicSeverity` are output fields of the scheduled alert query.
262
265
263
-
```json
264
-
alertDetailsOverride:
265
-
alertDisplayNameFormat: free text with field names embedded using the format {{columnName}} # Up to 256 chars and 3 placeholders
266
-
alertDescriptionFormat: free text with field names embedded using the format {{columnName}} # Up to 5000 chars and 3 placeholders
alertDisplayNameFormat: rule {{columnName1}} display name
275
-
alertDescriptionFormat: rule {{columnName2}} display name
276
-
alertTacticsColumnName: dynamicTactic
277
-
alertSeverityColumnName: dynamicSeverity
278
-
```
275
+
```json
276
+
alertDetailsOverride:
277
+
alertDisplayNameFormat: rule {{columnName1}} display name
278
+
alertDescriptionFormat: rule {{columnName2}} display name
279
+
alertTacticsColumnName: dynamicTactic
280
+
alertSeverityColumnName: dynamicSeverity
281
+
```
279
282
280
283
### Version
281
284
282
-
When a customer creates a new hunting query from the template, the template `version` is saved. If a new template version is published, customers are notified in the UX. Versions follow the format a, b, and c, in which a is the major version, b is the minor version, and c is the patch. The version field is the last line of the template.
285
+
When a customer creates a new hunting query from the template, the template `version` is saved. If a new template version is published, customers are notified in the UX. Versions follow the format `a`, `b`, and `c`, in which `a` is the major version, `b` is the minor version, and `c` is the patch. The version field is the last line of the template.
0 commit comments