Use Kusto cmdlets in Azure PowerShell

PowerShell scripts can use Azure PowerShell Az.Kusto cmdlets to run management commands.

If you're running the CLI locally, follow these steps to set up your environment.

Prerequisites

Install az.Kusto cmdlets

To install the Az.Kusto cmdlets, run the following command:

Install-Module -Name Az.Kusto -Repository PSGallery -Force

Sign in to Azure

To start managing your cluster with the Az.Kusto cmdlets, launch a PowerShell session and run Connect-AzAccount -Environment AzureChinaCloud to sign in to Azure:

Connect-AzAccount -Environment AzureChinaCloud

Use your Azure account login credentials to log into the browser window that opens. For more information about signing in, see Sign in with Azure PowerShell.

Set the subscription context

Optionally, set the subscription context by running the following command replacing <SubscriptionId> with your cluster's subscription ID. You can get your cluster's subscription ID from the Azure portal from your cluster's Overview page.

Set-AzContext -SubscriptionId "<SubscriptionId>"

Run Kusto cmdlets

To view your cluster details, run the following command replacing <ClusterResourceID> with your cluster's resource ID. You can get your cluster's resource ID from the Azure portal from your cluster's Properties page.

$resource_id = "<ClusterResourceID>"
$mycluster = Get-AzKustoCluster -InputObject $resource_id
$mycluster

For a list of all available cmdlets, see Az.Kusto cmdlets.