skip to Main Content

I have created an Azure Budget which is mapped to an Action group.
I have created a Logic App to send different emails with different email structures on different budget threshold example 50% , 75% etc.
Not able to understand, How to trigger a single logic app for sending different emails as per Azure Budget Action Group conditions.

2

Answers


  1. In logic app flow, you can use multiple conditions to send different mails based on different budget conditions.

    1. Created logic app flow as shown below,
      enter image description here

    2. The body of Http request trigger is in below format,

         {
        "schemaId":"AIP Budget Notification",
        "data":{
            "SubscriptionName":"Subscriptiona",
            "SubscriptionId":"JKKLLLLLL",
            "SpendingAmount":"100",
            "BudgetStartDate":"6/1/2018",
            "Budget":"50","Unit":"USD",
            "BudgetCreator":"[email protected]",
            "BudgetName":"BudgetName",
            "BudgetType":"Cost",
            "ResourceGroup":"resorceg",
            "NotificationThresholdAmount":"0.8"
            }
        }
    
    1. Selecting body of Http request trigger as content in Parse JSON action and given above code in use sample payload to generate schema.
      enter image description here

    2. I am checking condition for NotificationThresholdAmount value from Parse JSON action.

    3. If NotificationThresholdAmount is greater than or equal to 0.8 and less than 1, sending mail to one user with one format.
      enter image description here

    4. Added one parallel condition to check if NotificationThresholdAmount is greater than or equal to 1 and less than 2, sending mail to another user with different format.
      enter image description here

    5. Mail format received in below format when NotificationThresholdAmount is 0.9
      enter image description here
      enter image description here

    6. Mail format received in below format when NotificationThresholdAmount is 1.2.
      enter image description here

    enter image description here
    Here is reference link

    Login or Signup to reply.
  2. I followed the Microsoft article mentioned by Vijaya. What it lacks is you need to convert the NotificationThresholdAmount object from the incoming JSON data to integer as the conditions are going to want it as such for comparison with your defined threshold numbers.

    For the same you can use Compose Action for converting the incoming NotificationThresholdAmount to integer which would come as string.

    The condition i used was something like this
    int(body('Parse_JSON')['?']['NotificationThresholdAmount'])

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search