The azure-native:kusto:IotHubDataConnection resource, part of the Pulumi Azure Native provider, defines a data connection that streams IoT Hub device messages into an Azure Data Explorer (Kusto) database. This guide focuses on one capability: connecting IoT Hub to Kusto databases.
Data connections sit within a Kusto cluster and database hierarchy. They require an existing IoT Hub with consumer groups and shared access policies configured. The examples are intentionally small. Combine them with your own IoT Hub configuration, table schemas, and data mapping rules.
Connect an IoT Hub to a Kusto database
Analytics pipelines often ingest IoT device telemetry into Azure Data Explorer for real-time querying. The IoT Hub data connection streams device messages directly into a Kusto database.
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";
const iotHubDataConnection = new azure_native.kusto.IotHubDataConnection("iotHubDataConnection", {
clusterName: "kustoCluster",
dataConnectionName: "dataConnectionTest",
databaseName: "KustoDatabase1",
resourceGroupName: "kustorptest",
});
import pulumi
import pulumi_azure_native as azure_native
iot_hub_data_connection = azure_native.kusto.IotHubDataConnection("iotHubDataConnection",
cluster_name="kustoCluster",
data_connection_name="dataConnectionTest",
database_name="KustoDatabase1",
resource_group_name="kustorptest")
package main
import (
kusto "github.com/pulumi/pulumi-azure-native-sdk/kusto/v3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := kusto.NewIotHubDataConnection(ctx, "iotHubDataConnection", &kusto.IotHubDataConnectionArgs{
ClusterName: pulumi.String("kustoCluster"),
DataConnectionName: pulumi.String("dataConnectionTest"),
DatabaseName: pulumi.String("KustoDatabase1"),
ResourceGroupName: pulumi.String("kustorptest"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var iotHubDataConnection = new AzureNative.Kusto.IotHubDataConnection("iotHubDataConnection", new()
{
ClusterName = "kustoCluster",
DataConnectionName = "dataConnectionTest",
DatabaseName = "KustoDatabase1",
ResourceGroupName = "kustorptest",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.kusto.IotHubDataConnection;
import com.pulumi.azurenative.kusto.IotHubDataConnectionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var iotHubDataConnection = new IotHubDataConnection("iotHubDataConnection", IotHubDataConnectionArgs.builder()
.clusterName("kustoCluster")
.dataConnectionName("dataConnectionTest")
.databaseName("KustoDatabase1")
.resourceGroupName("kustorptest")
.build());
}
}
resources:
iotHubDataConnection:
type: azure-native:kusto:IotHubDataConnection
properties:
clusterName: kustoCluster
dataConnectionName: dataConnectionTest
databaseName: KustoDatabase1
resourceGroupName: kustorptest
The data connection lives within a specific cluster and database, identified by clusterName and databaseName. The dataConnectionName provides a unique identifier within that database. Note that this example shows only the placement properties; a working connection requires additional properties like consumerGroup (which IoT Hub consumer group to read from), iotHubResourceId (the IoT Hub’s resource ID), and sharedAccessPolicyName (the policy granting read access). You’ll also typically specify tableName (where data lands), dataFormat (JSON, CSV, etc.), and mappingRuleName (how to transform incoming messages).
Beyond these examples
These snippets focus on data connection naming and placement. They’re intentionally minimal rather than complete IoT ingestion pipelines.
The examples reference pre-existing infrastructure such as Kusto cluster and database, IoT Hub with consumer groups and shared access policies, and target tables for data ingestion. They focus on data connection configuration rather than provisioning the surrounding infrastructure.
To keep things focused, common data connection patterns are omitted, including:
- IoT Hub connection details (consumerGroup, iotHubResourceId, sharedAccessPolicyName)
- Data routing and format (tableName, dataFormat, mappingRuleName)
- Historical data retrieval (retrievalStartDate)
- System properties filtering (eventSystemProperties)
These omissions are intentional: the goal is to illustrate how the data connection is wired, not provide drop-in ingestion modules. See the IoT Hub Data Connection resource reference for all available configuration options.
Let's configure Azure Kusto IoT Hub Data Connections
Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.
Try Pulumi Cloud for FREEFrequently Asked Questions
Configuration & Setup
clusterName, dataConnectionName, databaseName, and resourceGroupName properties are immutable. Changing any of these requires replacing the resource.consumerGroup (the IoT Hub consumer group), iotHubResourceId (the IoT Hub resource ID), sharedAccessPolicyName (the shared access policy name), and kind (which must be set to ‘IotHub’)./subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}.Data Ingestion & Routing
dataFormat, tableName, and mappingRuleName properties can be specified at the connection level or added to each individual message.databaseRouting property defaults to Single, meaning only database routing information is allowed by default.Event Retrieval & History
retrievalStartDate, the connection retrieves existing Event Hub events from that date forward. However, it can only retrieve events still retained by the Event Hub based on its retention period.