Building a Solution with Azure Event Grid and Logic Apps

Send Email Alerts for Critical Device Unavailability using Azure Event Grid and Logic Apps

Question

IoT Hub generates messages on occurrence of certain events.

Relying on this feature you want to send email alerts to the operations when critical devices become unavailable.

You want to use Azure Event Grid with Logic Apps.

Here are the steps you should consider while building the required solution: Create an event subscription in IoT Hub (Device Disconnected) Create an Event Grid connection Define Logic App trigger event (Microsoft.Devices.DeviceDisconnected) Devine a Webhook endpoint in IoT Hub for Logic App function Define an Azure Functions endpoint in IoT Hub Configure Logic App action (send email) Define a message route to Event Grid in IoT Hub Which steps should be executed in what order?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: C.

Option A is incorrect because you don't set up an Event Grid connection explicitly.

In this case, it is created implicitly by configuring an event in Logic App.

Option B is incorrect because, on one hand, Event Grid is not a custom endpoint and you cannot configure it as a routing target.

On the other hand, Event Grid actions must be configured as Events in the IoT Hub, instead of message routes.

Option C is CORRECT because first you need to define a Logic App trigger event using the DeviceDisconnected schema; then the action invoked by the trigger must be set; then you need a publish topic in IoT Hub and an event subscription; finally the endpoint type must be set to Webhook.

Option D is incorrect because you need to use the Web Hook (not Azure Functions ) as event handler for Logic Apps to implement a logic to process Event Grid events.

Reference:

The correct order of steps to implement the solution for sending email alerts to operations when critical devices become unavailable using Azure Event Grid with Logic Apps is:

C. 3, 6, 1, 4

Here is a detailed explanation of each step:

Step 3: Define Logic App trigger event (Microsoft.Devices.DeviceDisconnected) This step involves defining the trigger for the Logic App. In this case, the trigger event is Microsoft.Devices.DeviceDisconnected, which will fire whenever a device gets disconnected from IoT Hub.

Step 6: Define an Azure Functions endpoint in IoT Hub In this step, an Azure Function endpoint is defined in IoT Hub to receive messages from the event subscription. The endpoint URL can be obtained by deploying an Azure Function that can process the incoming messages.

Step 1: Create an event subscription in IoT Hub (Device Disconnected) This step involves creating an event subscription in IoT Hub that will trigger whenever a device gets disconnected. This event subscription will send the event data to Azure Event Grid.

Step 4: Devine a Webhook endpoint in IoT Hub for Logic App function This step involves defining a webhook endpoint in IoT Hub to send the event data to the Logic App. The Logic App will use this endpoint to receive the event data.

Step 5: Define a message route to Event Grid in IoT Hub This step involves defining a message route in IoT Hub to send the event data to Azure Event Grid. This is required to ensure that the event data is sent to Azure Event Grid for further processing.

Step 2: Create an Event Grid connection This step involves creating an Event Grid connection that will connect IoT Hub to Azure Event Grid. This connection will enable the event data to be sent from IoT Hub to Azure Event Grid.

Step 7: Configure Logic App action (send email) In this step, the Logic App action is configured to send an email whenever the trigger event is fired. The email can be sent to the operations team, notifying them of the device disconnection.

Therefore, the correct order of the steps is: 3, 6, 1, 4.