Uredi

Deli z drugimi prek


Configure an Azure Data Explorer datasource

Azure Data Explorer is a logs & telemetry data exploration service. In this guide, you learn how to add an Azure Data Explorer data source to Grafana and you learn how to configure Azure Data Explorer using each authentication option available for this data source.

Prerequisites

Add an Azure Data Explorer data source

Add an Azure Data Explorer data source to Grafana by following the steps below.

  1. Open an Azure Managed Grafana instance in the Azure portal.

  2. In the Overview section, open the Endpoint URL.

  3. In the Grafana portal, deploy the menu on the left and select Connections > Connect data.

    Screenshot of the Grafana platform showing the Connect data option.

  4. Select Azure Data Explorer Datasource from the list, and add it to Grafana by selecting Create a Azure Data Explorer Datasource data source.

Configure an Azure Data Explorer data source

Enter Azure Data Explorer configuration settings.

  1. In the Settings tab, optionally edit the data source Name.

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

  2. Under Connection Details, enter the Azure Data Explorer database Cluster URL.

  3. Select your preferred authentication option between Managed Identity, App Registration (service principal) or Current User (user-based authentication).

    Authenticate with a managed identity without using explicit credentials.

    Add a new permission

    1. In the Azure portal, open your Azure Data Explorer cluster.

    2. In the Overview section, select the database that contains your data.

    3. Select Permissions > Add > Viewer.

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

    4. In the search box, enter your Azure Managed Grafana workspace name, select the workspace and then choose Select. A success notification appears.

    Configure the data source in Grafana

    1. Back in Grafana, under Authentication Method, select Managed Identity.
    2. Select Save & test. The "Success" notification displayed indicates that Grafana is able to fetch data from the database.

Create an Azure Data Explorer data source

In the Azure CLI, add and configure an Azure Data Explorer data source, by running the az grafana data-source create command. Choose your preferred authentication method and refer to the corresponding tab below for details.

When running these commands, replace all placeholders with your own information.

Authenticate with a managed identity without using explicit credentials.

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"
    }
  }
}'

Update an Azure Data Explorer data source

To update an Azure Data Explorer data source, follow the steps below. When running these commands, replace all placeholders with your own information.

  1. Get the ID of the Azure Data Explorer data source to update with az grafana data-source list.

    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. Run the az grafana data-source update command to update the data source.

    For example, update the name and cluster URL of the Azure Data Explorer data source with the following command.

    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>
    

Next step