我有一个 Azure Monitor 设置,其中包含一个警报,该警报使用 Kusto 查询有关条件访问策略登录数据的详细信息。当用户登录时,此警报会触发一个操作组,该操作组会激活逻辑应用程序向我发送电子邮件。但是,我的 Kusto 查询包括搜索结果表中的位置等信息,我希望将该数据传递到逻辑应用中的 HTTP 请求,以便可以将其包含在电子邮件中。现在我正在使用 Microsoft 文档中的通用架构。这里需要了解如何修改此架构以包含我的查询中的数据。
"type": "object",
"properties": {
"schemaId": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"essentials": {
"type": "object",
"properties": {
"alertId": {
"type": "string"
},
"alertRule": {
"type": "string"
},
"severity": {
"type": "string"
},
"signalType": {
"type": "string"
},
"monitorCondition": {
"type": "string"
},
"monitoringService": {
"type": "string"
},
"alertTargetIDs": {
"type": "array",
"items": {
"type": "string"
}
},
"originAlertId": {
"type": "string"
},
"firedDateTime": {
"type": "string"
},
"resolvedDateTime": {
"type": "string"
},
"description": {
"type": "string"
},
"essentialsVersion": {
"type": "string"
},
"alertContextVersion": {
"type": "string"
}
}
},
"alertContext": {
"type": "object",
"properties": {}
}
}
}
}
}
首先,如果您必须修改 Kusto 查询以包含自定义字段。
SigninLogs
| where ResultType == 0
| extend Location = tostring(LocationDetails)
| project UserPrincipalName, Location, AppDisplayName, SigninDateTime
提供的架构,alertContext 属性是一个空对象。您可以使用 Kusto 查询中的自定义数据填充它,例如位置。
这是一个例子,
{
"type": "object",
"properties": {
"schemaId": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"essentials": {
"type": "object",
"properties": {
"alertId": {
"type": "string"
},
"alertRule": {
"type": "string"
},
"severity": {
"type": "string"
},
"signalType": {
"type": "string"
},
"monitorCondition": {
"type": "string"
},
"monitoringService": {
"type": "string"
},
"alertTargetIDs": {
"type": "array",
"items": {
"type": "string"
}
},
"originAlertId": {
"type": "string"
},
"firedDateTime": {
"type": "string"
},
"resolvedDateTime": {
"type": "string"
},
"description": {
"type": "string"
},
"essentialsVersion": {
"type": "string"
},
"alertContextVersion": {
"type": "string"
}
}
},
"alertContext": {
"type": "object",
"properties": {
"location": {
"type": "string"
},
"userPrincipalName": {
"type": "string"
},
"appDisplayName": {
"type": "string"
},
"signinDateTime": {
"type": "string"
}
}
}
}
}
}
}
这将完成工作