Create an Azure Data Explorer cluster and database by using Azure CLI
Azure Data Explorer is a fast, fully managed data analytics service for real-time analysis on large volumes of data streaming from applications, websites, IoT devices, and more. To use Azure Data Explorer, you first create a cluster, and create one or more databases in that cluster. Then you ingest (load) data into a database so that you can run queries against it. In this article, you create a cluster and a database by using Azure CLI.
- An Azure subscription. Create a Azure account.
Configure the CLI parameters
If you choose to install and use the Azure CLI locally, this article requires the Azure CLI version 2.0.4 or later. Run
az --version to check your version. If you need to install or upgrade, see Install the Azure CLI.
The following steps are not required if you're running commands in Azure CLI. If you're running the CLI locally, follow these steps to sign in to Azure and to set your current subscription:
Install extension to use the latest Kusto CLI version:
az extension add -n kusto
Run the following command to sign in to Azure:
az cloud set -n AzureChinaCloud az login
Set the subscription where you want your cluster to be created. Replace
MyAzureSubwith the name of the Azure subscription that you want to use:
az account set --subscription MyAzureSub
Create the Azure Data Explorer cluster
Create your cluster by using the following command:
az kusto cluster create --cluster-name azureclitest --sku name="Standard_D13_v2" tier="Standard" --resource-group testrg --location chinaeast2
Setting Suggested value Field description name azureclitest The desired name of your cluster. sku Standard_D13_v2 The SKU that will be used for your cluster. Parameters: name - The SKU name. tier - The SKU tier. resource-group testrg The resource group name where the cluster will be created. location chinaeast2 The location where the cluster will be created.
There are additional optional parameters that you can use, such as the capacity of the cluster.
Run the following command to check whether your cluster was successfully created:
az kusto cluster show --cluster-name azureclitest --resource-group testrg
If the result contains
provisioningState with the
Succeeded value, then the cluster was successfully created.
Create the database in the Azure Data Explorer cluster
Create your database by using the following command:
az kusto database create --cluster-name azureclitest --database-name clidatabase --resource-group testrg --read-write-database soft-delete-period=P365D hot-cache-period=P31D location=chinaeast2
Setting Suggested value Field description cluster-name azureclitest The name of your cluster where the database will be created. database-name clidatabase The name of your database. resource-group testrg The resource group name where the cluster will be created. read-write-database P365D P31D chinaeast2 The database type. Parameters: soft-delete-period - Signifies the amount of time the data will be kept available to query. See retention policy for more information. hot-cache-period - Signifies the amount of time the data will be kept in cache. See cache policy for more information. location -The location where the database will be created.
Run the following command to see the database that you created:
az kusto database show --database-name clidatabase --resource-group testrg --cluster-name azureclitest
You now have a cluster and a database.
Clean up resources
If you plan to follow our other articles, keep the resources you created.
To clean up resources, delete the cluster. When you delete a cluster, it also deletes all the databases in it. Use the following command to delete your cluster:
az kusto cluster delete --cluster-name azureclitest --resource-group testrg