PowerShell module for Azure Data Explorer management commands
⚠️ This module is still in beta: Be very careful when you use it!
As of today, you can automate the creation and of the Kusto cluster using multiple tools. the challenge begins when you want to invoke management commands like table creation, mapping rules, or managing the access.
This often forces you to do manual work like creating a table or creating a mapping schema. if you wanted to automate it you had to deal with API calls or other languages SDK which not always easy to automate with.
now you can automate the complete process from end to end using PowerShell.
- PowerShell Core
- Powershell AZ Module
- PowerShell Az Kusto Module
You can install the latest version of AzADX module from PowerShell Gallery
Install-Module AzADX -Scope CurrentUser -Force
This module contain two functions:
With this function you can invoke management commands on Azure Data Explorer Cluster or Database
- ClusterName - Enter the Kusto Cluster Name
- ResourceGroupName -Enter the Resource Group of the Kusto Cluster
- DatabaseName - Enter the name of the Database you want to run your queries on
- Command - The management command you want to run.
In this example you set the management command you want to run and the Database you want to run the command on.
$command = ".create table AzADX ( Id:int64, Type: string, Public:bool, CreatedAt: datetime)"
$database = "AzADXDB"
Invoke-AzADXMgmtCommand -ClusterName "" -ResourceGroupName "" -DatabaseName $database -Command $command
In this example you set the management command you want to run and the Database you want to run the command on.
$command = ".alter cluster policy caching hot "{\"SoftDeletePeriod\": \"10.00:00:00\", \"Recoverability\"\"Enabled\"}""
Invoke-AzADXMgmtCommand -ClusterName "" -ResourceGroupName "" -Command $command
With this function, you can invoke queries commands on Azure Data Explorer Database or tables.
- ClusterName - Enter the Kusto Cluster Name
- ResourceGroupName - Enter the Resource Group of the Kusto Cluster
- DatabaseName - Enter the name of the Database you want to run your queries on
- Query - The query you want to run.
In this example, you query a table inside a Database.
$command = "Logs | take 10"
$database = "AzADXDB"
Invoke-AzADXQuery -ClusterName "" -ResourceGroupName "" -DatabaseName $database -Query $command