Create an Azure Data Explorer cluster and database
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 can ingest (load) data into a database and run queries against it.
In this article, you'll learn how to create a cluster and a database using either C#, Python, Go, the Azure CLI, PowerShell, or an Azure Resource Manager (ARM) template. To learn how to create a cluster and database using the Azure portal, see Quickstart: Create an Azure Data Explorer cluster and database.
For code samples based on previous SDK versions, see the archived article.
Prerequisites by method of cluster and database creation:
- Set up your environment using the instructions in Use Kusto cmdlets in Azure PowerShell.
If you're running the CLI locally, follow these steps to set up the environment:
Run the following command to sign in to Azure:
Connect-AzAccount -Environment AzureChinaCloud
Set the subscription where you want your cluster to be created:
Set-AzContext -SubscriptionId "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
When running Azure CLI locally, you need to install the
Az.Kusto
module on your device:Install-Module -Name Az.Kusto
This section guides you through the process of creating an Azure Data Explorer cluster. Choose the relevant tab for your preferred method to create the cluster.
Create your cluster by using the following command:
New-AzKustoCluster -ResourceGroupName testrg -Name mykustocluster -Location chinaeast2 -SkuTier Standard -SkuCapacity 2 -SkuName 'Standard_D13_v2'
Setting Suggested value Field description Name mykustocluster The desired name of your cluster. Sku Standard_D13_v2 The SKU that will be used for your cluster. ResourceGroupName testrg The resource group name where the cluster will be created. There are other 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:
Get-AzKustoCluster -Name mykustocluster -ResourceGroupName testrg
Confirm the successful creation of the cluster by verifying the result contains
provisioningState
asSucceeded
.
In this section, you'll create a database within the cluster created in the previous section.
Create your database by using the following command:
New-AzKustoDatabase -ResourceGroupName testrg -ClusterName mykustocluster -Name mykustodatabase -SoftDeletePeriod 3650:00:00:00 -HotCachePeriod 3650:00:00:00
Setting Suggested value Field description ClusterName mykustocluster The name of your cluster where the database will be created. Name mykustodatabase The name of your database. ResourceGroupName testrg The resource group name where the cluster will be created. SoftDeletePeriod 3650:00:00:00 The amount of time that data will be kept available to query. HotCachePeriod 3650:00:00:00 The amount of time that data will be kept in cache. Run the following command to see the database that you created:
Get-AzKustoDatabase -ClusterName mykustocluster -ResourceGroupName testrg -Name mykustodatabase