Enterprise Grafana Cloud
Last reviewed: July 28, 2026

Configure the Azure Cosmos DB data source

This document explains how to configure the Azure Cosmos DB data source.

To install the plugin, refer to Install the Azure Cosmos DB data source.

Before you begin

Before you configure the data source, ensure you have:

  • License: A Grafana Cloud Pro or Advanced plan, or a self-managed Grafana Enterprise license that includes the plugin. The Azure Cosmos DB data source is an Enterprise plugin and isn’t included in the Grafana Cloud Free plan.
  • Grafana permissions: Only users with the organization administrator role can add data sources.
  • Installed plugin: The Azure Cosmos DB plugin. Refer to Install the Azure Cosmos DB data source.
  • Azure Cosmos DB account: An Azure Cosmos DB for NoSQL account.
  • Credentials: Your account endpoint and account key. To find them, refer to Secure access to data in Azure Cosmos DB.

Key concepts

If you’re new to Azure Cosmos DB, these terms are used throughout the configuration:

TermDescription
Account endpointThe URI of your Azure Cosmos DB account, in the form https://<account-name>.documents.azure.com:443/.
Account keyA primary or secondary key that grants full access to the account’s data. Treat it as a secret.

Add the data source

To add the Azure Cosmos DB data source:

  1. Click Connections in the left-side menu.
  2. Click Add new connection.
  3. Type Azure Cosmos DB in the search bar.
  4. Select Azure Cosmos DB.
  5. Click Add new data source.

Configure settings

Configure the following account settings:

SettingDescription
Account EndpointThe URI of your Azure Cosmos DB account, for example https://<account-name>.documents.azure.com:443/.
Account KeyThe account key used to authenticate requests. Stored as a secret and never returned to the browser.

Authentication

The Azure Cosmos DB data source authenticates with an account endpoint and an account key. This is currently the only supported authentication method.

To authenticate the data source:

  1. In Account Endpoint, enter your Azure Cosmos DB account URI.
  2. In Account Key, enter your primary or secondary account key.
  3. Click Save & test.

Private data source connect (PDC)

Private data source connect (PDC) lets Grafana Cloud query an Azure Cosmos DB account that’s only reachable from a private network, such as an Azure virtual network or an on-premises environment, without exposing it to the public internet. Because the Azure Cosmos DB data source runs queries in the backend, it supports PDC.

To use PDC with the data source:

  1. Set up a PDC connection for your Grafana Cloud stack. Refer to Configure Private data source connect (PDC).
  2. On the Azure Cosmos DB data source configuration page, select your PDC connection from the Private data source connect list.
  3. Click Save & test.

For more information, refer to Private data source connect (PDC).

Note

On self-managed Grafana, you can route the connection through a secure socks proxy instead. Enable the Secure Socks Proxy option on the data source configuration page, then refer to Configure a data source connection proxy.

Verify the connection

Click Save & test to verify the configuration. When the connection succeeds, Grafana displays a Data source is working message.

If the test fails, refer to Troubleshoot the Azure Cosmos DB data source.

Provision the data source

You can define and configure the data source in YAML files as part of the Grafana provisioning system. Only users with the organization administrator role can add data sources. For more information about provisioning and available settings, refer to Provision Grafana.

Provision with YAML

The following example provisions the data source using an account endpoint and account key:

YAML
apiVersion: 1

datasources:
  - name: Azure Cosmos DB
    type: grafana-azurecosmosdb-datasource
    jsonData:
      accountEndpoint: <ACCOUNT_ENDPOINT>
    secureJsonData:
      accountKey: <ACCOUNT_KEY>

Replace <ACCOUNT_ENDPOINT> with your account URI and <ACCOUNT_KEY> with your primary or secondary account key.

Provision with Terraform

You can provision the data source with the Grafana Terraform provider using the grafana_data_source resource:

hcl
resource "grafana_data_source" "azure_cosmosdb" {
  type = "grafana-azurecosmosdb-datasource"
  name = "Azure Cosmos DB"

  json_data_encoded = jsonencode({
    accountEndpoint = "<ACCOUNT_ENDPOINT>"
  })

  secure_json_data_encoded = jsonencode({
    accountKey = "<ACCOUNT_KEY>"
  })
}

Replace <ACCOUNT_ENDPOINT> with your account URI and <ACCOUNT_KEY> with your primary or secondary account key. Store the account key in a Terraform variable or secret manager rather than in plain text.