Skip to content

Commit 8294f47

Browse files
authored
Merge pull request #56895 from ShawnJackson/digital-twins-tutorials
edit pass: digital-twins-tutorials
2 parents d645cba + 367ccf3 commit 8294f47

File tree

6 files changed

+311
-275
lines changed

6 files changed

+311
-275
lines changed
Lines changed: 60 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Analyze events from Azure Digital Twins setup | Microsoft Docs
3-
description: Learn how to visualize and analyze events from your Azure Digital Twins spaces, with Azure Time Series Insights, using the steps in this tutorial.
3+
description: Learn how to visualize and analyze events from your Azure Digital Twins spaces, with Azure Time Series Insights, by using the steps in this tutorial.
44
services: digital-twins
55
author: dsk-2015
66

@@ -10,66 +10,70 @@ ms.date: 10/15/2018
1010
ms.author: dkshir
1111
---
1212

13-
# Tutorial: Visualize and analyze events from your Azure Digital Twins spaces using Time Series Insights
13+
# Tutorial: Visualize and analyze events from your Azure Digital Twins spaces by using Time Series Insights
1414

15-
Once you have deployed your Azure Digital Twins instance, provisioned your spaces, and implemented custom function to monitor specific conditions, you can then visualize the events and data coming from your spaces to look for trends and anomalies.
15+
After you deploy your Azure Digital Twins instance, provision your spaces, and implement a custom function to monitor specific conditions, you can visualize the events and data coming from your spaces to look for trends and anomalies.
1616

17-
In [the first tutorial](tutorial-facilities-setup.md), you configured the spatial graph of an imaginary building, with a room containing sensors for motion, carbon dioxide, and temperature. In [the second tutorial](tutorial-facilities-udf.md), you provisioned your graph and a user-defined function. The function monitors these sensor values and triggers notifications for the right conditions, that is, the room is empty, and the temperature and carbon dioxide levels are normal. This tutorial shows you how you can integrate the notifications and data coming from your Digital Twins setup with Azure Time Series Insights. You can then visualize your sensor values over time, and look for trends such as, which room is getting the most use, which is the busiest times of the day, and so on. You can also detect anomalies such as, which rooms feel stuffier and hotter, or whether an area in your building is sending consistently high temperature values indicating a faulty air conditioning.
17+
In [the first tutorial](tutorial-facilities-setup.md), you configured the spatial graph of an imaginary building, with a room that contains sensors for motion, carbon dioxide, and temperature. In [the second tutorial](tutorial-facilities-udf.md), you provisioned your graph and a user-defined function. The function monitors these sensor values and triggers notifications for the right conditions. That is, the room is empty, and the temperature and carbon dioxide levels are normal.
18+
19+
This tutorial shows you how you can integrate the notifications and data coming from your Azure Digital Twins setup with Azure Time Series Insights. You can then visualize your sensor values over time. You can look for trends such as which room is getting the most use and which are the busiest times of the day. You can also detect anomalies such as which rooms feel stuffier and hotter, or whether an area in your building is sending consistently high temperature values, indicating faulty air conditioning.
1820

1921
In this tutorial, you learn how to:
2022

2123
> [!div class="checklist"]
22-
> * Stream data using Event Hubs
23-
> * Analyze with Time Series Insights
24+
> * Stream data by using Azure Event Hubs.
25+
> * Analyze with Time Series Insights.
2426
2527
## Prerequisites
2628

2729
This tutorial assumes that you have [configured](tutorial-facilities-setup.md) and [provisioned](tutorial-facilities-udf.md) your Azure Digital Twins setup. Before proceeding, make sure that you have:
2830
- An [Azure account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
2931
- An instance of Digital Twins running.
3032
- The [Digital Twins C# samples](https://github.com/Azure-Samples/digital-twins-samples-csharp) downloaded and extracted on your work machine.
31-
- [.NET Core SDK version 2.1.403 or above](https://www.microsoft.com/net/download) on your development machine to run the sample. Run `dotnet --version` to verify if the right version is installed.
33+
- [.NET Core SDK version 2.1.403 or later](https://www.microsoft.com/net/download) on your development machine to run the sample. Run `dotnet --version` to verify that the right version is installed.
3234

3335

34-
## Stream data using Event Hubs
35-
The [Event Hubs](../event-hubs/event-hubs-about.md) service allows you to create a pipeline to stream your data. This section shows you how to create your event hub as the connector between your Digital Twins and TSI instances.
36+
## Stream data by using Event Hubs
37+
You can use the [Event Hubs](../event-hubs/event-hubs-about.md) service to create a pipeline to stream your data. This section shows you how to create your event hub as the connector between your Azure Digital Twins and Time Series Insights instances.
3638

3739
### Create an event hub
3840

39-
1. Sign in to [Azure portal](https://portal.azure.com).
41+
1. Sign in to the [Azure portal](https://portal.azure.com).
42+
43+
1. In the left pane, select **Create a resource**.
4044

41-
1. On the left navigation panel, click **Create a resource**.
45+
1. Search for and select **Event Hubs**. Select **Create**.
4246

43-
1. Search for and select **Event Hubs**. Click **Create**.
47+
1. Enter a **Name** for your Event Hubs namespace. Choose **Standard** for **Pricing tier**, your **Subscription**, the **Resource group** that you used for your Digital Twins instance, and the **Location**. Select **Create**.
4448

45-
1. Enter a **Name** for your Event Hubs namespace, choose *Standard* **Pricing tier**, your **Subscription**, the **Resource group** you used for your Digital Twins instance, and the **Location**. Click **Create**.
49+
1. In the Event Hubs namespace deployment, select the namespace under **RESOURCE**.
4650

47-
1. Once deployed, navigate to the Event Hubs namespace *deployment*, and click on the namespace under **RESOURCE**.
51+
![Event Hubs namespace after deployment](./media/tutorial-facilities-analyze/open-event-hub-ns.png)
4852

49-
![Event Hub namespace](./media/tutorial-facilities-analyze/open-event-hub-ns.png)
5053

54+
1. In the Event Hubs namespace **Overview** pane, select the **Event Hub** button at the top.
55+
![Event Hub button](./media/tutorial-facilities-analyze/create-event-hub.png)
5156

52-
1. In the Event Hubs namespace **Overview** pane, click on the **Event Hub** button at the top.
53-
![Event Hub](./media/tutorial-facilities-analyze/create-event-hub.png)
57+
1. Enter a **Name** for your event hub, and select **Create**.
5458

55-
1. Enter a **Name** for your event hub, and click **Create**. Once deployed, it will appear in the **Event Hubs** pane of the Event Hubs namespace with an *Active* **STATUS**. Click on this event hub to open its **Overview** pane.
59+
After the event hub is deployed, it appears in the **Event Hubs** pane of the Event Hubs namespace with an **Active** status. Select this event hub to open its **Overview** pane.
5660

57-
1. Click **Consumer group** button at the top, and enter a name such as *tsievents* for the consumer group. Click **Create**.
61+
1. Select the **Consumer group** button at the top, and enter a name such as **tsievents** for the consumer group. Select **Create**.
5862
![Event Hub consumer group](./media/tutorial-facilities-analyze/event-hub-consumer-group.png)
5963

60-
Once created, the consumer group will appear in the list at the bottom of the event hub's **Overview** pane.
64+
After the consumer group is created, it appears in the list at the bottom of the event hub's **Overview** pane.
6165

62-
1. Open the **Shared access policies** pane for your event hub, and click **Add** button. **Create** a policy named *ManageSend*, and make sure all the checkboxes are checked.
66+
1. Open the **Shared access policies** pane for your event hub, and select the **Add** button. Enter **ManageSend** as the policy name, make sure all the check boxes are selected, and select **Create**.
6367

6468
![Event Hub connection strings](./media/tutorial-facilities-analyze/event-hub-connection-strings.png)
6569

66-
1. Open the *ManageSend* policy that you created, and copy the values for **Connection string--primary key** and **Connection string--secondary key** to a temporary file. You will need these values to create an endpoint for the event hub in the next section.
70+
1. Open the ManageSend policy that you created, and copy the values for **Connection string--primary key** and **Connection string--secondary key** to a temporary file. You'll need these values to create an endpoint for the event hub in the next section.
6771

68-
### Create endpoint for the event hub
72+
### Create an endpoint for the event hub
6973

70-
1. In the command window, make sure you are in the **_occupancy-quickstart\src** folder of the Digital Twins sample.
74+
1. In the command window, make sure you're in the **occupancy-quickstart\src** folder of the Azure Digital Twins sample.
7175

72-
1. Open the file **_actions\createEndpoints.yaml_** in your editor. Replace the contents with the following:
76+
1. Open the file **actions\createEndpoints.yaml** in your editor. Replace the contents with the following:
7377

7478
```yaml
7579
- type: EventHub
@@ -89,20 +93,22 @@ The [Event Hubs](../event-hubs/event-hubs-about.md) service allows you to create
8993
path: Name_of_your_Event_Hubs_namespace
9094
```
9195
92-
1. Replace the placeholders `Primary_connection_string_for_your_event_hub` with the value of the **Connection string--primary key** for the event hub. Make sure the format of this connection string is as following:
93-
```
94-
Endpoint=sb://nameOfYourEventHubNamespace.servicebus.windows.net/;SharedAccessKeyName=ManageSend;SharedAccessKey=yourShareAccessKey1GUID;EntityPath=nameOfYourEventHub
95-
```
96+
1. Replace the placeholders `Primary_connection_string_for_your_event_hub` with the value of **Connection string--primary key** for the event hub. Make sure the format of this connection string is as follows:
97+
98+
```
99+
Endpoint=sb://nameOfYourEventHubNamespace.servicebus.windows.net/;SharedAccessKeyName=ManageSend;SharedAccessKey=yourShareAccessKey1GUID;EntityPath=nameOfYourEventHub
100+
```
96101
97-
1. Replace the placeholders `Secondary_connection_string_for_your_event_hub` with the value of the **Connection string--secondary key** for the event hub. Make sure the format of this connection string is as following:
98-
```
99-
Endpoint=sb://nameOfYourEventHubNamespace.servicebus.windows.net/;SharedAccessKeyName=ManageSend;SharedAccessKey=yourShareAccessKey2GUID;EntityPath=nameOfYourEventHub
100-
```
102+
1. Replace the placeholders `Secondary_connection_string_for_your_event_hub` with the value of **Connection string--secondary key** for the event hub. Make sure the format of this connection string is as follows:
103+
104+
```
105+
Endpoint=sb://nameOfYourEventHubNamespace.servicebus.windows.net/;SharedAccessKeyName=ManageSend;SharedAccessKey=yourShareAccessKey2GUID;EntityPath=nameOfYourEventHub
106+
```
101107
102108
1. Replace the placeholders `Name_of_your_Event_Hubs_namespace` with the name of your Event Hubs namespace.
103109
104110
> [!IMPORTANT]
105-
> Enter all values without any quotes. Make sure there is at least one space character after the colons in the *YAML* file. You may also validate your *YAML* file contents using any online YAML validator such as [this tool](https://onlineyamltools.com/validate-yaml).
111+
> Enter all values without any quotes. Make sure there's at least one space character after the colons in the YAML file. You can also validate your YAML file contents by using any online YAML validator, such as [this tool](https://onlineyamltools.com/validate-yaml).
106112
107113
108114
1. Save and close the file. Run the following command in the command window, and sign in with your Azure account when prompted.
@@ -111,49 +117,51 @@ Endpoint=sb://nameOfYourEventHubNamespace.servicebus.windows.net/;SharedAccessKe
111117
dotnet run CreateEndpoints
112118
```
113119
114-
It creates two endpoints for your Event hub.
120+
It creates two endpoints for your event hub.
115121
116122
![Endpoints for Event Hubs](./media/tutorial-facilities-analyze/dotnet-create-endpoints.png)
117123
118124
## Analyze with Time Series Insights
119125
120-
1. In the left navigation pane of the [Azure portal](https://portal.azure.com), click **Create a resource**.
126+
1. In the left pane of the [Azure portal](https://portal.azure.com), select **Create a resource**.
127+
128+
1. Search for and select a new **Time Series Insights** resource. Select **Create**.
121129
122-
1. Search for and select a new **Time Series Insights** resource. Click **Create**.
130+
1. Enter a **Name** for your Time Series Insights instance, and then select your **Subscription**. Select the **Resource group** that you used for your Digital Twins instance, and your **Location**. Select **Create**.
123131
124-
1. Enter a **Name** for your Time Series Insights instance, and then select your **Subscription**. Select the **Resource group** you used for your Digital Twins instance, and your **Location**. Click **Create**.
132+
![Selections for creating a Time Series Insights instance](./media/tutorial-facilities-analyze/create-tsi.png)
125133
126-
![Create TSI](./media/tutorial-facilities-analyze/create-tsi.png)
134+
1. After the instance is deployed, open the Time Series Insights environment, and then open its **Event Sources** pane. Select the **Add** button at the top to add a consumer group.
127135
128-
1. Once deployed open the Time Series Insights environment, and then open its **Event Sources** pane. Click **Add** button at the top to add a consumer group.
136+
1. In the **New event source** pane, enter a **Name**, and make sure the other values are selected correctly. Select **ManageSend** for **Event hub policy name**, and then select the consumer group that you created in the previous section for **Event hub consumer group**. Select **Create**.
129137
130-
1. In the **New event source** pane, enter a **Name**, and make sure the other values are selected correctly. Select *ManageSend* as the **Event hub policy name**, and then select the *consumer group* you created in the previous section as the **Event hub consumer group**. Click **Create**.
138+
![Selections for creating an event source](./media/tutorial-facilities-analyze/tsi-event-source.png)
131139
132-
![TSI event source](./media/tutorial-facilities-analyze/tsi-event-source.png)
140+
1. Open the **Overview** pane for your Time Series Insights environment, and select the **Go to Environment** button at the top. If you get a data access warning, open the **Data Access Policies** pane for your Time Series Insights instance, select **Add**, select **Contributor** as the role, and select the appropriate user.
133141
134-
1. Open the **Overview** pane for your Time Series Insights environment, and click the **Go to Environment** button at the top. If you get a *data access warning*, then open the **Data Access Policies** pane for your TSI instance, click **Add**, select **Contributor** as the role, and select the appropriate user.
142+
1. The **Go to Environment** button opens the [Time Series Insights explorer](../time-series-insights/time-series-insights-explorer.md). If it doesn't show any events, simulate device events by browsing to the **device-connectivity** project of your Digital Twins sample, and running `dotnet run`.
135143
136-
1. The **Go to Environment** button opens the [Time Series Insights Explorer](../time-series-insights/time-series-insights-explorer.md). If it does not show any events, simulate device events by navigating to the **_device-connectivity_** project of your Digital Twins sample, and running `dotnet run`.
144+
1. After a few simulated events are generated, go back to the Time Series Insights explorer, and select the refresh button at the top. You should see analytical charts being created for your simulated sensor data.
137145
138-
1. After a few simulated events are generated, go back to the Time Series Insights explorer, and click the refresh button at the top. You should see analytical charts getting created for your simulated sensor data.
146+
![Chart in the Time Series Insights explorer](./media/tutorial-facilities-analyze/tsi-explorer.png)
139147
140-
![TSI explorer](./media/tutorial-facilities-analyze/tsi-explorer.png)
148+
1. In the Time Series Insights explorer, you can then generate charts and heatmaps for different events and data from your rooms, sensors, and other resources. On the left side, use the **MEASURE** and **SPLIT BY** drop-down boxes to create your own visualizations.
141149
142-
1. In the Time Series Explorer, you can then generate charts and heatmaps for different events and data from your rooms, sensors, and other resources. On the left-hand side, click the drop-down boxes named **MEASURE** and **SPLIT BY** to create your own visualizations. For example, select *Events* as the **MEASURE** and *DigitalTwins-SensorHardwareId* to **SPLIT BY**, to generate a heatmap for each of your sensors, similar to the following image:
150+
For example, select **Events** for **MEASURE** and **DigitalTwins-SensorHardwareId** for **SPLIT BY**, to generate a heatmap for each of your sensors. The heatmap will be similar to the following image:
143151
144-
![TSI explorer](./media/tutorial-facilities-analyze/tsi-explorer-heatmap.png)
152+
![Heatmap in the Time Series Insights explorer](./media/tutorial-facilities-analyze/tsi-explorer-heatmap.png)
145153
146154
## Clean up resources
147155
148-
If you wish to stop exploring Azure Digital Twins beyond this point, feel free to delete resources created in this tutorial:
156+
If you want to stop exploring Azure Digital Twins beyond this point, feel free to delete resources created in this tutorial:
149157
150-
1. From the left-hand menu in the [Azure portal](http://portal.azure.com), click **All resources**, select your Digital Twins resource group, and **Delete** it.
151-
2. If you need to, you may proceed to delete the sample applications on your work machine as well.
158+
1. From the left menu in the [Azure portal](http://portal.azure.com), select **All resources**, select your Digital Twins resource group, and then select **Delete**.
159+
2. If necessary, delete the sample applications on your work machine.
152160
153161
154162
## Next steps
155163
156-
Proceed to the next article to learn more about spatial intelligence graphs and object models in Azure Digital Twins.
164+
Go to the next article to learn more about spatial intelligence graphs and object models in Azure Digital Twins.
157165
> [!div class="nextstepaction"]
158166
> [Understanding Digital Twins object models and spatial intelligence graph](concepts-objectmodel-spatialgraph.md)
159167

0 commit comments

Comments
 (0)