Troubleshoot the Azure Cosmos DB data source
This document provides solutions to common issues you might encounter when you configure or use the Azure Cosmos DB data source. For configuration instructions, refer to Configure the Azure Cosmos DB data source.
License and setup errors
The Azure Cosmos DB data source is a Grafana Enterprise plugin. These errors occur when the plugin isn’t licensed, activated, or installed.
The plugin doesn’t appear in the catalog
The plugin isn’t listed under Plugins and data > Plugins, or you can’t add it as a data source.
Possible causes and solutions:
The Plugin health check failed error
Save & test returns a generic health check error, or the Install button doesn’t appear.
Solutions:
- Confirm the plugin is licensed and activated for your environment. Refer to Install and upgrade the Azure Cosmos DB data source.
- On self-managed Grafana, verify the Enterprise license is active under Administration > General > Stats and license.
- Verify you have the organization administrator role.
Version and upgrade guidance
Many Azure Cosmos DB issues are caused by running an outdated plugin version. Before deeper troubleshooting, confirm you’re on the latest version, because upgrading resolves a wide range of problems.
Note
On Grafana Cloud, the Azure Cosmos DB plugin is managed by Grafana and updates automatically. On self-managed Grafana, you must update the plugin manually. In other managed environments, such as Azure Managed Grafana, the plugin version is controlled by the platform provider and can lag behind the latest release.
To check and update the plugin version:
- Navigate to Administration > Plugins and data > Plugins.
- Search for Azure Cosmos DB and open its page.
- Review the installed version and the latest available version.
- If an update is available and you’re on self-managed Grafana, click Update.
For upgrade steps across environments, refer to Install and upgrade the Azure Cosmos DB data source.
Authentication errors
These errors occur when the account endpoint or account key is missing or invalid.
The account endpoint is empty error
This error appears when you save the data source without an account endpoint.
Solutions:
- Open the data source configuration.
- In Account Endpoint, enter your Azure Cosmos DB account URI, for example
https://<account-name>.documents.azure.com:443/. - Click Save & test.
The account key is empty error
This error appears when you save the data source without an account key.
Solutions:
- Open the data source configuration.
- In Account Key, enter your primary or secondary account key.
- Click Save & test.
The failed to create CosmosDB client, validate account key and endpoint error
This error appears when the account key isn’t a valid key, so Grafana can’t create a client.
Solutions:
- Copy a current primary or secondary key from the Azure portal and paste it into the Account Key field. Don’t include extra spaces or partial values.
- Verify the Account Endpoint is the full account URI, for example
https://<account-name>.documents.azure.com:443/. - Click Save & test.
Save & test fails with an authorization or connection error
Save & test fails with an error returned by Azure Cosmos DB, such as a 401 Unauthorized response, or with a timeout. The account endpoint and key are present, but the connection to Azure Cosmos DB doesn’t succeed.
Possible causes and solutions:
Connection errors
These errors occur when Grafana can’t reach the Azure Cosmos DB endpoint.
Connection refused or timeout errors
The data source test times out or queries fail with network errors.
Solutions:
- Verify network connectivity from the Grafana server to your Azure Cosmos DB endpoint.
- Check that firewall rules allow outbound HTTPS on port 443.
- Verify that the Azure Cosmos DB account firewall allows requests from your Grafana instance. If the account uses IP firewall rules or virtual network restrictions, add your Grafana instance’s outbound addresses to the allowlist.
- For Grafana Cloud, configure Private data source connect (PDC) if you’re accessing an Azure Cosmos DB account on a private network.
Query errors
These errors occur when you run queries against the data source.
The select a database or select a container error
These errors appear when a query runs without a database or container selected.
Solutions:
- In the query editor header, select a Database.
- Select a Container.
- Run the query again.
The sql is empty error
This error appears when the query editor doesn’t contain a query.
Solutions:
- Enter an Azure Cosmos DB for NoSQL query in the Query field.
- Click outside the editor or save the query to run it.
Cross-partition query errors
When the PartitionKey field is empty, the query runs across all partitions. Multi-partition queries don’t support the TOP, ORDER BY, OFFSET, LIMIT, Aggregates, DISTINCT, and GROUP BY keywords, so queries that use them fail or return an error.
This most commonly affects aggregate queries, including alert queries such as the following:
SELECT COUNT(1) FROM c WHERE c.level = "error"To run this kind of query, scope it to a single partition.
Solutions:
- Enter a partition key value in the PartitionKey field to run a single-partition query, then run the query again.
- Alternatively, rewrite the query to avoid the unsupported keywords.
- For alert rules, restructure the query so it targets a single partition, because aggregates aren’t supported across partitions.
Note
Older plugin versions had a bug where the
x-ms-documentdb-query-enablecrosspartitionheader was set incorrectly, which caused Azure Cosmos DB to reject some queries. This is fixed in current versions. If you see cross-partition header errors, update the plugin. Refer to Version and upgrade guidance.
No data or empty results
The query runs without error but returns no data.
Possible causes and solutions:
Template variable errors
These errors occur when you use template variables with the data source.
Variables return no values
Variable drop-downs are empty or fail to load.
Solutions:
- Verify the data source connection works by testing it in the data source settings.
- For Containers variables, confirm the parent database variable has a valid selection.
- Verify the account key has read access to the requested databases and containers.
Performance issues
These issues relate to slow queries or request limits.
Rate limit or throttling errors
Dashboard panels intermittently fail to load, or Azure Cosmos DB returns throttling responses.
Solutions:
- Reduce the frequency of dashboard refreshes.
- Narrow the time range and add filters to reduce the amount of data scanned.
- Enable query caching in Grafana, which is available in Grafana Enterprise and Grafana Cloud.
- Increase the provisioned throughput (RU/s) for the container in Azure Cosmos DB.
Enable debug logging
To capture detailed error information for troubleshooting:
Set the Grafana log level to
debugin the configuration file:[log] level = debugReview logs in
/var/log/grafana/grafana.log, or your configured log location.Look for entries related to the
grafana-azurecosmosdb-datasourceplugin.Reset the log level to
infoafter troubleshooting to avoid excessive log volume.
Get additional help
If you’ve tried these solutions and still encounter issues:
- Check the Grafana community forums for similar issues.
- Consult the Azure Cosmos DB documentation for service-specific guidance.
- Contact Grafana Support if you’re an Enterprise, Cloud Pro, or Cloud Contracted user.
- When you report an issue, include:
- Your Grafana version and plugin version.
- Error messages, with sensitive information redacted.
- Steps to reproduce the issue.
- Relevant configuration, with credentials redacted.


