Share via


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.

Azure Cloud Shell

Azure hosts Azure Cloud Shell, an interactive shell environment that you can use through your browser. You can use either Bash or PowerShell with Cloud Shell to work with Azure services. You can use the Cloud Shell preinstalled commands to run the code in this article, without having to install anything on your local environment.

To start Azure Cloud Shell:

Option Example/Link
Select Try It in the upper-right corner of a code or command block. Selecting Try It doesn't automatically copy the code or command to Cloud Shell. Screenshot that shows an example of Try It for Azure Cloud Shell.
Go to https://shell.azure.com, or select the Launch Cloud Shell button to open Cloud Shell in your browser. Button to launch Azure Cloud Shell.
Select the Cloud Shell button on the menu bar at the upper right in the Azure portal. Screenshot that shows the Cloud Shell button in the Azure portal

To use Azure Cloud Shell:

  1. Start Cloud Shell.

  2. Select the Copy button on a code block (or command block) to copy the code or command.

  3. Paste the code or command into the Cloud Shell session by selecting Ctrl+Shift+V on Windows and Linux, or by selecting Cmd+Shift+V on macOS.

  4. Select Enter to run the code or command.

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 eastus2 --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