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
@@ -83,6 +83,12 @@ If you don't have an Azure Digital Twins instance, follow the instructions in [C
83
83
84
84
Then, make sure you have *Azure Digital Twins Data Owner* role on the instance. You can find instructions in [Set up user access permissions](how-to-set-up-instance-cli.md#set-up-user-access-permissions).
85
85
86
+
If you'd like to add the name of your instance to your local CLI variables so it will automatically be plugged into later commands copied from this article, store it in the variable `dtname` like this:
87
+
88
+
```dotnetcli
89
+
dtname="<name-of-your-instance>"
90
+
```
91
+
86
92
## Create an Event Hubs namespace and event hub
87
93
88
94
The next step is to create an Event Hubs namespace and an event hub. This hub will receive graph lifecycle and property update notifications from the Azure Digital Twins instance and then forward the messages to the target Azure Data Explorer cluster.
@@ -172,7 +178,7 @@ Use the command in this section to create a data history connection and the tabl
172
178
173
179
The command below uses local variables that were created earlier in [Set up local variables for CLI session](#set-up-local-variables-for-cli-session) and has several parameters, including...
174
180
* The names of the relationship lifecycle and twin lifecycle tables in Azure Data Explorer (these parameters are optional if you don't want to historize these event types, but required if you do want to historize these event types)
175
-
* An optional parameter to specify the name of the twin property event table (if this value is not provided, this table will be named *AdtPropertyEvents* by default)
181
+
* An optional parameter to specify the name of the twin property event table (if this value is not provided, this table will be named *AdtPropertyEvents* by default). If you don't want to specify another name, remove the `--adx-property-events-table` parameter from the command before running it.
176
182
* The optional parameter `--adx-record-removals` to turn on historization for twin property deletions (events that remove properties entirely)
177
183
178
184
```azurecli-interactive
@@ -277,37 +283,21 @@ You'll see confirmation messages on the screen as models, twins, and relationshi
277
283
278
284
When the simulation is ready, the **Start simulation** button will become enabled. Scroll down and select **Start simulation** to push simulated data to your Azure Digital Twins instance. To continuously update the twins in your Azure Digital Twins instance, keep this browser window in the foreground on your desktop and complete other browser actions in a separate window. This will continuously generate twin property updates events that will be historized to Azure Data Explorer.
279
285
280
-
#### Verify data flow
281
-
282
-
To verify that data is flowing through the data history pipeline, you can use the [data history validation in Azure Digital Twins Explorer](how-to-use-azure-digital-twins-explorer.md#validate-and-explore-historized-properties).
283
-
284
-
1. Navigate to the [Azure Digital Twins Explorer](https://explorer.digitaltwins.azure.net/) and ensure it's [connected to the right instance](how-to-use-azure-digital-twins-explorer.md#switch-contexts-within-the-app).
285
-
286
-
1. Use the instructions in [Validate and explore historized properties](how-to-use-azure-digital-twins-explorer.md#validate-and-explore-historized-properties) to choose a historized twin property to visualize in the chart.
287
-
288
-
If you see data being populated in the chart, this means that Azure Digital Twins update events are being successfully stored in Azure Data Explorer.
289
-
290
-
:::image type="content" source="media/how-to-use-azure-digital-twins-explorer/data-history-explorer-chart.png" alt-text="Screenshot of the Data history explorer showing a chart of historized values for a property." lightbox="media/how-to-use-azure-digital-twins-explorer/data-history-explorer-chart.png":::
291
-
292
-
If you *don't* see data in the chart, the historization data flow isn't working properly. You can investigate the issue by viewing your Event Hubs namespace in the [Azure portal](https://portal.azure.com), which displays charts showing the flow of messages into and out of the namespace. This will allow you to verify both the flow of incoming messages from Azure Digital Twins and the outgoing messages to Azure Data Explorer, to help you identify which part of the flow isn't working.
293
-
294
-
:::image type="content" source="media/how-to-create-data-history-connection/simulated-environment-portal.png" alt-text="Screenshot of the Azure portal showing an Event Hubs namespace for the simulated environment." lightbox="media/how-to-create-data-history-connection/simulated-environment-portal.png":::
295
-
296
286
### View the historized updates in Azure Data Explorer
297
287
298
-
Now that you've verified the data history flow is sending data to Azure Data Explorer, this section will show you how to view all three types of historized updates that were generated by the simulator and stored in Azure Data Explorer tables.
288
+
This section will show you how to view all three types of historized updates that were generated by the simulator and stored in Azure Data Explorer tables.
299
289
300
290
Start in the [Azure portal](https://portal.azure.com) and navigate to the Azure Data Explorer cluster you created earlier. Choose the **Databases** pane from the left menu to open the database view. Find the database you created for this article and select the checkbox next to it, then select **Query**.
301
291
302
292
:::image type="content" source="media/how-to-create-data-history-connection/azure-data-explorer-database.png" alt-text="Screenshot of the Azure portal showing a database in an Azure Data Explorer cluster.":::
303
293
304
-
Next, expand the cluster and database in the left pane to see the name of the data history tables. There should be three: one for relationship lifecycle events, one for twin lifecycle events, and one for twin property update events. You'll use these table names to run queries on the table to verify and view the historized data.
294
+
Next, expand the cluster and database in the left pane to see the name of the data history tables. There should be three: one for relationship lifecycle events, one for twin lifecycle events, and one for twin property update events. You'll use these table names to run queries on the tables to verify and view the historized data.
305
295
306
296
:::image type="content" source="media/how-to-create-data-history-connection/data-history-table.png" alt-text="Screenshot of the Azure portal showing the query view for the database. The name of the data history table is highlighted." lightbox="media/how-to-create-data-history-connection/data-history-table.png":::
307
297
308
-
#### Verify relationship and twin lifecycle updates
298
+
#### Verify table entries
309
299
310
-
To verify that relationship and twin lifecycle events are being historized to the database, start by copying the following command. It has a placeholder for the name of the relationship lifecycle events table, and it will change the ingestion for the table to [batched mode](concepts-data-history.md#batch-ingestion-default) so it ingests data from the live simulation every 10 seconds.
300
+
To verify that events are being historized to the database, start by copying the following command. It has a placeholder for the name of the **relationship lifecycle events table**, and it will change the ingestion for the table to [batched mode](concepts-data-history.md#batch-ingestion-default) so it ingests data from the live simulation every 10 seconds.
@@ -317,13 +307,9 @@ Paste the command into the query window, replacing the placeholder with the name
317
307
318
308
:::image type="content" source="media/how-to-create-data-history-connection/data-history-run-query-1.png" alt-text="Screenshot of the Azure portal showing the query view for the database. The Run button is highlighted." lightbox="media/how-to-create-data-history-connection/data-history-run-query-1.png":::
319
309
320
-
Repeat the process with the following command to update the ingestion mode of the twin lifecycle events table.
Repeat the command two more times using the name of the **twin lifecycle events table** and then the **property update table** to update the ingestion mode of the other tables as well.
325
311
326
-
Next, add the following commands to the query window and run them. Each command contains a placeholder for the name of either the relationship lifecycle events table or the twin lifecycle events table, and the commands will output the number of items in the tables.
312
+
Next, add the following commands to the query window and run them. Each command contains a placeholder for the name of one of the tables, and the commands will output the number of items in the tables.
327
313
328
314
>[!NOTE]
329
315
> It may take up to 5 minutes for the first batch of ingested data to appear.
@@ -334,33 +320,18 @@ Next, add the following commands to the query window and run them. Each command
334
320
335
321
<twin-lifecycle-events-table-name>
336
322
| count
337
-
```
338
-
339
-
You should see in the results that the count of items in each table is something greater than 0, indicating that relationship lifecycle and twin lifecycle events are being historized to their respective tables.
340
323
341
-
#### Verify and explore twin property updates table
342
-
343
-
In this section you'll verify that twin property updates are being historized to the corresponding table, and do some more exploration with the data that's coming through.
344
-
345
-
Start by running the command below. The command has a placeholder for the name of the twin property update table, and it will change the ingestion for the table to [batched mode](concepts-data-history.md#batch-ingestion-default) so it ingests data from the live simulation every 10 seconds.
Next, add the following command to the query window, and run it to verify that Azure Data Explorer has ingested twin updates into the table.
352
-
353
-
>[!NOTE]
354
-
> It may take up to 5 minutes for the first batch of ingested data to appear.
355
-
356
-
```kusto
357
324
<twin-property-updates-table-name>
358
325
| count
359
326
```
360
327
361
-
You should see in the results that the count of items in the table is something greater than 0, indicating that twin property update events are being historized to the table.
328
+
You should see in the results that the count of items in each table is something greater than 0, indicating that relationship lifecycle, twin lifecycle, and property update events are being historized to their respective tables.
329
+
330
+
#### Explore twin property updates table
331
+
332
+
In this section you'll do some more exploration with the twin property update data that's in the table.
362
333
363
-
You can also add and run the following command to view 100 records in the table:
334
+
First, run the following command to view 100 records in the table:
The results should show the outflow numbers changing over time.
390
361
391
-
:::image type="content" source="media/how-to-create-data-history-connection/data-history-run-query-2.png" alt-text="Screenshot of the Azure portal showing the query view for the database. The result for the example query is a line graph showing changing values over time for the salt machine outflows." lightbox="media/how-to-create-data-history-connection/data-history-run-query-2.png":::
362
+
:::image type="content" source="media/how-to-create-data-history-connection/data-history-run-query-2.png" alt-text="Screenshot of the Azure portal showing the query view for the database." lightbox="media/how-to-create-data-history-connection/data-history-run-query-2.png":::
363
+
364
+
### Troubleshoot connection
365
+
366
+
If you don't see data in Azure Data Explorer, the historization data flow isn't working properly. You can investigate the issue by viewing your Event Hubs namespace in the [Azure portal](https://portal.azure.com), which displays charts showing the flow of messages into and out of the namespace. This will allow you to verify both the flow of incoming messages from Azure Digital Twins and the outgoing messages to Azure Data Explorer, to help you identify which part of the flow isn't working.
367
+
368
+
:::image type="content" source="media/how-to-create-data-history-connection/simulated-environment-portal.png" alt-text="Screenshot of the Azure portal showing an Event Hubs namespace for the simulated environment." lightbox="media/how-to-create-data-history-connection/simulated-environment-portal.png":::
0 commit comments