Trigger email once for multiple failure of logic app

Bhosale, Vinay 21 Reputation points
2023-01-03T06:51:36.65+00:00

Hi,

I have a logic app which sends an email when the logic app fails , but the scenario here is the logic app runs every 5 mins and if the logic app fails for every run instance I get an email for the failure. What i want to achieve is to trigger that send email activity only once even if there are multiple failures in the logic app.

1st run - logic app failed - send email
2nd run - logic app failed - check if email has been sent, if yes then don't send an email for the next scheduled runs

how do I achieve this scenario?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,557 questions
0 comments No comments
{count} votes

Accepted answer
  1. Alistair Ross 7,466 Reputation points Microsoft Employee
    2023-01-03T10:01:58.53+00:00

    Hi @Bhosale, Vinay

    You would need to do all these steps inside of a logic app, with the steps summarized like this

    1. Logic App triggered by the alert
    2. Logic app checks sent emails, filtering for a field that uniquely identifies that alert, such as a formatted subject.
    3. If the email exists, do nothing
    4. If the email does not exist, send the email

    Alternatively you could:

    1. Logic App triggered by the alert
    2. Logic app checks a table in storage account for data relating to sending this email for this alert
    3. If the data exists, do nothing (or just increment a count field on the table)
    4. If the data does not exist, send the email
    5. Add / update the row in the table relating to sending the email

    Or you could do something similar if the logic app is logging to Log Analytics, by querying the steps there. Either way you want to trigger the logic app to perform the relevant checks and make the decision on whether the email should be sent or not.

    I hope this helps provide you with the information you need. If it does, please make sure to mark the question as answered so it helps other people in future.

    Kind regards

    Alistair

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Andrew Blumhardt 10,051 Reputation points Microsoft Employee
    2023-01-03T13:46:10.74+00:00

    Alistair mentioned this. I would just log the app activity to Log Analytics and use an Azure Monitor query rule to trigger the email as an action group.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.