建立 Azure 資料總管叢集與資料庫

Azure Data Explorer 是快速、完全受控的資料分析服務,可即時分析來自應用程式、網站、IoT 裝置等的大量資料流。 若要使用 Azure 數據總管,請先建立叢集,然後在該叢集中建立一或多個資料庫。 然後,您可以將數據擷取(載入)到資料庫中,並針對它執行查詢。

在本文中,你將學習如何使用 C#、Python、Go、Azure CLI、PowerShell、Bicep 或 Azure Resource Manager(ARM)範本來建立叢集和資料庫。 若要瞭解如何使用 Azure 入口網站 建立叢集和資料庫,請參閱快速入門:建立 Azure 數據總管叢集和資料庫

如需以舊版 SDK 為基礎的程式代碼範例,請參閱 封存一文

必要條件

叢集和資料庫建立方法的必要條件:

建立 Azure 數據總管叢集

本節會引導您完成建立 Azure 數據總管叢集的程式。 選擇您慣用方法的相關索引標籤,以建立叢集。

ARM 範本

以下是一個 ARM 範本範例,該範本能以最少設定方式建立 Azure Data Explorer 叢集及該叢集內的資料庫。 欲了解完整細節及支援特性,請參閱 ARM 模板叢集參考及ARM 模板資料庫參考

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "clusters_kustocluster_name": {
            "type": "string",
            "defaultValue": "[concat('kusto', uniqueString(resourceGroup().id))]",
            "metadata": {
                "description": "Name of the cluster to create"
            }
        },
        "databases_kustodb_name": {
            "type": "string",
            "defaultValue": "kustodb",
            "metadata": {
                "description": "Name of the database to create"
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location for all resources."
            }
        }
    },
    "variables": {},
    "resources": [
        {
            "name": "[parameters('clusters_kustocluster_name')]",
            "type": "Microsoft.Kusto/clusters",
            "apiVersion": "2025-02-14",
            "location": "[parameters('location')]",
            "sku": {
                "name": "Standard_E8ads_v5",
                "tier": "Standard",
                "capacity": 2
            }
        },
        {
            "name": "[concat(parameters('clusters_kustocluster_name'), '/', parameters('databases_kustodb_name'))]",
            "type": "Microsoft.Kusto/clusters/databases",
            "apiVersion": "2025-02-14",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.Kusto/clusters', parameters('clusters_kustocluster_name'))]"
            ],
            "kind": "ReadWrite",
            "properties": {
                "softDeletePeriod": "P365D",
                "hotCachePeriod": "P31D"
            }
        }
    ]
}

建立 Azure 數據總管資料庫

在本節中,您將在上一節中建立的叢集內建立資料庫。

叢集和資料庫會與上一節中的ARM範本一起建立。

後續步驟