Share via


設定 Azure 數據總管數據源

Azure 數據總管是記錄和遙測數據探索服務。 在本指南中,您將瞭解如何將 Azure 數據總管數據源新增至 Grafana,並瞭解如何使用此數據源可用的每個驗證選項來設定 Azure 數據總管。

必要條件

新增 Azure 數據總管數據源

遵循下列步驟,將 Azure 數據總管數據源新增至 Grafana。

  1. 在 Azure 入口網站 中開啟 Azure 受控 Grafana 實例。

  2. 在 [概觀]段中,開啟 [端點 URL]。

  3. 在 Grafana 入口網站中,部署左側的功能表,然後選取 [連線 連線> 數據]。

    Screenshot of the Grafana platform showing the Connect data option.

  4. 從清單中選取 [Azure 數據總管數據源 ],然後選取 [建立 Azure 數據總管數據源],將其新增至 Grafana。

設定 Azure 數據總管數據源

輸入 Azure 數據總管組態設定。

  1. 在 [設定] 索引標籤中,選擇性地編輯數據源名稱

    Screenshot of the Grafana platform showing the basic configuration settings for Azure Data Explorer.

  2. 在 [連線 ion Details] 下,輸入 Azure 數據總管資料庫叢集 URL

  3. 在受控識別、應用程式註冊(服務主體)或目前使用者(用戶型驗證)之間選取您慣用的驗證選項。

    使用受控識別進行驗證,而不需使用明確認證。

    新增許可權

    1. 在 Azure 入口網站 中,開啟您的 Azure 數據總管叢集。

    2. 在 [概觀]段中,選取包含您數據的資料庫。

    3. 選取 [ 許可權 > 新增 > 查看器]。

      Screenshot of the Azure platform showing a user adding a viewer permission in an Azure Data Explorer database.

    4. 在搜尋方塊中,輸入您的 Azure 受控 Grafana 工作區名稱,選取工作區,然後選擇 [ 選取]。 成功通知隨即出現。

    在 Grafana 中設定數據來源

    1. 回到 Grafana,在 [驗證方法] 底下,選取 [受控識別]。
    2. 選取 [ 儲存和測試]。 顯示的「成功」通知表示 Grafana 能夠從資料庫擷取數據。

建立 Azure 數據總管數據源

在 Azure CLI 中,執行 az grafana data-source create 命令,以新增和設定 Azure 數據總管數據源。 選擇您慣用的驗證方法,並參閱下方的對應索引標籤以取得詳細數據。

執行這些命令時,請將所有佔位元取代為您自己的資訊。

使用受控識別進行驗證,而不需使用明確認證。

az grafana data-source create --name <azure-managed-grafana-workspace> --definition '{
  "name": "<data-source-name>",
  "type": "grafana-azure-data-explorer-datasource",
  "access": "proxy",
  "jsonData": {
    "clusterUrl": "<cluster-url>",
    "dataConsistency": "strongconsistency",
    "azureCredentials": {
      "authType": "msi"
    }
  }
}'

更新 Azure 數據總管數據源

若要更新 Azure 數據總管數據源,請遵循下列步驟。 執行這些命令時,請將所有佔位元取代為您自己的資訊。

  1. 取得 Azure 資料總管數據源的標識碼,以 az grafana 數據源清單更新

    az grafana data-source list --resource-group <azure-managed-grafana-resource-group> --name <azure-managed-grafana-workspace> --query "[?type=='grafana-azure-data-explorer-datasource'].id"
    
  2. 執行 az grafana data-source update 命令來更新數據源。

    例如,使用下列命令更新 Azure 資料總管數據源的名稱和叢集 URL。

    az grafana data-source update --resource-group <azure-managed-grafana-workspace-resource-group> --name <azure-managed-grafana-workspace> --data-source-id <data-source-id> --set name="<new-name>" url="<new-url>
    

後續步驟