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-central/core/howto-configure-file-uploads.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ To configure device file uploads:
40
40
41
41
1. Select **Save**. When the status shows **Configured**, you're ready to upload files from devices.
42
42
43
-
:::image type="content" source="media/howto-configure-file-uploads/file-upload-configuration.png" alt-text="Configure file upload in application":::
43
+
:::image type="content" source="media/howto-configure-file-uploads/file-upload-configuration.png" alt-text="Screenshot that shows a properly configured file upload." lightbox="media/howto-configure-file-uploads/file-upload-configuration.png":::
44
44
45
45
## Disable device file uploads
46
46
@@ -69,7 +69,7 @@ If you enabled access to files in the file upload configuration, users with the
69
69
70
70
To view and delete uploaded files, navigate to the **Files** view for a device. On this page, you can see thumbnails of the uploaded files and toggle between a gallery and list view. Each file has options to download or delete it:
71
71
72
-
:::image type="content" source="media/howto-configure-file-uploads/file-upload-list-files.png" alt-text="Screenshot that shows the gallery view for uploaded files.":::
72
+
:::image type="content" source="media/howto-configure-file-uploads/file-upload-list-files.png" alt-text="Screenshot that shows the gallery view for uploaded files." lightbox="media/howto-configure-file-uploads/file-upload-list-files.png":::
73
73
74
74
> [!TIP]
75
75
> The file type is determined by the mime type assigned to the file when it was uploaded to blob storage. The default type is `binary/octet-stream`.
@@ -78,7 +78,7 @@ You can customize the list view by filtering based on file name and choosing the
78
78
79
79
To preview the content of the file and get more information about the file, select it. IoT Central supports previews of common file types such as text and images:
80
80
81
-
:::image type="content" source="media/howto-configure-file-uploads/file-upload-preview.png" alt-text="Screenshot that shows a preview of a text file.":::
81
+
:::image type="content" source="media/howto-configure-file-uploads/file-upload-preview.png" alt-text="Screenshot that shows a preview of a text file." lightbox="media/howto-configure-file-uploads/file-upload-preview.png":::
Copy file name to clipboardExpand all lines: articles/iot-central/core/howto-configure-rules.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,18 +19,18 @@ Rules in IoT Central serve as a customizable response tool that trigger on activ
19
19
20
20
Use the target devices section to select on what kind of devices this rule will be applied. Filters allow you to further refine what devices should be included. The filters use properties on the device template to filter down the set of devices. Filters themselves don't trigger an action. In the following screenshot, the devices that are being targeted are of device template type **Refrigerator**. The filter states that the rule should only include **Refrigerators** where the **Manufactured State** property equals **Washington**.
21
21
22
-
:::image type="content" source="media/howto-configure-rules/filters.png" alt-text="Screenshot that shows a condition definition.":::
22
+
:::image type="content" source="media/howto-configure-rules/filters.png" alt-text="Screenshot that shows a filter definition in a rule." lightbox="media/howto-configure-rules/filters.png":::
23
23
24
24
## Use multiple conditions
25
25
26
26
Conditions are what rules trigger on. You can add multiple conditions to a rule and specify if the rule should trigger when all the conditions are true or any of the conditions are true.
27
27
28
-
In the following screenshot, the conditions check when the temperature is greater than 70° F and the humidity is less than 10. When any of these statements are true, the rule evaluates to true and triggers an action.
28
+
In the following screenshot, the conditions check when the temperature is greater than 70° F and the humidity is less than 10%. When any of these statements are true, the rule evaluates to true and triggers an action.
29
29
30
30
:::image type="content" source="media/howto-configure-rules/conditions.png" alt-text="Screenshot shows a refrigerator monitor with conditions specified for temperature and humidity." lightbox="media/howto-configure-rules/conditions.png":::
31
31
32
32
> [!NOTE]
33
-
> Currently only Telemetry Conditions are supported.
33
+
> Currently only telemetry conditions are supported.
34
34
35
35
### Use a cloud property in a value field
36
36
@@ -42,13 +42,13 @@ If you choose an event type telemetry value, the **Value** drop-down includes th
42
42
43
43
You can specify a time aggregation to trigger your rule based on a time window. Rule conditions evaluate aggregate time windows on telemetry data as tumbling windows. If there are any property filters in the rule, they're applied at the end of the time window. In the screenshot below, the time window is five minutes. Every five minutes, the rule evaluates on the last five minutes of telemetry data. The data is only evaluated once in the window to which it corresponds.
44
44
45
-
:::image type="content" source="media/howto-configure-rules/tumbling-window.png" alt-text="A diagram showing how tumbling windows are defined.":::
45
+
:::image type="content" source="media/howto-configure-rules/tumbling-window.png" alt-text="A diagram showing how tumbling windows are defined." border="false":::
46
46
47
47
## Create an email action
48
48
49
49
When you create an email action, the email address must be a **user ID** in the application, and the user must have signed in to the application at least once. You can also specify a note to include in the email. IoT Central shows an example of what the email will look like when the rule triggers:
50
50
51
-
:::image type="content" source="media/howto-configure-rules/email-action.png" alt-text="Screenshot that shows an email action for a rule.":::
51
+
:::image type="content" source="media/howto-configure-rules/email-action.png" alt-text="Screenshot that shows an email action for a rule." lightbox="media/howto-configure-rules/email-action.png":::
52
52
53
53
## Create a webhook action
54
54
@@ -62,7 +62,7 @@ In this example, you connect to *RequestBin* to get notified when a rule fires:
62
62
63
63
1. Add an action to your rule:
64
64
65
-
:::image type="content" source="media/howto-configure-rules/webhook-create.png" alt-text="Screenshot that shows the webhook creation screen.":::
65
+
:::image type="content" source="media/howto-configure-rules/webhook-create.png" alt-text="Screenshot that shows the webhook creation screen." lightbox="media/howto-configure-rules/webhook-create.png":::
66
66
67
67
1. Choose the webhook action, enter a display name, and paste the RequestBin URL as the **Callback URL**.
68
68
@@ -193,15 +193,15 @@ An action group can:
193
193
194
194
The following screenshot shows an action group that sends email and SMS notifications and calls a webhook:
195
195
196
-
:::image type="content" source="media/howto-configure-rules/action-group.png" alt-text="Screenshot that shows an action group in the Azure portal.":::
196
+
:::image type="content" source="media/howto-configure-rules/action-group.png" alt-text="Screenshot that shows an action group in the Azure portal." lightbox="media/howto-configure-rules/action-group.png":::
197
197
198
198
To use an action group in an IoT Central rule, the action group must be in the same Azure subscription as the IoT Central application.
199
199
200
200
When you add an action to the rule in IoT Central, select **Azure Monitor Action Groups**.
201
201
202
202
Choose an action group from your Azure subscription:
203
203
204
-
:::image type="content" source="media/howto-configure-rules/choose-action-group.png" alt-text="Screenshot that shows an action group in an IoT Central rule.":::
204
+
:::image type="content" source="media/howto-configure-rules/choose-action-group.png" alt-text="Screenshot that shows an action group in an IoT Central rule." lightbox="media/howto-configure-rules/choose-action-group.png":::
205
205
206
206
Select **Save**. The action group now appears in the list of actions to run when the rule is triggered.
Copy file name to clipboardExpand all lines: articles/iot-central/core/howto-create-custom-rules.md
+42-44Lines changed: 42 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Extend Azure IoT Central with custom rules and notifications | Microsoft
3
3
description: As a solution developer, configure an IoT Central application to send email notifications when a device stops sending telemetry. This solution uses Azure Stream Analytics, Azure Functions, and SendGrid.
4
4
author: dominicbetts
5
5
ms.author: dobett
6
-
ms.date: 06/21/2022
6
+
ms.date: 11/08/2022
7
7
ms.topic: how-to
8
8
ms.service: iot-central
9
9
services: iot-central
@@ -43,9 +43,9 @@ Create an IoT Central application on the [Azure IoT Central application manager]
43
43
| URL | Accept the default or choose your own unique URL prefix |
44
44
| Directory | Your Azure Active Directory tenant |
45
45
| Azure subscription | Your Azure subscription |
46
-
|Region| Your nearest region|
46
+
|Location| Your nearest Azure data center|
47
47
48
-
The examples and screenshots in this article use the **United States** region. Choose a location close to you and make sure you create all your resources in the same region.
48
+
The examples and screenshots in this article use the **East US*** location. Choose a location close to you and make sure you create all your resources in the same location.
49
49
50
50
This application template includes two simulated thermostat devices that send telemetry.
51
51
@@ -88,24 +88,27 @@ Use the [Azure portal to create a function app](https://portal.azure.com/#create
88
88
| App name | Choose your function app name |
89
89
| Subscription | Your subscription |
90
90
| Resource group | DetectStoppedDevices |
91
-
| OS | Windows |
92
-
| Hosting Plan | Consumption Plan |
93
-
| Location | East US |
91
+
| Publish | Code |
94
92
| Runtime Stack | .NET |
93
+
| Region | East US |
94
+
| OS | Windows |
95
+
| Hosting Plan | Consumption (Serverless) |
95
96
| Storage | Create new |
96
97
97
98
### SendGrid account and API Keys
98
99
99
100
If you don't have a Sendgrid account, create a [free account](https://app.sendgrid.com/) before you begin.
100
101
101
-
1. From the Sendgrid DashboardSettings on the left menu, select **API Keys**.
102
-
1.Click**Create API Key.**
102
+
1. From the Sendgrid Dashboard, select **Settings** on the left menu, select **Settings > API Keys**.
103
+
1.Select**Create API Key.**
103
104
1. Name the new API key **AzureFunctionAccess.**
104
-
1. Click **Create & View**.
105
+
1. Select **Create & View**.
106
+
107
+
:::image type="content" source="media/howto-create-custom-rules/sendgrid-api-keys.png" alt-text="Screenshot that shows how to create a SendGrid API key." lightbox="media/howto-create-custom-rules/sendgrid-api-keys.png":::
105
108
106
-
:::image type="content" source="media/howto-create-custom-rules/sendgrid-api-keys.png" alt-text="Screenshot of the Create SendGrid API key.":::
109
+
Make a note of the generated API key, you use it later.
107
110
108
-
Afterwards, you will be given an API key. Save this string for later use.
111
+
Create a **Single Sender Verification** in your SendGrid account for the email address you'll use as the **From** address.
109
112
110
113
## Create an event hub
111
114
@@ -114,26 +117,24 @@ You can configure an IoT Central application to continuously export telemetry to
114
117
1. In the Azure portal, navigate to your Event Hubs namespace and select **+ Event Hub**.
115
118
1. Name your event hub **centralexport**, and select **Create**.
116
119
117
-
Your Event Hubs namespace looks like the following screenshot:
118
-
119
-
:::image type="content" source="media/howto-create-custom-rules/event-hubs-namespace.png" alt-text="Screenshot of Event Hubs namespace." border="false":::
120
+
:::image type="content" source="media/howto-create-custom-rules/event-hubs-namespace.png" alt-text="Screenshot of the Event Hubs namespace with an event hub." border="false" lightbox="media/howto-create-custom-rules/event-hubs-namespace.png":::
120
121
121
122
## Define the function
122
123
123
124
This solution uses an Azure Functions app to send an email notification when the Stream Analytics job detects a stopped device. To create your function app:
124
125
125
-
1. In the Azure portal, navigate to the **App Service** instance in the **DetectStoppedDevices** resource group.
126
-
1. Select **+** to create a new function.
127
-
1. Select **HTTP Trigger**.
128
-
1. Select **Add**.
126
+
1. In the Azure portal, navigate to the **Function App** instance in the **DetectStoppedDevices** resource group.
127
+
1. Select **Functions**, then **+ Create** to create a new function.
128
+
1. Select **HTTP Trigger** as the function template.
129
+
1. Select **Create**.
129
130
130
-
:::image type="content" source="media/howto-create-custom-rules/add-function.png" alt-text="Image of the Default HTTP trigger function":::
131
+
:::image type="content" source="media/howto-create-custom-rules/add-function.png" alt-text="Screenshot of the Azure portal that shows how to create an HTTP trigger function." lightbox="media/howto-create-custom-rules/add-function.png":::
131
132
132
133
## Edit code for HTTP Trigger
133
134
134
-
The portal creates a default function called **HttpTrigger1**:
135
+
The portal creates a default function called **HttpTrigger1**. Select **Code + Test**:
135
136
136
-
:::image type="content" source="media/howto-create-custom-rules/default-function.png" alt-text="Screenshot of Edit HTTP trigger function.":::
137
+
:::image type="content" source="media/howto-create-custom-rules/default-function.png" alt-text="Screenshot that shows the default function code." lightbox="media/howto-create-custom-rules/default-function.png":::
137
138
138
139
1. Replace the C# code with the following code:
139
140
@@ -174,7 +175,6 @@ The portal creates a default function called **HttpTrigger1**:
174
175
}
175
176
```
176
177
177
-
Youmayseeanerrormessageuntilyousavethenewcode.
178
178
1. Select**Save**tosavethefunction.
179
179
180
180
## Add SendGrid Key
@@ -184,48 +184,46 @@ To add your SendGrid API Key, you need to add it to your **Function Keys** as fo
:::imagetype="content"source="media/howto-create-custom-rules/add-key.png"alt-text="Screenshot of Add Sangrid Key.":::
187
+
1. Select**OK.**
190
188
189
+
:::imagetype="content"source="media/howto-create-custom-rules/add-key.png"alt-text="Screenshot of function keys including the SendGridAPI key."lightbox="media/howto-create-custom-rules/add-key.png":::
191
190
192
191
## Configure HttpTrigger function to use SendGrid
193
192
194
193
TosendemailswithSendGrid, youneedtoconfigurethebindingsfor your function as follows:
195
194
196
-
1. Select **Integrate**.
197
-
1. Choose **Add Output** under **HTTP ($return)**.
:::imagetype="content"source="media/howto-create-custom-rules/add-output.png"alt-text="Screenshot of Add SandGrid Output.":::
212
+
1. Select**Save**.
216
213
214
+
:::imagetype="content"source="media/howto-create-custom-rules/add-output.png"alt-text="Screenshot of the SendGrid output configuration."lightbox="media/howto-create-custom-rules/add-output.png":::
:::image type="content" source="media/howto-create-custom-rules/function-app-logs.png" alt-text="Screenshot that shows the function log output." lightbox="media/howto-create-custom-rules/function-app-logs.png":::
229
227
230
228
After a few minutes, the **To** email address receives an email with the following content:
231
229
@@ -306,9 +304,9 @@ This solution uses a Stream Analytics query to detect when a device stops sendin
306
304
1. Select**Save**.
307
305
1. To start the Stream Analytics job, choose **Overview**, then **Start**, then **Now**, and then **Start**:
308
306
309
-
:::image type="content" source="media/howto-create-custom-rules/stream-analytics.png" alt-text="Screenshot of Stream Analytics.":::
307
+
:::image type="content" source="media/howto-create-custom-rules/stream-analytics.png" alt-text="Screenshot of Stream Analytics overview page." lightbox="media/howto-create-custom-rules/stream-analytics.png":::
310
308
311
-
## Configure export in IoT Central
309
+
## Configure export in IoT Central
312
310
313
311
On the [Azure IoT Central application manager](https://aka.ms/iotcentral) website, navigate to the IoT Central application you created.
314
312
@@ -322,10 +320,10 @@ In this section, you configure the application to stream the telemetry from its
322
320
| Display Name | Export to Event Hubs |
323
321
| Enabled | On |
324
322
| Type of data to export | Telemetry |
325
-
| Enrichments | Enter desired key / Value of how you want the exported data to be organized |
323
+
| Enrichments | Enter desired key / Value of how you want the exported data to be organized |
326
324
| Destination | Create New and enter information for where the data will be exported |
327
325
328
-
:::image type="content" source="media/howto-create-custom-rules/cde-configuration.png" alt-text="Screenshot of the Data Export.":::
326
+
:::image type="content" source="media/howto-create-custom-rules/cde-configuration.png" alt-text="Screenshot of the data export settings in IoT Central." lightbox="media/howto-create-custom-rules/cde-configuration.png":::
329
327
330
328
Wait until the export status is **Running** before you continue.
0 commit comments