# Create the Grafana token for the proxy

Give the proxy a read-only Grafana token, made in Grafana's screens or with its API, and limit which datasources it may query, because the Viewer role alone doesn't.

Make the token in the Grafana organization that holds your Prometheus and Loki datasources. The token stays with the proxy, and Tellagen never sees it.

## Before you start

### Intended audience

Grafana admins who make the token that the proxy uses.

### Required permissions

You need the Admin role in the Grafana organization that holds your Prometheus and Loki datasources.


## Procedure

<a id="step-add-a-service-account"></a>

1. **Add a service account.** In Grafana, go to Administration → Users and access → Service accounts and select Add service account. In Grafana older than version 10, look under Configuration. On the Add proxy page, **Open this page in Grafana** opens it for you once you type **Your Grafana address**.

   Type tellagen-proxy (**Copy the name** copies it), choose the role Viewer, and select Create. The proxy only reads, so Viewer is enough.

<a id="step-make-the-token"></a>

2. **Make the token.** Select Add service account token. Set an expiry date, select Generate token and copy it. Grafana shows it once.

<a id="step-or-use-the-api"></a>

3. **Or use the API.** Run both calls as a Grafana admin. The first answer holds the id of the account. The second holds the token once, in the field named key, and it lives for 90 days.

Grafana API calls:

```shell
curl -X POST https://grafana.example.com/api/serviceaccounts \
  -H "Content-Type: application/json" \
  -u '<admin user>:<admin password>' \
  -d '{"name":"tellagen-proxy","role":"Viewer"}'

curl -X POST https://grafana.example.com/api/serviceaccounts/<id>/tokens \
  -H "Content-Type: application/json" \
  -u '<admin user>:<admin password>' \
  -d '{"name":"tellagen-proxy","secondsToLive":7776000}'
```

<a id="step-give-the-token-to-the-proxy"></a>

4. **Give the token to the proxy.** On the Add proxy page, select **I have the token**, then put the token in the install command or the token file. [Install the proxy](https://tellagen.com/help/install-the-proxy) shows where it goes.

<a id="step-limit-the-datasources"></a>

5. **Limit the datasources.** On Grafana OSS, any user in an organization can query all its datasources, and a Viewer is no exception. Datasource permissions that limit this are an Enterprise and Cloud feature. So the role doesn't limit what the proxy may read.

   In Tellagen, choose the datasources at the end of the setup, under **What may Tellagen query?**. Later, use the **Allowed** switches in the **Datasources** table of the proxy. For a limit that Tellagen can't widen, set `grafana.allowedDatasourceUids` in Helm, or `GRAFANA_ALLOWED_DATASOURCE_UIDS` in Docker. Tellagen can only make that list smaller.

<a id="step-replace-the-token"></a>

6. **Replace the token before it expires.** Make a new token the same way, then put it where the old one is. A proxy that reads its tokens from a Kubernetes Secret or from files a secrets tool writes picks up the new one within a minute. With the token files of a plain Docker or Compose install, restart the container after you replace the file.

## What happens next

- The **The Grafana token works** check on the Add proxy page passes with Role Viewer.
- The doctor shows your Grafana address with the role Viewer, and a test query for the first Prometheus and Loki datasource the proxy may use.

## FAQs

<a id="troubleshooting-the-doctor-says-the-token-has-the-admin-or-editor-role-does-that-matter"></a>

### The doctor says the token has the Admin or Editor role. Does that matter?

It's a warning, not a failure. That role can change Grafana, and the proxy only reads. Make a service account with the role Viewer and a new token, then replace the old one.

<a id="troubleshooting-the-doctor-says-viewer-can-query-all-datasources-even-after-i-chose-some-in-tellagen-why"></a>

### The doctor says “Viewer can query all” datasources, even after I chose some in Tellagen. Why?

The doctor looks only at a local allowlist. Your choice in Tellagen still limits the queries, but the warning stays until you set `grafana.allowedDatasourceUids` in Helm or `GRAFANA_ALLOWED_DATASOURCE_UIDS` in Docker.

<a id="troubleshooting-grafana-refuses-the-token-what-now"></a>

### Grafana refuses the token. What now?

A refused token (401) is wrong or expired. Make a new one and update the file or Secret. If Grafana accepts the token but doesn't let it read (403), give the service account the Viewer role.

<a id="troubleshooting-the-doctor-says-the-token-belongs-to-another-organization-why"></a>

### The doctor says the token belongs to another organization. Why?

The proxy is set to one organization with `GRAFANA_ORG_ID`, or `grafana.orgId` in Helm, and the token belongs to another. Make the service account in that organization, or change the setting.

## Related articles

- **Recommended next task:** [Install the proxy with Docker, Compose or Helm](https://tellagen.com/help/install-the-proxy)
- [Read the proxy doctor output](https://tellagen.com/help/read-the-proxy-doctor-output)
- [What Tellagen receives in a Cloud diagnosis](https://tellagen.com/help/what-tellagen-receives-in-a-cloud-diagnosis)


## Continue through the incident lifecycle

- **Previous task:** [Install the proxy with Docker, Compose or Helm](https://tellagen.com/help/install-the-proxy)
- **Next task:** [Keep the proxy tokens in Vault, External Secrets or a CSI driver](https://tellagen.com/help/store-proxy-secrets)
- [Back to Support Center](https://tellagen.com/help#help-search)

## Updated

2026-11-25
