Skip to content

Commit 7f07545

Browse files
committed
toc; prerequisite sdk samples; screenshots
1 parent 56f02f8 commit 7f07545

13 files changed

+44
-31
lines changed

articles/iot-hub/TOC.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
- name: Visualize data in an App Service web app
5151
displayName: Node.js
5252
href: iot-hub-live-data-visualization-in-web-apps.md
53+
- name: Monitor and notify with Logic Apps
54+
href: iot-hub-monitoring-notifications-with-azure-logic-apps.md
55+
5356
- name: Concepts
5457
items:
5558
- name: IoT Hub concepts overview
@@ -435,10 +438,6 @@
435438
- name: Raspberry Pi with C
436439
displayName: BME280 sensor
437440
href: iot-hub-raspberry-pi-kit-c-get-started.md
438-
- name: Extended IoT scenarios
439-
items:
440-
- name: Remote monitoring and notifications with Logic Apps
441-
href: iot-hub-monitoring-notifications-with-azure-logic-apps.md
442441
- name: Troubleshoot and problem solution
443442
items:
444443
- name: Troubleshoot device connectivity

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

Lines changed: 41 additions & 27 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: 07/18/2019
10+
ms.date: 02/02/2024
1111
---
1212

1313
# Tutorial: Monitor IoT devices and send notifications with Azure Logic Apps
@@ -25,7 +25,7 @@ In this tutorial, you perform the following tasks:
2525
> Create a route in your IoT hub that sends messages to the Service Bus queue if the messages contain anomalous temperature readings.
2626
> Create a logic app that watches for messaging arriving in the queue and sends an email alert.
2727
28-
The client code running on your device sets an application property, `temperatureAlert`, on every telemetry message it sends to your IoT hub. When the client code detects a temperature above 30 C, it sets this property to `true`; otherwise, it sets the property to `false`.
28+
The client code running on your device sets an application property, `temperatureAlert`, on every telemetry message it sends to your IoT hub. When the client code detects a temperature above a given threshold, it sets this property to `true`; otherwise, it sets the property to `false`.
2929

3030
Messages arriving at your IoT hub look similar to the following, with the telemetry data contained in the body and the `temperatureAlert` property contained in the application properties (system properties aren't shown):
3131

@@ -47,53 +47,67 @@ If you don't have an Azure subscription, [create a free account](https://azure.m
4747

4848
## Prerequisites
4949

50-
Before you begin this tutorial, complete one of the [Send telemetry](../iot-develop/quickstart-send-telemetry-iot-hub.md) quickstarts in the development language of your choice. Alternatively, you can use any device app that sends temperature telemetry; for example, the [Raspberry Pi online simulator](iot-hub-raspberry-pi-web-simulator-get-started.md). These articles cover the following requirements:
50+
Prepare the following prerequisites before beginning this tutorial.
5151

5252
* An active Azure subscription.
53-
* An Azure IoT hub in your subscription.
54-
* A client app that sends temperature data to your Azure IoT hub.
53+
* An IoT hub in your subscription.
54+
* A client app that sends temperature data to your Azure IoT hub. This tutorial filters device-to-cloud messages based on a message property called `temperatureAlert`. Some samples that generate messages with this property include:
55+
56+
* .NET SDK: [SimulatedDevice](https://github.com/Azure/azure-iot-sdk-csharp/blob/main/iothub/device/samples/getting%20started/SimulatedDevice/Program.cs)
57+
* Java SDK: [send-event](https://github.com/Azure/azure-iot-sdk-java/blob/main/iothub/device/iot-device-samples/send-event/README.md)
58+
* Node.js SDK: [simple_sample_device](https://github.com/Azure/azure-iot-sdk-node/blob/main/device/samples/javascript/simple_sample_device.js)
59+
* C SDK: [iothub_II_client_shared_sample](https://github.com/Azure/azure-iot-sdk-c/blob/main/iothub_client/samples/iothub_ll_client_shared_sample/iothub_ll_client_shared_sample.c)
60+
* Codeless: [Raspberry Pi online simulator](iot-hub-raspberry-pi-web-simulator-get-started.md)
5561

5662
## Create Service Bus namespace and queue
5763

58-
Create a Service Bus namespace and queue. Later in this article, you create a routing rule in your IoT hub to direct messages that contain a temperature alert to the Service Bus queue, where they're picked up by a logic app and trigger it to send a notification email.
64+
Create a Service Bus namespace and queue. Later in this article, you create a routing rule in your IoT hub to direct messages that contain a temperature alert to the Service Bus queue. A logic app monitors the queue for incoming messages and sends a notification for each alert.
5965

6066
### Create a Service Bus namespace
6167

62-
1. On the [Azure portal](https://portal.azure.com/), select **+ Create a resource** > **Integration** > **Service Bus**.
68+
1. On the [Azure portal](https://portal.azure.com/), use the search bar to search for and select **Service Bus**.
69+
70+
1. Select **Create** to create a service bus namespace.
6371

6472
1. On the **Create namespace** pane, provide the following information:
6573

66-
**Name**: The name of the service bus namespace. The namespace must be unique across Azure.
74+
| Parameter | Value |
75+
| --------- | ----- |
76+
| **Subscription** | Choose the same subscription that contains your IoT hub. |
77+
| **Resource group** | Choose the same resource group that contains your IoT hub. |
78+
| **Namespace name** | Provide a name for your service bus namespace. The namespace must be unique across Azure. |
79+
| **Location** | Choose the same location that your IoT hub uses. |
80+
| **Pricing tier** | Select **Basic** from the drop-down list. The Basic tier is sufficient for this tutorial. |
6781

68-
**Pricing tier**: Select **Basic** from the drop-down list. The Basic tier is sufficient for this tutorial.
82+
1. Select **Review + create**.
6983

70-
**Resource group**: Use the same resource group that your IoT hub uses.
84+
1. Select **Create**.
7185

72-
**Location**: Use the same location that your IoT hub uses.
86+
1. Wait for the deployment to complete, then select **Go to resource**.
7387

74-
![Create a service bus namespace in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/1-create-service-bus-namespace-azure-portal.png)
88+
### Add a Service Bus queue to the namespace
7589

76-
1. Select **Create**. Wait for the deployment to complete before moving on to the next step.
90+
1. On the **Overview** page of your Service Bus namespace, select **Queue**.
7791

78-
### Add a Service Bus queue to the namespace
92+
:::image type="content" source="./media/iot-hub-monitoring-notifications-with-azure-logic-apps/namespace-add-queue.png" alt-text="Screenshot of the namespace overview page to add a queue.":::
7993

80-
1. Open the Service Bus namespace. The easiest way to get to the Service Bus namespace is to select **Resource groups** from the resource pane, select your resource group, then select the Service Bus namespace from the list of resources.
94+
1. In the **Name** field, provide a name for the queue. Accept the default values for the other fields and select **Create**.
8195

82-
1. On the **Service Bus Namespace** pane, select **+ Queue**.
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
8397

84-
1. Enter a name for the queue and then select **Create**. When the queue has been successfully created, the **Create queue** pane closes.
98+
:::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.":::
8599

86-
![Add a service bus queue in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/create-service-bus-queue.png)
100+
1. On the **Service Bus Queue** pane, select **Shared access policies** from the **Settings** section of the resource menu. Then, select **Add** to add a policy.
87101

88-
1. Back on the **Service Bus Namespace** pane, under **Entities**, select **Queues**. Open the Service Bus queue from the list, and then select **Shared access policies** > **+ Add**.
102+
:::image type="content" source="./media/iot-hub-monitoring-notifications-with-azure-logic-apps/queue-shared-access-policies-add.png" alt-text="Screenshot that shows adding a shared access policy to a Service Bus queue.":::
89103

90-
1. Enter a name for the policy, check **Manage**, and then select **Create**.
104+
1. In the **Policy name** field, provide a name for the policy. Check **Manage**, and then select **Create**.
91105

92-
![Add a service bus queue policy in the Azure portal](media/iot-hub-monitoring-notifications-with-azure-logic-apps/2-add-service-bus-queue-azure-portal.png)
106+
:::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.":::
93107

94108
## Add a custom endpoint and routing rule to your IoT hub
95109

96-
Add a custom endpoint for the Service Bus queue to your IoT hub and 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).
110+
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).
97111

98112
### Add a custom endpoint and route
99113

@@ -108,11 +122,11 @@ Add a custom endpoint for the Service Bus queue to your IoT hub and create a mes
108122
| Parameter | Value |
109123
| --------- | ----- |
110124
| **Endpoint type** | Select **Service Bus queue**. |
111-
| **Endpoint name** | Provide a unique name for a new endpoint, or select **Select existing** to choose an existing Service Bus queue endpoint. |
112-
| **Service Bus namespace** | Use the drop-down menu to select an existing Service Bus namespace in your subscription. |
113-
| **Service Bus queue** | Use the drop-down menu to select an existing queue in your namespace. |
125+
| **Endpoint name** | Provide a name for the new endpoint that maps to your Service Bus queue. |
126+
| **Service Bus namespace** | Use the drop-down menu to select the Service Bus namespace that you created in the previous section. |
127+
| **Service Bus queue** | Use the drop-down menu to select the Service Bus queue that you created in your namespace. |
114128

115-
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/3-add-iot-hub-endpoint-azure-portal.png" alt-text="Screenshot that shows the Add a service bus queue endpoint pane.":::
129+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/add-a-route-endpoint.png" alt-text="Screenshot that shows how to create a service bus queue endpoint for your route.":::
116130

117131
1. Select **Create + next**.
118132

@@ -124,7 +138,7 @@ Add a custom endpoint for the Service Bus queue to your IoT hub and create a mes
124138
| **Data source** | Keep the default **Device Telemetry Message** data source. |
125139
| **Routing query** | Enter `temperatureAlert = "true"` as the query string. |
126140

127-
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/4-add-routing-rule-azure-portal.png" alt-text="Screenshot that shows adding a route with a query.":::
141+
:::image type="content" source="media/iot-hub-monitoring-notifications-with-azure-logic-apps/add-a-route-route.png" alt-text="Screenshot that shows adding a route with a query.":::
128142

129143
1. Select **Create + skip enrichments**.
130144

79.7 KB
Loading
52.7 KB
Loading
20.9 KB
Loading

0 commit comments

Comments
 (0)