You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/iot-edge/tutorial-deploy-stream-analytics.md
+42-29Lines changed: 42 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
-
title: 'Tutorial - Deploy Azure Stream Analytics as an IoT Edge module'
3
-
description: 'In this tutorial, you deploy Azure Stream Analytics as a module to an IoT Edge device.'
2
+
title: "Tutorial - Deploy Azure Stream Analytics as an IoT Edge module"
3
+
description: "In this tutorial, you deploy Azure Stream Analytics as a module to an IoT Edge device."
4
4
author: PatAltimore
5
5
ms.author: patricka
6
-
ms.date: 3/8/2023
6
+
ms.date: 3/10/2023
7
7
ms.topic: tutorial
8
8
ms.service: iot-edge
9
9
ms.custom: mvc
@@ -151,17 +151,17 @@ This section creates a job that receives temperature data from an IoT Edge devic
151
151
152
152
### Configure IoT Edge settings
153
153
154
-
To prepare your Stream Analytics job to be deployed on an IoT Edge device, you need to associate the job with a storage account. When you go to deploy your job, the job definition is exported to the storage account in the form of a container.
154
+
To prepare your Stream Analytics job to be deployed on an IoT Edge device, you need to associate your Azure Stream Analytics job with a storage account. When you deploy your job, the job definition is exported to the storage account in the form of a container.
155
155
156
-
1. Under **Configure**, select**Storage account settings** then select**Add storage account**.
1. In your Stream Analytics service under the **Settings** menu, select**Storage account settings**.
159
157
160
158
1. Choose the **Select Blob storage/ADLS Gen 2from your subscriptions** option.
161
159
162
-
1. Use the drop-down menus to select the **Subscription**and**Storage account** that you set up at the beginning of this tutorial.
160
+
1. Your Azure storage account automatically shows on the page. If you don't see one, make sure you [create a storage](#create-a-storage-account). Or if you need to choose a different storage than the one listed in the **Storage account** field, select it from the dropdown menu.
161
+
162
+
1. Select **Save**, if you had to make any changes.
163
163
164
-
1. Select**Save**.
164
+
:::image type="content" source="./media/tutorial-deploy-stream-analytics/add-storage-account.png" alt-text="Screenshot of where to add a storage account in your Stream Analytics job in the Azure portal.":::
165
165
166
166
## Deploy the job
167
167
@@ -173,40 +173,54 @@ For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSe
173
173
174
174
1. In the Azure portal, navigate to your IoT hub.
175
175
176
-
1. Select**Devices** under the **Device management** menu, and then open the details page for your IoT Edge device.
176
+
1. Select **Devices** under the **Device management** menu, and then select your IoT Edge device to open it.
177
177
178
178
1. Select **Set modules**.
179
179
180
180
1. If you previously deployed the SimulatedTemperatureSensor module on this device, it might autopopulate. If it does not, add the module with the following steps:
181
181
182
-
1. Click**Add**andselect**IoT Edge Module**.
182
+
1. Select **+ Add** and choose **IoT Edge Module**.
183
183
1. For the name, type **SimulatedTemperatureSensor**.
184
-
1. For the image URI, enter **mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0**.
185
-
1. Leave the other settings unchanged andselect**Add**.
184
+
1. For the image URI, enter **mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.4**.
185
+
1. Leave the other default settings, then select **Add**.
186
186
187
187
1. Add your Azure Stream Analytics Edge job with the following steps:
1. Select **+ Add** and choose **Azure Stream Analytics Module**.
190
190
1. Select your subscription and the Azure Stream Analytics Edge job that you created.
191
191
1. Select **Save**.
192
192
193
193
Once you save your changes, the details of your Stream Analytics job are published to the storage container that you created.
194
194
195
-
1. When the Stream Analytics module is added to the list of modules, select its name to see how it's structured and update its settings on the **Update IoT Edge Module** page.
195
+
1. After your Stream Analytics addition finishes deployment, confirm that two new modules appear on your **Set modules** page.
196
+
197
+
:::image type="content" source="media/tutorial-deploy-stream-analytics/two-new-modules.png" alt-text="Screenshot confirming that two new modules are on your device. The screenshot also shows where the Review + create button is located.":::
198
+
199
+
1. Select **Review + create**. The deployment manifest appears.
200
+
201
+
1. Select **Create**.
202
+
203
+
1. On your **Set modules** page of your device, after a few minutes, you should see the modules listed and running. Refresh the page if you don't see this, or wait a few more minutes then refresh it again.
204
+
205
+
:::image type="content" source="media/tutorial-deploy-stream-analytics/module-confirmation.png" alt-text="Screenshot of .":::
196
206
197
-
The **Module Settings** tab has the **image URI** that points to a standard Azure Stream Analytics image. This one image is used for every Stream Analytics module that gets deployed to an IoT Edge device.
207
+
### Understand the two new modules
208
+
209
+
1. From the **Set modules** tab of your device, select your Stream Analytics module name to take you to the **Update IoT Edge Module** page. Here you can update the settings.
210
+
211
+
The **Settings** tab has the **Image URI** that points to a standard Azure Stream Analytics image. This single image is used for every Stream Analytics module that gets deployed to an IoT Edge device.
198
212
199
213
The **Module Twin Settings** tab shows the JSON that defines the Azure Stream Analytics (ASA) property called **ASAJobInfo**. The value of that property points to the job definition in your storage container. This property is how the Stream Analytics image is configured with your specific job details.
200
214
201
215
By default, the Stream Analytics module takes the same name as the job it's based on. You can change the module name on this page if you like, but it's not necessary.
202
216
203
-
1. Select **Apply** or **Cancel**.
217
+
1. Select**Apply**if you made changes or**Cancel** if you didn't make any changes.
204
218
205
-
1. Make a note of the name of your Stream Analytics module because you'll need it in the next step.
219
+
### Assign routes to your modules
206
220
207
-
1. Select**Next: Routes**.
221
+
1. On the **Set modules on device:<your-device-name>** page, select **Next: Routes**.
208
222
209
-
1. On the **Routes** tab, you define how messages are passed between modules and the IoT Hub. Messages are constructed using name and value pairs. Replace the default route nameandvalues with the pairs shown in following table. Replacing instances of {moduleName}_ with the name of your Azure Stream Analytics module.
223
+
1. On the **Routes** tab, you define how messages are passed between modules and the IoT Hub. Messages are constructed using name and value pairs. Add the route names and values with the pairs shown in following table. Replace instances of `{moduleName}` with the name of your Azure Stream Analytics module.
210
224
211
225
| Name | Value |
212
226
| --- | --- |
@@ -215,21 +229,20 @@ For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSe
215
229
| `alertsToReset` | `FROM /messages/modules/{moduleName}/* INTO BrokeredEndpoint("/modules/SimulatedTemperatureSensor/inputs/control")` |
216
230
| `telemetryToAsa` | `FROM /messages/modules/SimulatedTemperatureSensor/* INTO BrokeredEndpoint("/modules/{moduleName}/inputs/temperature")`|
217
231
218
-
The routes that you declare here define the flow of data through the IoT Edge device. The telemetry data from SimulatedTemperatureSensor are sent to IoT Hub and to the **temperature** input that was configured in the Stream Analytics job. The **alert** output messages are sent to IoT Hub and to the SimulatedTemperatureSensor module to trigger the reset command.
232
+
The routes you declare here define the flow of data through the IoT Edge device. The telemetry data from SimulatedTemperatureSensor are sent to IoT Hub and to the **temperature** input that was configured in the Stream Analytics job. The **alert** output messages are sent to IoT Hub and to the SimulatedTemperatureSensor module to trigger the reset command.
219
233
220
234
1. Select **Next: Review + Create**.
221
235
222
-
1. In the **Review + Create** tab, you can see how the information you provided in the wizard is converted into a JSON deployment manifest. When you're done reviewing the manifest, select **Create**.
223
-
224
-
1. Return to your device details page. Select **Refresh**.
225
-
226
-
You should see the new Stream Analytics module running, along with the IoT Edge agent and IoT Edge hub modules. It may take a few minutes for the information to reach your IoT Edge device, and then for the new modules to start. If you don't see the modules running right away, continue refreshing the page.
227
-
228
-

236
+
1. In the **Review + Create** tab, you can see how the information you provided in the wizard is converted into a JSON deployment manifest.
237
+
238
+
1. When you're done reviewing the manifest, select**Create** to finish setting your module.
229
239
230
240
## View data
231
241
232
-
Now you can go to your IoT Edge device to check out the interaction between the Azure Stream Analytics module and the SimulatedTemperatureSensor module.
242
+
Now you can go to your IoT Edge device to see the interaction between the Azure Stream Analytics module and the SimulatedTemperatureSensor module.
243
+
244
+
> [!NOTE]
245
+
> If you're using a virtual machine for a device, you can use the [Azure Cloud Shell](/azure/cloud-shell/overview.md) to directly access all Azure authenticated services.
233
246
234
247
1. Check that all the modules are running in Docker:
0 commit comments