Azure Logic应用程序:如何在逻辑应用程序操作连接中断或失败时获得通知

s6fujrry  于 2023-10-22  发布在  其他
关注(0)|答案(2)|浏览(172)

我想构建一个逻辑应用程序,当我的环境中的任何逻辑应用程序失败或连接断开时,它会告诉我。(逻辑应用程序的手动触发和自动触发)
我发现最接近实现这一点的KQL是:

  1. SentinelHealth
  2. | where TimeGenerated > ago(7d)
  3. | where SentinelResourceType == "Automation rule"
  4. | mv-expand TriggeredPlaybooks = ExtendedProperties.TriggeredPlaybooks
  5. | extend runId = tostring(TriggeredPlaybooks.RunId)
  6. | join (AzureDiagnostics
  7. | where OperationName == "Microsoft.Logic/workflows/workflowRunCompleted"
  8. | extend IncidentNumber = toint(extract(@"[a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12}\_(\d+)", 1, correlation_clientTrackingId_s))
  9. | project
  10. IncidentNumber,
  11. resource_runId_s,
  12. playbookName = resource_workflowName_s,
  13. playbookRunStatus = status_s)
  14. on $left.runId == $right.resource_runId_s
  15. | project
  16. RecordId,
  17. TimeGenerated,
  18. AutomationRuleName= SentinelResourceName,
  19. AutomationRuleStatus = Status,
  20. Description,
  21. workflowRunId = runId,
  22. playbookName,
  23. playbookRunStatus,
  24. IncidentNumber

KQL source
这是我现在的工作流程:

查询运行并输出到一个html表,该表通过电子邮件发送给我。
问题是,我知道我的环境中有几个逻辑应用程序具有失败的操作断开连接的操作,这些操作没有被我的逻辑应用程序+ kql捕获。
当逻辑应用程序失败时(包括完全失败和特定操作失败时),您将如何解决检测和通知问题?

nwsw7zdq

nwsw7zdq1#

Azure Logic应用程序:如何在逻辑应用程序行为连接中断或失败时获得通知
一种方法是像下面这样检查:

另一种方法是在每个动作之后添加并行动作,如下所示,以获得警报:

如果警报失败,否则如果为真,则下一步操作如下:

为了使上述步骤工作,您需要添加如下代码:

runAfter to failed

Output:

所以,像这样,对于每个动作,你需要添加并行动作(我只为action parsejson这样做是为了理解如何做),对于那个动作,你需要将runafter更改为failed,然后你就会得到alert。
另请参阅此SO-Thread1和SO-Thread 2

展开查看全部
gkl3eglg

gkl3eglg2#

下面的KQL可以向你展示逻辑应用程序,sentinel事件的触发器,逻辑应用程序中的操作和该操作的事件。

  1. AzureDiagnostics
  2. | where OperationName contains "Microsoft.Logic/workflows"
  3. | extend OperationType = tostring(split(OperationName,'/')[2])
  4. | extend LogicApp = tostring(split(ResourceId,'/')[8])
  5. | extend IncidentNumber = toint(extract(@"[a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12}\_(\d+)", 1, correlation_clientTrackingId_s))
  6. | summarize Resource = strcat_array(make_set(Resource),', '),
  7. status_s = strcat_array(make_set(status_s),', ') by LogicApp, IncidentNumber, OperationType, Level

这将输出逻辑应用程序运行的确切信息-然而,我注意到不是所有的逻辑应用程序出现在这里。

相关问题