Query data from the Azure Time Series Insights Gen1 environment using C Sharp

Note

The Time Series Insights service will be retired on 7 July 2024. Consider migrating existing environments to alternative solutions as soon as possible. For more information on the deprecation and migration, visit our documentation.

Caution

This is a Gen1 article.

This C# example demonstrates how to use the Gen1 Query APIs to query data from Azure Time Series Insights Gen1 environments.

Summary

The sample code below demonstrates the following features:

Prerequisites and setup

Complete the following steps before you compile and run the sample code:

  1. Provision a Gen1 Azure Time Series Insights environment.
  2. Configure your Azure Time Series Insights environment for Microsoft Entra ID as described in Authentication and authorization.
  3. Install the required project dependencies.
  4. Edit the sample code below by replacing each #DUMMY# with the appropriate environment identifier.
  5. Execute the code inside Visual Studio.

Project dependencies

It's recommended that you use the newest version of Visual Studio:

The sample code has two required dependencies:

Download the packages in Visual Studio 2019 by selecting the Build > Build Solution option.

Alternatively, add the packages using NuGet 2.12+:

  • dotnet add package Newtonsoft.Json --version 9.0.1
  • dotnet add package Microsoft.IdentityModel.Clients.ActiveDirectory --version 3.13.9

C# sample code

Please refer to the Azure Time Series Insights] repo to access the C# sample code.

Next steps