0

I'm working on logic apps for first time and having the below challenge,

I have created a logic app designer for Key vault secret expiry to send mail to outlook mail. Created a recurrence schedule followed by when an resource event occurs & send an email as shown in the picture. However the job runs as per schedule and stuck at when an resource event occurs.

I can see the eventgrid, office 365 APi connection got created. Please suggest.

enter image description here

Markus Meyer
  • 3,327
  • 10
  • 22
  • 35
  • Ahhhhhhhh, not sure how you did that. The `When a resource event occurs` is exactly that, an **event**, therefore, it should be a trigger, not an action. You don't need the `Recurrence` trigger there, remove it and make the `When a resource event occurs` the trigger to the flow. – Skin Oct 02 '22 at 11:25
  • Thank you Markus. I completely removed the existing trigger and tried to create a new designer as per your suggestion. When a resource event occurs & send an email. However , I'm unable to save the designer and throwing the below error. Failed to save logic app Jlogicapp15. The template validation failed: 'The action(s) 'When_a_resource_event_occurs' referenced by 'inputs' in action 'Send_an_email_(V2)' are not defined in the template.'. Using the body(send an email) as per reference from Microsoft article, step 7. https://learn.microsoft.com/en-us/azure/key-vault/general/event-grid-logicapps – sudhir karamchand Oct 02 '22 at 15:50
  • Just take your time and look through the flow. It'll all be in front of you. The error is due to a dependency in the send email step that is no longer there. By the way, Markus edited your post, he didn't comment ... that was me. – Skin Oct 03 '22 at 03:51
  • I was able to save the work flow after making few changes but throwing the below error after running the trigger. "Workflow run timed out because the starting action was not performed. Please try again" Any suggestions on this would be appreciated. Thank you – sudhir karamchand Oct 03 '22 at 07:12
  • It's a trigger for when a **RESOURCE EVENT OCCURS**. You can't just trigger it ... if that's what you did. You have to make it trigger by executing the action that sends an event to the LogicApp. – Skin Oct 03 '22 at 07:35
  • May thanks. This worked. My requirement is for key vault secret near expiry and how often would this trigger run in a day. – sudhir karamchand Oct 03 '22 at 08:15
  • Documentation always helps ... https://learn.microsoft.com/en-us/azure/key-vault/general/event-grid-overview – Skin Oct 05 '22 at 23:58

1 Answers1

0

After reproduced from my end:-

  1. I have created logic app as shown below:

enter image description here

  1. Selected event type as “Microsoft.KeyVault.KeyNearExpiry” in resource event occurs trigger. This will trigger when a secret in key vault is near to expiry date.

enter image description here

  1. Next selected send email action for sending notification.

enter image description here

  1. Logic app ran successfully and received mail.

enter image description here

Note: This logic app will run automatically when secret expiration date is near to current date.

Jahnavi
  • 3,076
  • 1
  • 3
  • 10
  • Could you please add proper images? It would be helpful for reference purpose. – Lucifer Oct 28 '22 at 18:40
  • 1
    Yes I will add. – Jahnavi Oct 29 '22 at 02:55
  • Thanks for adding the images. I have also created the similar logic app with the event as secretNearExpiry and then created a testsecret with exact 30 days from today but didn't received any mail i.e. no event got triggered. What could be the issue here? When I run logic app manually, mail is coming even when there was no secret near expiry but when there is a dummy secret the app didn't even started automatically... :( – Lucifer Oct 29 '22 at 06:42
  • 1
    You can [refer](https://yourazurecoach.com/2019/01/08/logic-apps-event-grid-trigger-not-firing/) here to check the issue. – Jahnavi Oct 29 '22 at 13:04
  • 1
    [Perform Operations on data-Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-perform-data-operations) – Jahnavi Nov 01 '22 at 12:33
  • Thanks @Jahnavi for the link. I was able to accomplish the desired output in table format over the weekend itself but Thank you so much for your valuable time... :) – Lucifer Nov 01 '22 at 13:09