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
In this tutorial, you create an Azure Stream Analytics job in the Azure portal and then deploy it as an IoT Edge module with no additional code.
16
+
In this tutorial, you create an Azure Stream Analytics job in the Azure portal and then deploy it as an IoT Edge module with no extra code.
17
17
18
18
You learn how to:
19
19
> [!div class="checklist"]
@@ -44,7 +44,7 @@ Azure Stream Analytics provides a richly structured query syntax for data analys
44
44
45
45
## Create an Azure Stream Analytics job
46
46
47
-
In this section, you create an Azure Stream Analytics job that will do the following steps:
47
+
In this section, you create an Azure Stream Analytics job that does the following steps:
48
48
49
49
* Receive data from your IoT Edge device.
50
50
* Query the telemetry data for values outside a set range.
@@ -85,9 +85,9 @@ When you create an Azure Stream Analytics job to run on an IoT Edge device, it n
85
85
| ----- | ----- |
86
86
| Name | Provide a name for your job. For example, **IoTEdgeJob**|
87
87
| Subscription | Choose the same subscription as your IoT hub. |
88
-
| Resource group | We recommend to use the same resource group for all test resources you create during the IoT Edge quickstarts and tutorials. For example, a resource named **IoTEdgeResources**. |
88
+
| Resource group | We recommend using the same resource group for all test resources you create during the IoT Edge quickstarts and tutorials. For example, a resource named **IoTEdgeResources**. |
89
89
| Region | Choose a location close to you. |
90
-
| Hosting environment | Select **Edge**. This option means deployment will go to an IoT Edge device instead of being hosted in the cloud. |
90
+
| Hosting environment | Select **Edge**. This option means deployment goes to an IoT Edge device instead of being hosted in the cloud. |
91
91
92
92
1. Select **Review + create**.
93
93
@@ -145,7 +145,7 @@ This section creates a job that receives temperature data from an IoT Edge devic
145
145
HAVINGAvg(machine.temperature) >70
146
146
```
147
147
148
-
In this query, the SQL code sends a reset command to the alert output if the average machine temperature in a 30-second window reaches 70 degrees. The reset command has been pre-programmed into the sensor as an action that can be taken.
148
+
In this query, the SQL code sends a reset command to the alert output if the average machine temperature in a 30-second window reaches 70 degrees. The reset command has been preprogrammed into the sensor as an action that can be taken.
149
149
150
150
1. Select**Save query**.
151
151
@@ -165,19 +165,19 @@ To prepare your Stream Analytics job to be deployed on an IoT Edge device, you n
165
165
166
166
## Deploy the job
167
167
168
-
You are now ready to deploy the Azure Stream Analytics job on your IoT Edge device.
168
+
You're now ready to deploy the Azure Stream Analytics job on your IoT Edge device.
169
169
170
-
In this section, you use the **Set Modules** wizard in the Azure portal to create a *deployment manifest*. A deployment manifest is a JSON file that describes all the modules that will be deployed to a device, the container registries that store the module images, how the modules should be managed, and how the modules can communicate with each other. Your IoT Edge device retrieves its deployment manifest from IoT Hub, then uses the information in it to deploy and configure all of its assigned modules.
170
+
In this section, you use the **Set Modules** wizard in the Azure portal to create a *deployment manifest*. A deployment manifest is a JSON file that describes all the modules that get deployed to a device. The manifest also shows the container registries that store the module images, how the modules should be managed, and how the modules can communicate with each other. Your IoT Edge device retrieves its deployment manifest from IoT Hub, then uses the information in it to deploy and configure all of its assigned modules.
171
171
172
-
For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSensor**, which is a module that simulates a temperature and humidity sensor. The second is your Stream Analytics job. The sensor module provides the stream of data that your job query will analyze.
172
+
For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSensor**, which is a module that simulates a temperature and humidity sensor. The second is your Stream Analytics job. The sensor module provides the stream of data that your job query analyzes.
173
173
174
174
1. In the Azure portal, navigate to your IoT hub.
175
175
176
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
-
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:
180
+
1. If you previously deployed the SimulatedTemperatureSensor module on this device, it might autopopulate. If it doesn't, add the module with the following steps:
181
181
182
182
1. Select **+ Add** and choose **IoT Edge Module**.
183
183
1. For the name, type **SimulatedTemperatureSensor**.
@@ -200,9 +200,9 @@ For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSe
200
200
201
201
1. Select **Create**.
202
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.
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 modules, or wait a few more minutes then refresh it again.
204
204
205
-
:::image type="content" source="media/tutorial-deploy-stream-analytics/module-confirmation.png" alt-text="Screenshot of .":::
205
+
:::image type="content" source="media/tutorial-deploy-stream-analytics/module-confirmation.png" alt-text="Screenshot that shows your modules list of your device in the Azure portal.":::
206
206
207
207
### Understand the two new modules
208
208
@@ -220,14 +220,18 @@ For this tutorial, you deploy two modules. The first is **SimulatedTemperatureSe
220
220
221
221
1. On the **Set modules on device:<your-device-name>** page, select **Next: Routes**.
222
222
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.
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.
224
+
225
+
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. This module should be the same name you see in the modules list of your device on the **Set modules** page, as shown in the Azure portal.
226
+
227
+
:::image type="content" source="media/tutorial-deploy-stream-analytics/stream-analytics-module-name.png" alt-text="Screenshot showing the name of your Stream Analytics modules in your I o T Edge device in the Azure portal." lightbox="media/tutorial-deploy-stream-analytics/stream-analytics-module-name.png":::
224
228
225
229
| Name | Value |
226
230
| --- | --- |
227
-
| `telemetryToCloud` | `FROM /messages/modules/SimulatedTemperatureSensor/* INTO $upstream` |
228
-
| `alertsToCloud` | `FROM /messages/modules/{moduleName}/* INTO $upstream` |
229
-
| `alertsToReset` | `FROM /messages/modules/{moduleName}/* INTO BrokeredEndpoint("/modules/SimulatedTemperatureSensor/inputs/control")` |
230
-
| `telemetryToAsa` | `FROM /messages/modules/SimulatedTemperatureSensor/* INTO BrokeredEndpoint("/modules/{moduleName}/inputs/temperature")`|
231
+
| telemetryToCloud | FROM /messages/modules/SimulatedTemperatureSensor/* INTO $upstream |
232
+
| alertsToCloud | FROM /messages/modules/{moduleName}/* INTO $upstream |
233
+
| alertsToReset | FROM /messages/modules/{moduleName}/* INTO BrokeredEndpoint("/modules/SimulatedTemperatureSensor/inputs/control") |
234
+
| telemetryToAsa | FROM /messages/modules/SimulatedTemperatureSensor/* INTO BrokeredEndpoint("/modules/{moduleName}/inputs/temperature")|
231
235
232
236
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.
233
237
@@ -264,7 +268,7 @@ Now you can go to your IoT Edge device to see the interaction between the Azure
264
268
265
269
You can watch the machine's temperature gradually rise until it reaches 70 degrees for 30 seconds. Then the Stream Analytics module triggers a reset, and the machine temperature drops back to 21.
266
270
267
-

271
+
:::image type="content" source="./media/tutorial-deploy-stream-analytics/docker-log.png" alt-text="Screenshot that shows the reset command in your output from your module logs.":::
268
272
269
273
## Clean up resources
270
274
@@ -276,7 +280,7 @@ Otherwise, you can delete the local configurations and the Azure resources that
276
280
277
281
## Next steps
278
282
279
-
In this tutorial, you configured an Azure Streaming Analytics job to analyze data from your IoT Edge device. You then loaded this Azure Stream Analytics module on your IoT Edge device to process and react to temperature increase locally, as well as sending the aggregated data stream to the cloud. To see how Azure IoT Edge can create more solutions for your business, continue on to the other tutorials.
283
+
In this tutorial, you configured an Azure Streaming Analytics job to analyze data from your IoT Edge device. You then loaded this Azure Stream Analytics module on your IoT Edge device to process and react to temperature increase locally, and sending the aggregated data stream to the cloud. To see how Azure IoT Edge can create more solutions for your business, continue on to the other tutorials.
280
284
281
285
> [!div class="nextstepaction"]
282
286
> [Deploy an Azure Machine Learning model as a module](tutorial-deploy-machine-learning.md)
0 commit comments