Tutorial: Create an Azure Time Series Insights environment

This tutorial guides you through the process of creating an Azure Time Series Insights environment that's populated with data from simulated devices. In this tutorial, you learn how to:

  • Create a Time Series Insights environment.
  • Create a device simulation solution that contains an IoT hub.
  • Connect the Time Series Insights environment to the IoT hub.
  • Run a device simulation to stream data into the Time Series Insights environment.
  • Verify the simulated telemetry data.

Video

Learn how to use an Azure IoT solution accelerator to generate data and get started with Time Series Insights.

Prerequisites

Overview

The Time Series Insights environment is where device data is collected and stored. After the data is stored, the Azure Time Series Insights explorer and Time Series Insights Query API can be used to query and analyze the data. Azure IoT Hub is the connection point used by all devices (simulated or physical) to securely connect and transmit data to the Azure cloud. The Time Series Insights overview notes that Azure IoT Hub also serves as an event source for streaming data into a Time Series Insights environment. This tutorial uses an IoT solution accelerator to generate and stream sample telemetry data to IoT Hub.

Tip

IoT solution accelerators provide enterprise-grade preconfigured solutions that you can use to accelerate the development of custom IoT solutions.

Create an environment

First, create a Time Series Insights environment in your Azure subscription.

  1. Sign in to the Azure portal by using your Azure subscription account.

  2. Select + Create a resource in the upper left.

  3. Select the Internet of Things category, and then select Time Series Insights.

    Select the Time Series Insights environment resource

  4. On the Time Series Insights environment page, fill in the required parameters.

    Parameter Description
    Environment name Choose a unique name for the Time Series Insights environment. The names are used by the Time Series Insights explorer and the Query APIs.
    Subscription Subscriptions are containers for Azure resources. Choose a subscription to create the Time Series Insights environment.
    Resource group A resource group is a container for Azure resources. Choose an existing resource group or create a new one for the Time Series Insights environment resource.
    Location Choose a data center region for your Time Series Insights environment. To avoid added bandwidth costs and latency, keep the Time Series Insights environment in the same region as other IoT resources.
    Pricing SKU Choose the throughput needed. For lowest cost and starter capacity, select S1.
    Capacity Capacity is the multiplier applied to the ingress rate, storage capacity, and cost associated with the selected SKU. You can change the capacity after creation. For the lowest cost, select a capacity of 1.

    When finished, select Create to begin the provisioning process.

    Create a Time Series Insights environment resource

  5. Check the Notifications panel to monitor deployment completion.

    Time Series Insights environment deployment succeeded

Create a device simulation

Next, create the device simulation solution, which generates test data to populate your Time Series Insights environment.

  1. In a separate window or tab, go to azureiotsolutions.com. Sign in by using the same Azure subscription account, and select the Device Simulation accelerator.

    Run the Device Simulation accelerator

  2. Enter the required parameters on the Create Device Simulation solution page.

    Parameter Description
    Solution name This unique value is used to create a new resource group. The listed Azure resources are created and assigned to the resource group.
    Subscription Specify the same subscription that was used to create your Time Series Insights environment in the previous section.
    Region Specify the same region that was used to create your Time Series Insights environment in the previous section.
    Deploy optional Azure Resources Leave IoT Hub checked. The simulated devices use it to connect or stream data.

    When you're finished, select Create solution to provision the solution's Azure resources. It might take 6-7 minutes to complete this process.

    Provision the device simulation solution

  3. After provisioning has finished, the text above your new solution changes from Provisioning to Ready.

    Important

    Don't select Launch yet! Keep this web page open because you'll return to it later.

    Device simulation solution provisioning complete

  4. Now go back to the Azure portal, and inspect the newly created resources in your subscription. In the portal Resource groups page, notice that a new resource group was created by using the Solution name provided in the last step. Also notice all of the resources that were created to support the device simulation solution.

    Device simulation solution resources

Connect the environment to the IoT hub

At this point, you've learned how to create two sets of resources, each in their own resource group:

  • An empty Time Series Insights environment.
  • Device simulation solution resources, which includes an IoT hub, generated by a solution accelerator.

Recall that the simulated devices need to connect to an IoT hub to stream device data. To flow the data into the Time Series Insights environment, you need to make configuration changes to both your IoT hub and the Time Series Insights environment.

IoT hub configuration: Define a consumer group

IoT Hub provides various endpoints to share functionality to other actors. The "Events" endpoint provides a way for other applications to consume data as it's streamed to an IoT hub instance. Specifically, "consumer groups" provide a mechanism for applications to listen and pull data from the IoT hub.

Next, you define a new consumer group property on the device simulation solution's IoT hub Events endpoint.

  1. In the Azure portal, go to the Overview page of the resource group you created for the device simulation solution. Select the IoT hub resource.

    Device simulation solution resource group

    Make note of the Name of the IoT Hub resource generated for the solution. You'll refer to it later.

  2. Scroll down and select the Endpoints page, and then select the Events endpoint. On the endpoint Properties page, enter a unique name for your endpoint under the "$Default" consumer group. Select Save.

    Device simulation solution IoT hub endpoints

Environment configuration: define an event source

Now, connect the new IoT hub consumer group event endpoint to the Time Series Insights environment as an event source.

  1. Go to the Overview page of the resource group you created for the Time Series Insights environment. Select the Time Series Insights environment.

    Time Series Insights environment resource group and environment

  2. On the Time Series Insights environment page, select Event Sources. Then select + Add.

    Time Series Insights environment overview

  3. Enter the required parameters on the New event source page.

    Parameter Description
    Event source name Requires a unique value, which is used to name the event source.
    Source Select IoT Hub.
    Import option Select the default Use IoT hub from available subscriptions. This option causes the next drop-down list to be populated with the available subscriptions.
    Subscription Select the same subscription in which you created the Time Series Insights environment and Device Simulation resources.
    Iot hub name Should be defaulted to the name of the IoT hub that you noted earlier. If not, select the correct IoT hub.
    Iot hub policy name Select iothubowner.
    Iot hub consumer group Should be defaulted to the name of the IoT hub consumer group you created earlier. If not, select the correct consumer group name.
    Event serialization format Leave as the defaulted value of JSON.
    Timestamp property name Specify as timestamp.

    When you're finished, select Create to add the event source. When you return to the resource group Overview page, along with your Time Series Insights environment resource, you see a new "Time Series Insights event source" resource.

    Time Series Insights environment new event source

Run device simulation to stream data

Now that all of the configuration work is finished, it's time to populate the Time Series Insights environment with sample data from the simulated devices.

You might recall from the Create a device simulation section, several Azure resources were created by the accelerator to support the solution. Along with the IoT hub discussed previously, an Azure App Service web application was generated to create and transmit simulated device telemetry.

  1. Go back to your Solution accelerators dashboard. Sign in again, if necessary, by using the same Azure account you've been using in this tutorial. Now you can select Launch under your "Device Simulation" solution.

    Solution accelerators dashboard

  2. The device simulation web app starts at this point, and it might take several seconds upon initial load. You're also prompted for consent to grant the web application the "Sign you in and read your profile" permission. This permission allows the application to retrieve the user profile information necessary to support the functioning of the application.

    Device simulation web application consent

  3. After the Simulation setup page loads, enter the required parameters.

    Parameter Description
    Target IoT Hub Select Use pre-provisioned IoT Hub.
    Device model Select Chiller.
    Number of devices Enter 1000 under Amount.
    Telemetry frequency Enter 10 seconds.
    Simulation duration Select End in: and enter 5 minutes.

    When you're finished, select Start Simulation. The simulation runs for a total of 5 minutes. It generates data from 1,000 simulated devices every 10 seconds.

    Device simulation setup

  4. While the simulation runs, notice that the Total messages and Messages per second fields update, approximately every 10 seconds. The simulation ends after approximately 5 minutes and returns you to Simulation setup.

    Device simulation running

Verify the telemetry data

In this final section, you verify that the telemetry data was generated and stored in the Time Series Insights environment. To verify the data, you use the Time Series Insights explorer, which is used to query and analyze telemetry data.

  1. Return to the Time Series Insights environment's resource group Overview page. Select the Time Series Insights environment.

    Time Series Insights environment resource group and environment

  2. On the Time Series Insights environment Overview page, select the Time Series Insights explorer URL to open the Time Series Insights explorer.

    Time Series Insights explorer

  3. The Time Series Insights explorer loads and authenticates by using your Azure portal account. Upon initial view, you can see in the chart area that the Time Series Insights environment was populated with simulated telemetry data. To filter a narrower range of time, select the drop-down in the upper-left corner. Enter a time range large enough to span the duration of the device simulation. Then select the search magnifying glass.

    Time Series Insights explorer time range filter

  4. Narrowing the time range allows the chart to zoom in to the distinct bursts of data transfer to the IoT hub and the Time Series Insights environment. Also notice the Streaming complete text in the upper-right corner, which shows the total number of events found. You can also drag the Interval size slider to control the plot granularity on the chart.

    Time Series Insights explorer time range filtered view

  5. Lastly, you can also left-click a region to filter a range. Then right-click and use Explore events to show event details in the tabular Events view.

    Time Series Insights explorer time range filtered view and events

Clean up resources

This tutorial creates several running Azure services to support the Time Series Insights environment and device simulation solution. If you want to abandon or postpone your work on this tutorial series, delete all resources to avoid incurring unnecessary costs.

From the menu on the left in the Azure portal:

  1. Select the Resource groups icon. Then select the resource group you created for the Time Series Insights environment. At the top of the page, select Delete resource group, enter the name of the resource group, and select Delete.

  2. Select the Resource groups icon. Then select the resource group that was created by the device simulation solution accelerator. At the top of the page, select Delete resource group, enter the name of the resource group, and select Delete.

Next steps

In this tutorial, you learned how to:

  • Create a Time Series Insights environment.
  • Create a device simulation solution that contains an IoT hub.
  • Connect the Time Series Insights environment to the IoT hub.
  • Run a device simulation to stream data into the Time Series Insights environment.
  • Verify the simulated telemetry data.

Now that you know how to create your own Time Series Insights environment, learn how to build a web application that consumes data from a Time Series Insights environment: