Skip to content

Commit ee62fa3

Browse files
committed
Finish walkthrough test and screenshots
1 parent a1f4f63 commit ee62fa3

13 files changed

+90
-38
lines changed

articles/iot-hub/TOC.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@
4747
- name: Visualize data in Power BI
4848
displayName: Stream Analytics
4949
href: iot-hub-live-data-visualization-in-power-bi.md
50-
- name: Visualize data in an App Service web app
50+
- name: Visualize data in App Service web apps
5151
displayName: Node.js
5252
href: iot-hub-live-data-visualization-in-web-apps.md
5353
- name: Monitor and notify with Logic Apps
54+
displayName: Service Bus, queue, namespace
5455
href: iot-hub-monitoring-notifications-with-azure-logic-apps.md
5556

5657
- name: Concepts

articles/iot-hub/iot-hub-monitoring-notifications-with-azure-logic-apps.md

Lines changed: 88 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: kgremban
77
ms.author: kgremban
88
ms.service: iot-hub
99
ms.topic: tutorial
10-
ms.date: 02/02/2024
10+
ms.date: 02/05/2024
1111
---
1212

1313
# Tutorial: Monitor IoT devices and send notifications with Azure Logic Apps
@@ -93,7 +93,13 @@ Create a Service Bus namespace and queue. Later in this article, you create a ro
9393

9494
1. In the **Name** field, provide a name for the queue. Accept the default values for the other fields and select **Create**.
9595

96-
1. Back on the **Service Bus Namespace** pane, select **Queues** from the **Entities** section of the resource menu. Then, select the queue that you just created from the list
96+
1. In your Service Bus namespace, select **Shared access policies** from the **Settings** section of the resource menu.
97+
98+
1. Select the **RootManageSharedAccessKey** policy to open its details.
99+
100+
1. Copy the value of **Primary connection string** and save it to use later in this tutorial when you configure the logic app.
101+
102+
<!-- 1. Back on the **Service Bus Namespace** pane, select **Queues** from the **Entities** section of the resource menu. Then, select the queue that you just created from the list
97103
98104
:::image type="content" source="./media/iot-hub-monitoring-notifications-with-azure-logic-apps/queues-select-queue.png" alt-text="Screenshot that shows the list of queues in your namespace.":::
99105
@@ -105,6 +111,10 @@ Create a Service Bus namespace and queue. Later in this article, you create a ro
105111
106112
:::image type="content" source="./media/iot-hub-monitoring-notifications-with-azure-logic-apps/add-sas-policy.png" alt-text="Screenshot that shows creating a shared access policy.":::
107113
114+
1. After your policy is created, select it from the list of policies to open the details.
115+
116+
1. Copy the value of the **Primary connection string** and save it to use later in this tutorial when you configure the logic app. -->
117+
108118
## Add a custom endpoint and routing rule to your IoT hub
109119

110120
Add a custom endpoint for the Service Bus queue to your IoT hub. Then, create a message routing rule to direct messages that contain a temperature alert to that endpoint, where they will be picked up by your logic app. The routing rule uses a routing query, `temperatureAlert = "true"`, to forward messages based on the value of the `temperatureAlert` application property set by the client code running on the device. To learn more, see [Message routing query based on message properties](./iot-hub-devguide-routing-query-syntax.md#query-based-on-message-properties).
@@ -142,85 +152,115 @@ Add a custom endpoint for the Service Bus queue to your IoT hub. Then, create a
142152

143153
1. Select **Create + skip enrichments**.
144154

145-
## Create and configure a Logic App
155+
## Configure Logic Apps for notifications
146156

147157
In the preceding section, you set up your IoT hub to route messages containing a temperature alert to your Service Bus queue. Now, you set up a logic app to monitor the Service Bus queue and send an e-mail notification whenever a message is added to the queue.
148158

149159
### Create a logic app
150160

151-
1. Select **Create a resource** > **Integration** > **Logic App**.
161+
1. In the Azure portal, search for and select **Logic Apps**.
152162

153-
1. Enter the following information:
163+
1. Select **Add** to create a new logic app.
154164

155-
**Name**: The name of the logic app.
165+
1. Enter the following information on the **Basics** tab of **Create Logic App**:
156166

157-
**Resource group**: Use the same resource group that your IoT hub uses.
167+
| Parameter | Value |
168+
| --------- | ----- |
169+
| **Resource group** | Select the same resource group that contains your IoT hub. |
170+
| **Name** | Provide a name for your the logic app. |
171+
| **Region** | Select a location close to you. |
172+
| **Plan type** | Select **Consumption**, which is sufficient for this tutorial. |
158173

159-
**Location**: Use the same location that your IoT hub uses.
174+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/create-a-logic-app.png" alt-text="Screenshot that shows creating a logic app in the Azure portal.":::
160175

161-
![Create a logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/create-a-logic-app.png)
176+
1. Select **Review + create**.
162177

163178
1. Select **Create**.
164179

180+
1. After the deployment completes, select **Go to resource** to open your logic app.
181+
165182
### Configure the logic app trigger
166183

167-
1. Open the logic app. The easiest way to get to the logic app is to select **Resource groups** from the resource pane, select your resource group, then select your logic app from the list of resources. When you select the logic app, the Logic Apps Designer opens.
184+
1. On your logic app resource page in the Azure portal, open the **Logic app designer** from the **Development Tools** section of the resource menu.
168185

169-
1. In the Logic Apps Designer, scroll down to **Templates** and select **Blank Logic App**.
186+
1. In the designer, scroll down to **Templates** and select **Blank Logic App**.
170187

171-
![Start with a blank logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/5-start-with-blank-logic-app-azure-portal.png)
188+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/designer-blank-logic-app.png" alt-text="Screenshot that shows selecting the Blank Logic App template.":::
172189

173-
1. Select the **All** tab and then select **Service Bus**.
190+
1. Select the **All** tab to show all connectors and triggers, then select **Service Bus**.
174191

175-
![Select Service Bus to start creating your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/6-select-service-bus-when-creating-blank-logic-app-azure-portal.png)
192+
![Select Service Bus to start creating your logic app in the Azure portal.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/6-select-service-bus-when-creating-blank-logic-app-azure-portal.png)
176193

177194
1. Under **Triggers**, select **When one or more messages arrive in a queue (auto-complete)**.
178195

179-
![Select the trigger for your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/select-service-bus-trigger.png)
196+
![Select the trigger for your logic app in the Azure portal.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/select-service-bus-trigger.png)
180197

181198
1. Create a service bus connection.
182-
1. Enter a connection name and select your Service Bus namespace from the list. The next screen opens.
183199

184-
![Screenshot that highlights the When one or more messages arrive in a queue (auto-complete) option.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/create-service-bus-connection-1.png)
200+
1. Provide a **Connection name** and then paste the **Connection string** that you copied from your Service Bus namespace.
185201

186-
1. Select the service bus policy (RootManageSharedAccessKey). Then select **Create**.
202+
1. Select **Create**.
187203

188-
![Create a service bus connection for your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/7-create-service-bus-connection-in-logic-app-azure-portal.png)
204+
1. On the next screen, use the drop-down menu to select the queue that you created in your Service Bus namespace. Then, enter `175` for **Maximum message count**.
189205

190-
1. On the final screen, for **Queue name**, select the queue that you created from the drop-down. Enter `175` for **Maximum message count**.
206+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/designer-queue-settings.png" alt-text="Screenshot that shows configuring queue settings in the Logic app designer.":::
191207

192-
![Specify the maximum message count for the service bus connection in your logic app](media/iot-hub-monitoring-notifications-with-azure-logic-apps/8-specify-maximum-message-count-for-service-bus-connection-logic-app-azure-portal.png)
193-
194-
1. Select **Save** on the menu at the top of the Logic Apps Designer to save your changes.
208+
1. Select **Save** on the logic app designer menu to save your changes.
195209

196210
### Configure the logic app action
197211

212+
1. Select **New step** in the logic app designer.
213+
198214
1. Create an SMTP service connection.
199215

200-
1. Select **New step**. In **Choose an action**, select the **All** tab.
216+
1. Search for and select **SMTP**.
201217

202-
1. Type `smtp` in the search box, select the **SMTP** service in the search result, and then select **Send Email**.
218+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/designer-smtp-connection.png" alt-text="Screenshot that shows selecting an SMTP connection in the logic app designer.":::
203219

204-
![Create an SMTP connection in your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/9-create-smtp-connection-logic-app-azure-portal.png)
220+
1. Select **Send Email (V3)** as the action for this step.
205221

206-
1. Enter the SMTP information for your mailbox, and then select **Create**.
222+
1. Provide a **Connection name**, then fill out the rest of the fields with the SMTP information for the email account you want to use to send the notification messages.
207223

208-
![Enter SMTP connection info in your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/10-enter-smtp-connection-info-logic-app-azure-portal.png)
224+
Use the following links to find your SMTP information, depending on your mail provider:
209225

210-
Get the SMTP information for [Hotmail/Outlook.com](https://support.office.com/article/Add-your-Outlook-com-account-to-another-mail-app-73f3b178-0009-41ae-aab1-87b80fa94970), [Gmail](https://support.google.com/a/answer/176600?hl=en), and [Yahoo Mail](https://help.yahoo.com/kb/SLN4075.html).
226+
* [Hotmail/Outlook.com](https://support.microsoft.com/office/pop-imap-and-smtp-settings-for-outlook-com-d088b986-291d-42b8-9564-9c414e2aa040)
227+
* [Gmail](https://support.google.com/a/answer/176600?hl=en)
228+
* [Yahoo Mail](https://help.yahoo.com/kb/SLN4075.html).
211229

212230
> [!NOTE]
213231
> You may need to disable TLS/SSL to establish the connection. If this is the case and you want to re-enable TLS after the connection has been established, see the optional step at the end of this section.
214232
215-
1. From the **Add new parameter** drop-down on the **Send Email** step, select **From**, **To**, **Subject** and **Body**. Click or tap anywhere on the screen to close the selection box.
233+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/designer-smtp-settings.png" alt-text="Screenshot that shows configuring the SMTP connection settings in the logic app designer.":::
234+
235+
1. Select **Create**.
216236

217-
![Choose SMTP connection email fields](media/iot-hub-monitoring-notifications-with-azure-logic-apps/smtp-connection-choose-fields.png)
237+
1. Configure the **Send Email** action.
218238

219-
1. Enter your email address for **From** and **To**, and `High temperature detected` for **Subject** and **Body**. If the **Add dynamic content from the apps and connectors used in this flow** dialog opens, select **Hide** to close it. You do not use dynamic content in this tutorial.
239+
1. From the **Add new parameter** drop-down on the **Send Email** step, select the following parameters:
220240

221-
![Fill-in SMTP connection email fields](media/iot-hub-monitoring-notifications-with-azure-logic-apps/fill-in-smtp-connection-fields.png)
241+
* **From**
242+
* **To**
243+
* **Subject**
244+
* **Body**
222245

223-
1. Select **Save** to save the SMTP connection.
246+
Click or tap anywhere on the screen to close the selection box.
247+
248+
![Choose SMTP connection email fields to include in email.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/smtp-connection-choose-fields.png)
249+
250+
1. Enter the following information for the email parameters you selected in the previous step:
251+
252+
| Parameter | Value |
253+
| --------- | ----- |
254+
| **From** | The email address that you configured for the SMTP connection. |
255+
| **To** | The email address or addresses where you want to send notification emails. |
256+
| **Subject** | `High temperature detected`. |
257+
| **Body** | `High temperature detected`. |
258+
259+
If the **Add dynamic content** dialog opens, select **Hide** to close it. You do not use dynamic content in this tutorial.
260+
261+
![Provide details for SMTP connection email fields.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/fill-in-smtp-connection-fields.png)
262+
263+
1. Select **Save** to save the SMTP connection.
224264

225265
1. (Optional) If you had to disable TLS to establish a connection with your email provider and want to re-enable it, follow these steps:
226266

@@ -232,21 +272,32 @@ In the preceding section, you set up your IoT hub to route messages containing a
232272

233273
1. On the **Edit API Connection** pane, select **Enable SSL?**, re-enter the password for your email account, and select **Save**.
234274

235-
![Edit SMTP API connection in your logic app in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/re-enable-smtp-connection-ssl.png)
275+
![Edit SMTP API connection in your logic app in the Azure portal.](media/iot-hub-monitoring-notifications-with-azure-logic-apps/re-enable-smtp-connection-ssl.png)
236276

237277
Your logic app is now ready to process temperature alerts from the Service Bus queue and send notifications to your email account.
238278

239279
## Test the logic app
240280

241-
1. Start the client application on your device.
281+
Start sending temperature messages from your IoT device to test the monitoring and notification pipeline.
242282

243-
1. If you're using a physical device, carefully bring a heat source near the heat sensor until the temperature exceeds 30 degrees C. If you're using the online simulator, the client code will randomly output telemetry messages that exceed 30 C.
283+
1. Start the client application on your device. The client code randomly outputs telemetry messages, and sets the `temperatureAlert` property to `true` when the temperature exceeds 30 C.
244284

245285
1. You should begin receiving email notifications sent by the logic app.
246286

247287
> [!NOTE]
248288
> Your email service provider may need to verify the sender identity to make sure it is you who sends the email.
249289
290+
## Clean up resources
291+
292+
If you don't need the resources that you created in this tutorial any longer, delete it and the resource group in the portal. To do so, select the **tutorial-iot-hub-rg** resource group that contains your IoT hub and select **Delete**.
293+
294+
Alternatively, use the CLI:
295+
296+
```azurecli-interactive
297+
# Delete your resource group and its contents
298+
az group delete --name tutorial-iot-hub-rg
299+
```
300+
250301
## Next steps
251302

252303
You have successfully created a logic app that connects your IoT hub and your mailbox for temperature monitoring and notifications.
122 KB
Loading
122 KB
Loading

0 commit comments

Comments
 (0)