Create an Azure Time Series Insights Gen2 environment using the Azure CLI

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.

This document will guide you through creating a new Time Series Insights Gen2 Environment.

Prerequisites

  • Create an Azure storage account for your environment's cold store. This account is designed for long-term retention and analytics for historical data.

Note

In your code, replace mytsicoldstore with a unique name for your cold storage account.

First, create the storage account:

storage=mytsicoldstore
rg=-my-resource-group-name
az storage account create -g $rg -n $storage --https-only
key=$(az storage account keys list -g $rg -n $storage --query [0].value --output tsv

Creating the environment

Now that the storage account is created and its name and management key are assigned to the variables, run the command below to create the Azure Time Series Insights Environment:

Note

In your code, replace the following with unique names for your scenario:

  • my-tsi-env with your Environment name.
  • my-ts-id-prop with the name of your Time Series Id Property.

Important

Your environment's Time Series ID is like a database partition key. The Time Series ID also acts as the primary key for your Time Series Model.

For more information, see Best practices for choosing a Time Series ID.

az tsi environment gen2 create --name "my-tsi-env" --location chinanorth2 --resource-group $rg --sku name="L1" capacity=1 --time-series-id-properties name=my-ts-id-prop type=String --warm-store-configuration data-retention=P7D --storage-configuration account-name=$storage management-key=$key

Remove an Azure Time Series Insights environment

You can use the Azure CLI to delete an individual resource, such as a Time Series Insights Environment, or delete a Resource Group and all its resources, including any Time Series Insights Environments.

To delete a Time Series Insights Environments, run the following command:

az tsi environment delete --name "my-tsi-env" --resource-group $rg

To delete the storage account, run the following command:

az storage account delete --name $storage --resource-group $rg

To delete a resource group and all its resources, run the following command:

az group delete --name $rg

Next steps