Skip to content

Commit db3e63b

Browse files
committed
Tidy third IoT central quickstart
1 parent 49f47ed commit db3e63b

File tree

3 files changed

+39
-91
lines changed

3 files changed

+39
-91
lines changed

articles/iot-central/core/quick-configure-rules.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Quickstart - Configure rules and actions in Azure IoT Central
3-
description: This quickstart shows you how to configure telemetry-based rules and actions in your IoT Central application.
3+
description: In this quickstart, you learn how to configure telemetry-based rules and actions in your IoT Central application.
44
author: dominicbetts
55
ms.author: dobett
66
ms.date: 09/26/2022
@@ -14,7 +14,7 @@ ms.custom: mvc, mode-other
1414

1515
# Quickstart: Configure rules and actions for your device in Azure IoT Central
1616

17-
Get started with IoT Central rules. In this quickstart you create a rule that sends an email when someone turns your phone over.
17+
Get started with IoT Central rules. IoT Central rules let you automate actions that occur in response to specific conditions. The example in this quickstart uses accelerometer telemetry from the phone to trigger a rule when the phone is turned over.
1818

1919
In this quickstart, you:
2020

articles/iot-central/core/quick-deploy-iot-central.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Quickstart - Connect a device to an Azure IoT Central application | Microsoft Docs
3-
description: In this quickstart you learn how to connect your first device to a new IoT Central application. This quickstart uses a smartphone app from either the Google Play or Apple app store as an IoT device.
3+
description: In this quickstart, you learn how to connect your first device to a new IoT Central application. This quickstart uses a smartphone app from either the Google Play or Apple app store as an IoT device.
44
author: dominicbetts
55
ms.author: dobett
66
ms.date: 09/26/2022
@@ -43,6 +43,8 @@ IoT Central provides various industry-focused application templates to help you
4343

4444
:::image type="content" source="media/quick-deploy-iot-central/iot-central-create-new-application.png" alt-text="Build your IoT application page":::
4545

46+
If you're prompted to sign in, use the Microsoft account associated with your Azure subscription.
47+
4648
1. On the **New application** page, make sure that **Custom application** is selected under the **Application template**.
4749

4850
1. Azure IoT Central automatically suggests an **Application name** based on the application template you've selected. Enter your own application name such as *Contoso quickstart app*.

articles/iot-central/core/quick-export-data.md

Lines changed: 34 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Quickstart - Export data from Azure IoT Central
3-
description: In this quickstart you learn how to use the data export feature in IoT Central to integrate with other cloud services.
3+
description: In this quickstart, you learn how to use the data export feature in IoT Central to integrate with other cloud services.
44
author: dominicbetts
55
ms.author: dobett
66
ms.date: 09/26/2022
@@ -34,97 +34,37 @@ Completing this quickstart incurs a small cost in your Azure account for the Azu
3434

3535
## Install Azure services
3636

37-
Before you can export data from your IoT Central application, you need an Azure Data Explorer cluster and database. In this quickstart, you use the bash environment in the [Azure Cloud Shell](https://shell.azure.com) to create and configure them.
37+
Before you can export data from your IoT Central application, you need an Azure Data Explorer cluster and database. In this quickstart, you run a bash script in the [Azure Cloud Shell](https://shell.azure.com) to create and configure them.
3838

39-
Run the following script in the Azure Cloud Shell. Replace the `clustername` value with a unique name for your cluster before you run the script. The cluster name can contain only lowercase letters and numbers. Replace the `centralurlprefix` value with the URL prefix you chose in the first quickstart:
39+
The script completes the following steps:
4040

41-
> [!IMPORTANT]
42-
> The script can take 20 to 30 minutes to run.
41+
- Prompts you to sign in to your Azure subscription so that it can generate a bearer token to authenticate the REST API calls.
42+
- Creates an Azure Data Explorer cluster and database.
43+
- Creates a managed identity for your IoT Central application.
44+
- Configures the managed identity with permission to access the Azure Data Explorer database.
45+
- Adds a table to the database to store the incoming telemetry from IoT Central.
46+
47+
Run the following commands to download the script to your Azure Cloud Shell environment:
4348

4449
```azurecli
45-
# The cluster name can contain only lowercase letters and numbers.
46-
# It must contain from 4 to 22 characters.
47-
clustername="<A unique name for your cluster>"
48-
49-
centralurlprefix="<The URL prefix of your IoT Central application>"
50-
51-
databasename="phonedata"
52-
location="eastus"
53-
resourcegroup="IoTCentralExportData-rg"
54-
55-
az extension add -n kusto
56-
57-
# Create a resource group for the Azure Data Explorer cluster
58-
az group create --location $location \
59-
--name $resourcegroup
60-
61-
# Create the Azure Data Explorer cluster
62-
# This command takes at least 10 minutes to run
63-
az kusto cluster create --cluster-name $clustername \
64-
--sku name="Standard_D11_v2" tier="Standard" \
65-
--enable-streaming-ingest=true \
66-
--enable-auto-stop=true \
67-
--resource-group $resourcegroup --location $location
68-
69-
# Create a database in the cluster
70-
az kusto database create --cluster-name $clustername \
71-
--database-name $databasename \
72-
--read-write-database location=$location soft-delete-period=P365D hot-cache-period=P31D \
73-
--resource-group $resourcegroup
74-
75-
# Create and assign a managed identity to use
76-
# when authenticating from IoT Central.
77-
# This assumes your IoT Central was created in the default
78-
# IOTC resource group.
79-
MI_JSON=$(az iot central app identity assign --name $centralurlprefix \
80-
--resource-group IOTC --system-assigned)
81-
82-
## Assign the managed identity permissions to use the database.
83-
az kusto database-principal-assignment create --cluster-name $clustername \
84-
--database-name $databasename \
85-
--principal-id $(jq -r .principalId <<< $MI_JSON) \
86-
--principal-assignment-name $centralurlprefix \
87-
--resource-group $resourcegroup \
88-
--principal-type App \
89-
--tenant-id $(jq -r .tenantId <<< $MI_JSON) \
90-
--role Admin
91-
92-
echo "Azure Data Explorer URL: $(az kusto cluster show --name $clustername --resource-group $resourcegroup --query uri -o tsv)"
50+
wget https://raw.githubusercontent.com/Azure-Samples/iot-central-docs-samples/main/quickstart-cde/createADX.sh
51+
chmod u+x createADX.sh
9352
```
9453

95-
Make a note of the **Azure Data Explorer URL**. You use this value later in the quickstart.
96-
97-
## Configure the database
98-
99-
To add a table in the database to store the accelerometer data from the **IoT Plug and Play** smartphone app:
100-
101-
1. Use the **Azure Data Explorer URL** from the previous section to navigate to your Azure Data Explorer environment.
102-
103-
1. Expand the cluster node and select the **phonedata** database. The cope of the query window changes to `Scope:yourclustername.eastus/phonedata`.
104-
105-
1. Paste the following Kusto script into the query editor and select **Run**:
106-
107-
```kusto
108-
.create table acceleration (
109-
EnqueuedTime:datetime,
110-
Device:string,
111-
X:real,
112-
Y:real,
113-
Z:real
114-
);
115-
```
116-
117-
The result looks like the following screenshot:
54+
Use the following command to run the script:
11855

119-
:::image type="content" source="media/quick-export-data/azure-data-explorer-create-table.png" alt-text="Screenshot that shows the results of creating the table in Azure Data Explorer.":::
56+
- Replace `CLUSTER_NAME` with a unique name for your Azure Data Explorer cluster. The cluster name can contain only lowercase letters and numbers. The length of the cluster name must be between 4 and 22 characters.
57+
- Replace `CENTRAL_URL_PREFIX` with URL prefix you chose in the first quickstart for your IoT Central application.
58+
- When prompted, follow the instructions to sign in to your account. It's necessary for the script to sign in because it generates a bearer token to authenticate a REST API call.
12059

121-
1. In the Azure Data Explorer, open a new tab and paste in the following Kusto script. The script enables streaming ingress for the **acceleration** table:
60+
```azurecli
61+
./createADX.sh CLUSTER_NAME CENTRAL_URL_PREFIX
62+
```
12263

123-
```kusto
124-
.alter table acceleration policy streamingingestion enable;
125-
```
64+
> [!IMPORTANT]
65+
> This script can take 20 to 30 minutes to run.
12666
127-
Keep the Azure Data Explorer page open in your browser. After you configure the data export in your IoT Central application, you'll run a query to view the accelerometer telemetry stored in the **acceleration** table.
67+
Make a note of the **Azure Data Explorer URL** output by the script. You use this value later in the quickstart.
12868

12969
## Configure data export
13070

@@ -218,13 +158,19 @@ Wait until the export status shows **Healthy**:
218158

219159
## Query exported data
220160

221-
In Azure Data Explorer, open a new tab and paste in the following Kusto query and then select **Run** to plot the accelerometer telemetry:
161+
To query the exported telemetry:
222162

223-
```kusto
224-
['acceleration']
225-
| project EnqueuedTime, Device, X, Y, Z
226-
| render timechart
227-
```
163+
1. Use the **Azure Data Explorer URL** output by the script you ran previously to navigate to your Azure Data Explorer environment.
164+
165+
1. Expand the cluster node and select the **phonedata** database. The scope of the query window changes to `Scope:yourclustername.eastus/phonedata`.
166+
167+
1. In Azure Data Explorer, open a new tab and paste in the following Kusto query and then select **Run** to plot the accelerometer telemetry:
168+
169+
```kusto
170+
['acceleration']
171+
| project EnqueuedTime, Device, X, Y, Z
172+
| render timechart
173+
```
228174

229175
You may need to wait for several minutes to collect enough data. Try holding your phone in different orientations to see the telemetry values change:
230176

0 commit comments

Comments
 (0)