你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
- 最新
- 2025-10-01-预览
- 2025-09-01
- 2025-07-01-preview
- 2025-06-01
- 2025-04-01-预览版
- 2025-03-01
- 2025-01-01-预览版
- 2024-10-01-预览版
- 2024-09-01
- 2024-04-01-预览版
- 2024-03-01
- 2024-01-01-预览版
- 2023-12-01-预览版
- 2023-11-01
- 2023-10-01-预览版
- 2023-09-01-预览版
- 2023-08-01-预览版
- 2023-07-01-预览版
- 2023-06-01-预览版
- 2023-05-01-预览版
- 2023-04-01-预览版
- 2023-03-01-预览版
- 2023-02-01
- 2023-02-01-预览版
- 2022-12-01-预览版
- 2022-11-01
- 2022-11-01-预览版
- 2022-10-01-预览版
- 2022-09-01-预览版
- 2022-08-01
- 2022-08-01-预览版
- 2022-07-01-预览版
- 2022-06-01-预览版
- 2022-05-01-预览版
- 2022-04-01-预览版
- 2022-01-01-预览版
- 2021-10-01
- 2021-10-01-预览版
- 2021-09-01-预览版
- 2021-03-01-预览版
- 2020-01-01
- 2019-01-01-预览版
Bicep 资源定义
可以使用目标操作部署 alertRules 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
用法示例
Bicep 示例
部署 Sentinel 警报规则的基本示例。
param resourceName string = 'acctest0001'
param location string = 'westeurope'
resource workspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: resourceName
location: location
properties: {
features: {
disableLocalAuth: false
enableLogAccessUsingOnlyResourcePermissions: true
}
publicNetworkAccessForIngestion: 'Enabled'
publicNetworkAccessForQuery: 'Enabled'
retentionInDays: 30
sku: {
name: 'PerGB2018'
}
workspaceCapping: {
dailyQuotaGb: -1
}
}
}
resource onboardingState 'Microsoft.SecurityInsights/onboardingStates@2023-06-01-preview' = {
name: 'default'
scope: workspace
properties: {
customerManagedKey: false
}
}
resource alertRule 'Microsoft.SecurityInsights/alertRules@2022-10-01-preview' = {
name: resourceName
scope: workspace
dependsOn: [
onboardingState
]
kind: 'NRT'
properties: {
description: ''
displayName: 'Some Rule'
enabled: true
query: '''AzureActivity |
where OperationName == "Create or Update Virtual Machine" or OperationName =="Create Deployment" |
where ActivityStatus == "Succeeded" |
make-series dcount(ResourceId) default=0 on EventSubmissionTimestamp in range(ago(7d), now(), 1d) by Caller
'''
severity: 'High'
suppressionDuration: 'PT5H'
suppressionEnabled: false
tactics: []
techniques: []
}
}
资源格式
若要创建 Microsoft.SecurityInsights/alertRules 资源,请将以下 Bicep 添加到模板。
resource symbolicname 'Microsoft.SecurityInsights/alertRules@2024-03-01' = {
etag: 'string'
name: 'string'
kind: 'string'
// For remaining properties, see Microsoft.SecurityInsights/alertRules objects
}
Microsoft.SecurityInsights/alertRules 对象
设置 类型 属性以指定对象的类型。
对于 Fusion,请使用:
{
kind: 'Fusion'
properties: {
alertRuleTemplateName: 'string'
enabled: bool
}
}
对于 MicrosoftSecurityIncidentCreation,请使用:
{
kind: 'MicrosoftSecurityIncidentCreation'
properties: {
alertRuleTemplateName: 'string'
description: 'string'
displayName: 'string'
displayNamesExcludeFilter: [
'string'
]
displayNamesFilter: [
'string'
]
enabled: bool
productFilter: 'string'
severitiesFilter: [
'string'
]
}
}
对于 计划,请使用:
{
kind: 'Scheduled'
properties: {
alertDetailsOverride: {
alertDescriptionFormat: 'string'
alertDisplayNameFormat: 'string'
alertDynamicProperties: [
{
alertProperty: 'string'
value: 'string'
}
]
alertSeverityColumnName: 'string'
alertTacticsColumnName: 'string'
}
alertRuleTemplateName: 'string'
customDetails: {
{customized property}: 'string'
}
description: 'string'
displayName: 'string'
enabled: bool
entityMappings: [
{
entityType: 'string'
fieldMappings: [
{
columnName: 'string'
identifier: 'string'
}
]
}
]
eventGroupingSettings: {
aggregationKind: 'string'
}
incidentConfiguration: {
createIncident: bool
groupingConfiguration: {
enabled: bool
groupByAlertDetails: [
'string'
]
groupByCustomDetails: [
'string'
]
groupByEntities: [
'string'
]
lookbackDuration: 'string'
matchingMethod: 'string'
reopenClosedIncident: bool
}
}
query: 'string'
queryFrequency: 'string'
queryPeriod: 'string'
severity: 'string'
suppressionDuration: 'string'
suppressionEnabled: bool
tactics: [
'string'
]
techniques: [
'string'
]
templateVersion: 'string'
triggerOperator: 'string'
triggerThreshold: int
}
}
属性值
Microsoft.SecurityInsights/alertRules
| 名字 | 描述 | 价值 |
|---|---|---|
| ETAG | Azure 资源的 Etag | 字符串 |
| 类 | 对于 fusionAlertRule |
“Fusion” “MicrosoftSecurityIncidentCreation” “Scheduled”(必需) |
| 名字 | 资源名称 | string (必需) |
| 作用域 | 在与部署范围不同的范围内创建资源时使用。 | 将此属性设置为资源的符号名称,以应用 扩展资源。 |
AlertDetailsOverride
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDescriptionFormat | 包含列名称的格式,用于替代警报说明 | 字符串 |
| alertDisplayNameFormat | 包含列名称的格式,用于替代警报名称 | 字符串 |
| alertDynamicProperties | 要重写的其他动态属性的列表 | AlertPropertyMapping[] |
| alertSeverityColumnName | 要从中获取警报严重性的列名称 | 字符串 |
| alertTacticsColumnName | 要从中获取警报策略的列名称 | 字符串 |
AlertPropertyMapping
| 名字 | 描述 | 价值 |
|---|---|---|
| alert属性 | V3 警报属性 | “AlertLink” “ConfidenceLevel” “ConfidenceScore” “ExtendedLinks” “ProductComponentName” “ProductName” “ProviderName” “RemediationSteps” “技术” |
| 价值 | 用于重写此属性的列名 | 字符串 |
实体映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 实体类型 | 映射实体的 V3 类型 | “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| fieldMappings 字段映射 | 给定实体映射的字段映射数组 | FieldMapping[] |
EventGroupingSettings
| 名字 | 描述 | 价值 |
|---|---|---|
| aggregationKind | 事件分组聚合类型 | “AlertPerResult” “SingleAlert” |
FieldMapping 字段映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 列名称 | 要映射到标识符的列名 | 字符串 |
| 标识符 | 实体的 V3 标识符 | 字符串 |
FusionAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Fusion”(必需) |
| 性能 | Fusion 警报规则属性 | FusionAlertRule属性 |
FusionAlertRule属性
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
GroupingConfiguration
| 名字 | 描述 | 价值 |
|---|---|---|
| 启用 | 已启用分组 | bool (必需) |
| groupByAlertDetails | 要分组依据的警报详细信息列表(选中匹配Method 时) | 包含任一项的字符串数组: “DisplayName” “严重性” |
| groupByCustomDetails | 要分组依据的自定义详细信息键列表(如果已选中匹配Method)。 只能使用当前警报规则中定义的密钥。 | 字符串[] |
| groupByEntities | 要分组依据的实体类型列表(如果已选中 matchingMethod)。 只能使用在当前警报规则中定义的实体。 | 包含任一项的字符串数组: “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| lookbackDuration | 将组限制为在回溯持续时间内创建的警报(采用 ISO 8601 持续时间格式) | string (必需) |
| 匹配方法 | 分组匹配方法。 当方法为 Selected 至少一个 groupByEntities 时,必须提供 groupByAlertDetails、groupByCustomDetails,而不是空。 | “AllEntities” “AnyAlert” “Selected”(必需) |
| reopenClosedIncident 事件 | 重新打开关闭的匹配事件 | bool (必需) |
事件配置
| 名字 | 描述 | 价值 |
|---|---|---|
| createIncident 事件 | 基于此分析规则触发的警报创建事件 | bool (必需) |
| groupingConfiguration | 设置此分析规则触发的警报如何分组到事件中 | GroupingConfiguration |
MicrosoftSecurityIncidentCreationAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “MicrosoftSecurityIncidentCreation”(必需) |
| 性能 | MicrosoftSecurityIncidentCreation 规则属性 | MicrosoftSecurityIncidentCreationAlertRuleProperties |
MicrosoftSecurityIncidentCreationAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| displayNamesExcludeFilter | 不生成事例的警报的 displayNames | 字符串[] |
| displayNamesFilter | 警报的 displayNames,将生成事例 | 字符串[] |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| product过滤器 | 警报的 productName,将生成事例 | “Azure Active Directory 标识保护” “Azure 高级威胁防护” “适用于 IoT 的 Azure 安全中心” “Azure 安全中心” “Microsoft Cloud App Security”(必需) |
| severitiesFilter | 警报的严重性,将生成事例 | 包含任一项的字符串数组: “High” “Informational” “Low” “Medium” |
ScheduledAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Scheduled”(必需) |
| 性能 | 计划的警报规则属性 | ScheduledAlertRuleProperties |
ScheduledAlertRuleCommonPropertiesCustomDetails
| 名字 | 描述 | 价值 |
|---|
ScheduledAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDetailsOverride | 警报详细信息替代设置 | AlertDetailsOverride |
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 自定义详细信息 | 要附加到警报的列的字符串键值对字典 | ScheduledAlertRuleCommonPropertiesCustomDetails |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| 实体映射 | 警报规则实体映射的数组 | 实体映射[] |
| eventGroupingSettings | 事件分组设置。 | EventGroupingSettings |
| incidentConfiguration 事件配置 | 通过此分析规则触发的警报创建的事件的设置 | 事件配置 |
| 查询 | 为此规则创建警报的查询。 | 字符串 |
| 查询频率 | 要运行此警报规则的频率(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 查询周期 | 此警报规则查看的时间段(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 严厉 | 此警报规则创建的警报的严重性。 | “High” “Informational” “Low” “Medium” |
| suppressionDuration | 自上次触发此警报规则以来,抑制(采用 ISO 8601 持续时间格式)等待。 | string (必需) |
| suppression已启用 | 确定此警报规则的抑制是启用或禁用的。 | bool (必需) |
| 策略 | 警报规则的策略 | 包含任一项的字符串数组: “Collection” “CommandAndControl” “CredentialAccess” “DefenseEvasion” “发现” “执行” “外泄” “影响” “ImpairProcessControl” “InhibitResponseFunction” “InitialAccess” “LateralMovement” “持久性” “PreAttack” “PrivilegeEscalation” “侦查” “ResourceDevelopment” |
| 技术 | 警报规则的技术 | 字符串[] |
| templateVersion (模板版本) | 用于创建此规则的警报规则模板的版本 - 格式 <a.b.c>,其中都是数字,例如 0 <1.0.2> | 字符串 |
| triggerOperator | 针对触发警报规则的阈值的操作。 | “Equal” “GreaterThan” “LessThan” “NotEqual” |
| triggerThreshold 触发阈值 | 阈值触发此警报规则。 | 整数 (int) |
ARM 模板资源定义
可以使用目标操作部署 alertRules 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
用法示例
Azure 快速入门模板
以下 Azure 快速入门模板 部署此资源类型。
| 模板 | 描述 |
|---|---|
|
创建新的Microsoft Sentinel 计划分析规则 |
此示例演示如何在 Microsoft Sentinel 中创建新的计划分析规则 |
资源格式
若要创建 Microsoft.SecurityInsights/alertRules 资源,请将以下 JSON 添加到模板。
{
"etag": "string",
"name": "string",
"kind": "string"
// For remaining properties, see Microsoft.SecurityInsights/alertRules objects
}
Microsoft.SecurityInsights/alertRules 对象
设置 类型 属性以指定对象的类型。
对于 Fusion,请使用:
{
"kind": "Fusion",
"properties": {
"alertRuleTemplateName": "string",
"enabled": "bool"
}
}
对于 MicrosoftSecurityIncidentCreation,请使用:
{
"kind": "MicrosoftSecurityIncidentCreation",
"properties": {
"alertRuleTemplateName": "string",
"description": "string",
"displayName": "string",
"displayNamesExcludeFilter": [ "string" ],
"displayNamesFilter": [ "string" ],
"enabled": "bool",
"productFilter": "string",
"severitiesFilter": [ "string" ]
}
}
对于 计划,请使用:
{
"kind": "Scheduled",
"properties": {
"alertDetailsOverride": {
"alertDescriptionFormat": "string",
"alertDisplayNameFormat": "string",
"alertDynamicProperties": [
{
"alertProperty": "string",
"value": "string"
}
],
"alertSeverityColumnName": "string",
"alertTacticsColumnName": "string"
},
"alertRuleTemplateName": "string",
"customDetails": {
"{customized property}": "string"
},
"description": "string",
"displayName": "string",
"enabled": "bool",
"entityMappings": [
{
"entityType": "string",
"fieldMappings": [
{
"columnName": "string",
"identifier": "string"
}
]
}
],
"eventGroupingSettings": {
"aggregationKind": "string"
},
"incidentConfiguration": {
"createIncident": "bool",
"groupingConfiguration": {
"enabled": "bool",
"groupByAlertDetails": [ "string" ],
"groupByCustomDetails": [ "string" ],
"groupByEntities": [ "string" ],
"lookbackDuration": "string",
"matchingMethod": "string",
"reopenClosedIncident": "bool"
}
},
"query": "string",
"queryFrequency": "string",
"queryPeriod": "string",
"severity": "string",
"suppressionDuration": "string",
"suppressionEnabled": "bool",
"tactics": [ "string" ],
"techniques": [ "string" ],
"templateVersion": "string",
"triggerOperator": "string",
"triggerThreshold": "int"
}
}
属性值
Microsoft.SecurityInsights/alertRules
| 名字 | 描述 | 价值 |
|---|---|---|
| apiVersion | API 版本 | '2024-03-01' |
| ETAG | Azure 资源的 Etag | 字符串 |
| 类 | 对于 fusionAlertRule |
“Fusion” “MicrosoftSecurityIncidentCreation” “Scheduled”(必需) |
| 名字 | 资源名称 | string (必需) |
| 类型 | 资源类型 | “Microsoft.SecurityInsights/alertRules” |
AlertDetailsOverride
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDescriptionFormat | 包含列名称的格式,用于替代警报说明 | 字符串 |
| alertDisplayNameFormat | 包含列名称的格式,用于替代警报名称 | 字符串 |
| alertDynamicProperties | 要重写的其他动态属性的列表 | AlertPropertyMapping[] |
| alertSeverityColumnName | 要从中获取警报严重性的列名称 | 字符串 |
| alertTacticsColumnName | 要从中获取警报策略的列名称 | 字符串 |
AlertPropertyMapping
| 名字 | 描述 | 价值 |
|---|---|---|
| alert属性 | V3 警报属性 | “AlertLink” “ConfidenceLevel” “ConfidenceScore” “ExtendedLinks” “ProductComponentName” “ProductName” “ProviderName” “RemediationSteps” “技术” |
| 价值 | 用于重写此属性的列名 | 字符串 |
实体映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 实体类型 | 映射实体的 V3 类型 | “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| fieldMappings 字段映射 | 给定实体映射的字段映射数组 | FieldMapping[] |
EventGroupingSettings
| 名字 | 描述 | 价值 |
|---|---|---|
| aggregationKind | 事件分组聚合类型 | “AlertPerResult” “SingleAlert” |
FieldMapping 字段映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 列名称 | 要映射到标识符的列名 | 字符串 |
| 标识符 | 实体的 V3 标识符 | 字符串 |
FusionAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Fusion”(必需) |
| 性能 | Fusion 警报规则属性 | FusionAlertRule属性 |
FusionAlertRule属性
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
GroupingConfiguration
| 名字 | 描述 | 价值 |
|---|---|---|
| 启用 | 已启用分组 | bool (必需) |
| groupByAlertDetails | 要分组依据的警报详细信息列表(选中匹配Method 时) | 包含任一项的字符串数组: “DisplayName” “严重性” |
| groupByCustomDetails | 要分组依据的自定义详细信息键列表(如果已选中匹配Method)。 只能使用当前警报规则中定义的密钥。 | 字符串[] |
| groupByEntities | 要分组依据的实体类型列表(如果已选中 matchingMethod)。 只能使用在当前警报规则中定义的实体。 | 包含任一项的字符串数组: “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| lookbackDuration | 将组限制为在回溯持续时间内创建的警报(采用 ISO 8601 持续时间格式) | string (必需) |
| 匹配方法 | 分组匹配方法。 当方法为 Selected 至少一个 groupByEntities 时,必须提供 groupByAlertDetails、groupByCustomDetails,而不是空。 | “AllEntities” “AnyAlert” “Selected”(必需) |
| reopenClosedIncident 事件 | 重新打开关闭的匹配事件 | bool (必需) |
事件配置
| 名字 | 描述 | 价值 |
|---|---|---|
| createIncident 事件 | 基于此分析规则触发的警报创建事件 | bool (必需) |
| groupingConfiguration | 设置此分析规则触发的警报如何分组到事件中 | GroupingConfiguration |
MicrosoftSecurityIncidentCreationAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “MicrosoftSecurityIncidentCreation”(必需) |
| 性能 | MicrosoftSecurityIncidentCreation 规则属性 | MicrosoftSecurityIncidentCreationAlertRuleProperties |
MicrosoftSecurityIncidentCreationAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| displayNamesExcludeFilter | 不生成事例的警报的 displayNames | 字符串[] |
| displayNamesFilter | 警报的 displayNames,将生成事例 | 字符串[] |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| product过滤器 | 警报的 productName,将生成事例 | “Azure Active Directory 标识保护” “Azure 高级威胁防护” “适用于 IoT 的 Azure 安全中心” “Azure 安全中心” “Microsoft Cloud App Security”(必需) |
| severitiesFilter | 警报的严重性,将生成事例 | 包含任一项的字符串数组: “High” “Informational” “Low” “Medium” |
ScheduledAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Scheduled”(必需) |
| 性能 | 计划的警报规则属性 | ScheduledAlertRuleProperties |
ScheduledAlertRuleCommonPropertiesCustomDetails
| 名字 | 描述 | 价值 |
|---|
ScheduledAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDetailsOverride | 警报详细信息替代设置 | AlertDetailsOverride |
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 自定义详细信息 | 要附加到警报的列的字符串键值对字典 | ScheduledAlertRuleCommonPropertiesCustomDetails |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| 实体映射 | 警报规则实体映射的数组 | 实体映射[] |
| eventGroupingSettings | 事件分组设置。 | EventGroupingSettings |
| incidentConfiguration 事件配置 | 通过此分析规则触发的警报创建的事件的设置 | 事件配置 |
| 查询 | 为此规则创建警报的查询。 | 字符串 |
| 查询频率 | 要运行此警报规则的频率(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 查询周期 | 此警报规则查看的时间段(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 严厉 | 此警报规则创建的警报的严重性。 | “High” “Informational” “Low” “Medium” |
| suppressionDuration | 自上次触发此警报规则以来,抑制(采用 ISO 8601 持续时间格式)等待。 | string (必需) |
| suppression已启用 | 确定此警报规则的抑制是启用或禁用的。 | bool (必需) |
| 策略 | 警报规则的策略 | 包含任一项的字符串数组: “Collection” “CommandAndControl” “CredentialAccess” “DefenseEvasion” “发现” “执行” “外泄” “影响” “ImpairProcessControl” “InhibitResponseFunction” “InitialAccess” “LateralMovement” “持久性” “PreAttack” “PrivilegeEscalation” “侦查” “ResourceDevelopment” |
| 技术 | 警报规则的技术 | 字符串[] |
| templateVersion (模板版本) | 用于创建此规则的警报规则模板的版本 - 格式 <a.b.c>,其中都是数字,例如 0 <1.0.2> | 字符串 |
| triggerOperator | 针对触发警报规则的阈值的操作。 | “Equal” “GreaterThan” “LessThan” “NotEqual” |
| triggerThreshold 触发阈值 | 阈值触发此警报规则。 | 整数 (int) |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署 alertRules 资源类型:
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
用法示例
Terraform 示例
部署 Sentinel 警报规则的基本示例。
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
provider "azapi" {
skip_provider_registration = false
}
variable "resource_name" {
type = string
default = "acctest0001"
}
variable "location" {
type = string
default = "westeurope"
}
resource "azapi_resource" "resourceGroup" {
type = "Microsoft.Resources/resourceGroups@2020-06-01"
name = var.resource_name
location = var.location
}
resource "azapi_resource" "workspace" {
type = "Microsoft.OperationalInsights/workspaces@2022-10-01"
parent_id = azapi_resource.resourceGroup.id
name = var.resource_name
location = var.location
body = {
properties = {
features = {
disableLocalAuth = false
enableLogAccessUsingOnlyResourcePermissions = true
}
publicNetworkAccessForIngestion = "Enabled"
publicNetworkAccessForQuery = "Enabled"
retentionInDays = 30
sku = {
name = "PerGB2018"
}
workspaceCapping = {
dailyQuotaGb = -1
}
}
}
schema_validation_enabled = false
response_export_values = ["*"]
}
resource "azapi_resource" "onboardingState" {
type = "Microsoft.SecurityInsights/onboardingStates@2023-06-01-preview"
parent_id = azapi_resource.workspace.id
name = "default"
body = {
properties = {
customerManagedKey = false
}
}
}
resource "azapi_resource" "alertRule" {
type = "Microsoft.SecurityInsights/alertRules@2022-10-01-preview"
parent_id = azapi_resource.workspace.id
name = var.resource_name
body = {
kind = "NRT"
properties = {
description = ""
displayName = "Some Rule"
enabled = true
query = "AzureActivity |\n where OperationName == \"Create or Update Virtual Machine\" or OperationName ==\"Create Deployment\" |\n where ActivityStatus == \"Succeeded\" |\n make-series dcount(ResourceId) default=0 on EventSubmissionTimestamp in range(ago(7d), now(), 1d) by Caller\n"
severity = "High"
suppressionDuration = "PT5H"
suppressionEnabled = false
tactics = [
]
techniques = [
]
}
}
schema_validation_enabled = false
response_export_values = ["*"]
depends_on = [azapi_resource.onboardingState]
}
资源格式
若要创建 Microsoft.SecurityInsights/alertRules 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
etag = "string"
name = "string"
kind = "string"
// For remaining properties, see Microsoft.SecurityInsights/alertRules objects
}
Microsoft.SecurityInsights/alertRules 对象
设置 类型 属性以指定对象的类型。
对于 Fusion,请使用:
{
kind = "Fusion"
properties = {
alertRuleTemplateName = "string"
enabled = bool
}
}
对于 MicrosoftSecurityIncidentCreation,请使用:
{
kind = "MicrosoftSecurityIncidentCreation"
properties = {
alertRuleTemplateName = "string"
description = "string"
displayName = "string"
displayNamesExcludeFilter = [
"string"
]
displayNamesFilter = [
"string"
]
enabled = bool
productFilter = "string"
severitiesFilter = [
"string"
]
}
}
对于 计划,请使用:
{
kind = "Scheduled"
properties = {
alertDetailsOverride = {
alertDescriptionFormat = "string"
alertDisplayNameFormat = "string"
alertDynamicProperties = [
{
alertProperty = "string"
value = "string"
}
]
alertSeverityColumnName = "string"
alertTacticsColumnName = "string"
}
alertRuleTemplateName = "string"
customDetails = {
{customized property} = "string"
}
description = "string"
displayName = "string"
enabled = bool
entityMappings = [
{
entityType = "string"
fieldMappings = [
{
columnName = "string"
identifier = "string"
}
]
}
]
eventGroupingSettings = {
aggregationKind = "string"
}
incidentConfiguration = {
createIncident = bool
groupingConfiguration = {
enabled = bool
groupByAlertDetails = [
"string"
]
groupByCustomDetails = [
"string"
]
groupByEntities = [
"string"
]
lookbackDuration = "string"
matchingMethod = "string"
reopenClosedIncident = bool
}
}
query = "string"
queryFrequency = "string"
queryPeriod = "string"
severity = "string"
suppressionDuration = "string"
suppressionEnabled = bool
tactics = [
"string"
]
techniques = [
"string"
]
templateVersion = "string"
triggerOperator = "string"
triggerThreshold = int
}
}
属性值
Microsoft.SecurityInsights/alertRules
| 名字 | 描述 | 价值 |
|---|---|---|
| ETAG | Azure 资源的 Etag | 字符串 |
| 类 | 对于 fusionAlertRule |
“Fusion” “MicrosoftSecurityIncidentCreation” “Scheduled”(必需) |
| 名字 | 资源名称 | string (必需) |
| parent_id | 要向其应用此扩展资源的资源的 ID。 | string (必需) |
| 类型 | 资源类型 | “Microsoft.SecurityInsights/alertRules@2024-03-01” |
AlertDetailsOverride
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDescriptionFormat | 包含列名称的格式,用于替代警报说明 | 字符串 |
| alertDisplayNameFormat | 包含列名称的格式,用于替代警报名称 | 字符串 |
| alertDynamicProperties | 要重写的其他动态属性的列表 | AlertPropertyMapping[] |
| alertSeverityColumnName | 要从中获取警报严重性的列名称 | 字符串 |
| alertTacticsColumnName | 要从中获取警报策略的列名称 | 字符串 |
AlertPropertyMapping
| 名字 | 描述 | 价值 |
|---|---|---|
| alert属性 | V3 警报属性 | “AlertLink” “ConfidenceLevel” “ConfidenceScore” “ExtendedLinks” “ProductComponentName” “ProductName” “ProviderName” “RemediationSteps” “技术” |
| 价值 | 用于重写此属性的列名 | 字符串 |
实体映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 实体类型 | 映射实体的 V3 类型 | “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| fieldMappings 字段映射 | 给定实体映射的字段映射数组 | FieldMapping[] |
EventGroupingSettings
| 名字 | 描述 | 价值 |
|---|---|---|
| aggregationKind | 事件分组聚合类型 | “AlertPerResult” “SingleAlert” |
FieldMapping 字段映射
| 名字 | 描述 | 价值 |
|---|---|---|
| 列名称 | 要映射到标识符的列名 | 字符串 |
| 标识符 | 实体的 V3 标识符 | 字符串 |
FusionAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Fusion”(必需) |
| 性能 | Fusion 警报规则属性 | FusionAlertRule属性 |
FusionAlertRule属性
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
GroupingConfiguration
| 名字 | 描述 | 价值 |
|---|---|---|
| 启用 | 已启用分组 | bool (必需) |
| groupByAlertDetails | 要分组依据的警报详细信息列表(选中匹配Method 时) | 包含任一项的字符串数组: “DisplayName” “严重性” |
| groupByCustomDetails | 要分组依据的自定义详细信息键列表(如果已选中匹配Method)。 只能使用当前警报规则中定义的密钥。 | 字符串[] |
| groupByEntities | 要分组依据的实体类型列表(如果已选中 matchingMethod)。 只能使用在当前警报规则中定义的实体。 | 包含任一项的字符串数组: “Account” “AzureResource” “CloudApplication” “DNS” “File” “FileHash” “Host” “IP” “Mailbox” “MailCluster” “MailMessage” “恶意软件” “Process” “RegistryKey” “RegistryValue” “SecurityGroup” “SubmissionMail” “URL” |
| lookbackDuration | 将组限制为在回溯持续时间内创建的警报(采用 ISO 8601 持续时间格式) | string (必需) |
| 匹配方法 | 分组匹配方法。 当方法为 Selected 至少一个 groupByEntities 时,必须提供 groupByAlertDetails、groupByCustomDetails,而不是空。 | “AllEntities” “AnyAlert” “Selected”(必需) |
| reopenClosedIncident 事件 | 重新打开关闭的匹配事件 | bool (必需) |
事件配置
| 名字 | 描述 | 价值 |
|---|---|---|
| createIncident 事件 | 基于此分析规则触发的警报创建事件 | bool (必需) |
| groupingConfiguration | 设置此分析规则触发的警报如何分组到事件中 | GroupingConfiguration |
MicrosoftSecurityIncidentCreationAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “MicrosoftSecurityIncidentCreation”(必需) |
| 性能 | MicrosoftSecurityIncidentCreation 规则属性 | MicrosoftSecurityIncidentCreationAlertRuleProperties |
MicrosoftSecurityIncidentCreationAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| displayNamesExcludeFilter | 不生成事例的警报的 displayNames | 字符串[] |
| displayNamesFilter | 警报的 displayNames,将生成事例 | 字符串[] |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| product过滤器 | 警报的 productName,将生成事例 | “Azure Active Directory 标识保护” “Azure 高级威胁防护” “适用于 IoT 的 Azure 安全中心” “Azure 安全中心” “Microsoft Cloud App Security”(必需) |
| severitiesFilter | 警报的严重性,将生成事例 | 包含任一项的字符串数组: “High” “Informational” “Low” “Medium” |
ScheduledAlertRule
| 名字 | 描述 | 价值 |
|---|---|---|
| 类 | 警报规则类型 | “Scheduled”(必需) |
| 性能 | 计划的警报规则属性 | ScheduledAlertRuleProperties |
ScheduledAlertRuleCommonPropertiesCustomDetails
| 名字 | 描述 | 价值 |
|---|
ScheduledAlertRuleProperties
| 名字 | 描述 | 价值 |
|---|---|---|
| alertDetailsOverride | 警报详细信息替代设置 | AlertDetailsOverride |
| alertRuleTemplateName | 用于创建此规则的警报规则模板的名称。 | 字符串 |
| 自定义详细信息 | 要附加到警报的列的字符串键值对字典 | ScheduledAlertRuleCommonPropertiesCustomDetails |
| 描述 | 警报规则的说明。 | 字符串 |
| displayName (显示名称) | 此警报规则创建的警报的显示名称。 | string (必需) |
| 启用 | 确定此警报规则是启用还是禁用。 | bool (必需) |
| 实体映射 | 警报规则实体映射的数组 | 实体映射[] |
| eventGroupingSettings | 事件分组设置。 | EventGroupingSettings |
| incidentConfiguration 事件配置 | 通过此分析规则触发的警报创建的事件的设置 | 事件配置 |
| 查询 | 为此规则创建警报的查询。 | 字符串 |
| 查询频率 | 要运行此警报规则的频率(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 查询周期 | 此警报规则查看的时间段(采用 ISO 8601 持续时间格式)。 | 字符串 |
| 严厉 | 此警报规则创建的警报的严重性。 | “High” “Informational” “Low” “Medium” |
| suppressionDuration | 自上次触发此警报规则以来,抑制(采用 ISO 8601 持续时间格式)等待。 | string (必需) |
| suppression已启用 | 确定此警报规则的抑制是启用或禁用的。 | bool (必需) |
| 策略 | 警报规则的策略 | 包含任一项的字符串数组: “Collection” “CommandAndControl” “CredentialAccess” “DefenseEvasion” “发现” “执行” “外泄” “影响” “ImpairProcessControl” “InhibitResponseFunction” “InitialAccess” “LateralMovement” “持久性” “PreAttack” “PrivilegeEscalation” “侦查” “ResourceDevelopment” |
| 技术 | 警报规则的技术 | 字符串[] |
| templateVersion (模板版本) | 用于创建此规则的警报规则模板的版本 - 格式 <a.b.c>,其中都是数字,例如 0 <1.0.2> | 字符串 |
| triggerOperator | 针对触发警报规则的阈值的操作。 | “Equal” “GreaterThan” “LessThan” “NotEqual” |
| triggerThreshold 触发阈值 | 阈值触发此警报规则。 | 整数 (int) |