Search code examples
azurepowershellazure-powershellazure-rm-templateazure-data-explorer

How to create Table and Ingestion Mapping in Azure Data Explorer via PowerShell or ARM Template


We want to automate the creation and setup of our Azure Data Explorer Cluster.

Provisioning the Cluster and creating a database is no problem via ARM Templates.

Creating a data connection to ingest data streams via event hub is also working via the New-AzKustoDataConnection PowerShell command.

However, this command requires a table and ingestion mapping to be present in the database.

  • How can i create a table along with ingestion mapping as part of the environment setup script?
  • Is this possible via PowerShell or ARM Templates?

Solution

  • Recently the ability to run a custom script containing KQL commands in the context of the database was added to the Kusto management PowerShell API as well as other languages SDK (such as C#). You can use it to create tables and tables' mappings.