Menu
Grafana Cloud RSS

Grafana Cloud Access Policies

Grafana Cloud Access Policies implement an authorization process for:

This page describes Cloud Access Policy concepts. To create an Access Policy and associated token, follow the instructions to authorize your service.

Note

Grafana Cloud Access Policies do not authorize access to the Grafana instance HTTP API.

Grafana Cloud API keys have been replaced by Access Policies. For migration instructions, refer to migrate API keys to Access Policies.

Access policies contain tokens, which grant other applications access to take certain actions on your Grafana Cloud hosted services. You can create one or more tokens for each access policy and use those tokens when configuring Grafana Agent, setting up a Grafana data source, provisioning alerts, or otherwise interacting with Grafana Cloud’s APIs.

An individual access policy is composed of one or more scopes and a realm.

The scope is a specific action on a specific service. For example, the metrics:read scope defines an action that reads data from the Mimir service. The logs:write scope defines an action that creates data in the Loki service.

The realm identifies whether the scope will be applied during authorization to an org (organization) or to a stack (a set of services).

A decision to authorize an API request is made by comparing the request’s token with the associated Grafana Cloud access policy. If the API request performs an action that is allowed by an access policy (identified by the token), the API request is authorized.

In addition to scopes and realms, access policies also support IP range based access controls. For more information, refer to IP range based access control.

For an introduction to Grafana Cloud Access Policies, read the November 22, 2022, blog post by Ryan Melendez, “Grafana Cloud Access Policies: Say hi to the new Cloud API keys.”

Use with the API, Grafana Stacks, and Cloud Portal

You can use access policies via the API, the Grafana Administration settings, and the Cloud Portal. The Grafana Cloud Access Policies API adds two new API endpoints points for access policies (/v1/accesspolicies) and tokens (/v1/tokens). These endpoints are described in the Grafana Cloud API documentation.

Access policy interfaceAccess policies for stacksAccess policies for an organizationRequires Cloud Portal Admin roleRequires Grafana Admin role
Cloud APIYesYesYesNo
In a Grafana StackSingle stack where createdNoNoYes
Cloud PortalYesYesYesNo

The Access Policies page in the Cloud Portal lets you manage access policies and tokens across an organization and all of its stacks.

The Access Policies page in the Cloud Portal
The Access Policies page in the Cloud Portal

The Cloud access policies in the Grafana Administration settings allow access policies and tokens to be managed for a specific stack.

The Cloud access policies page.
The Cloud access policies page.

Access policies

Each access policy has one or more tokens, a realm, one or more scopes, and optional label filters. The table above summarizes access policies for stacks and organizations.

Each access policy has a unique name within an organization. Access policies are only used within one Grafana Cloud organization and do not span multiple organizations.

For more information about stacks and organizations, refer to the Grafana Cloud Stack section of Use the Cloud Portal to manage your Grafana Cloud account.

Realms

A realm has a type, such as organization or stack, an identifier, and a list of label policies. A realm must be specified when using the API or the Access Policies page in the Cloud Portal, but the realm is automatically set when managing access policies in the Grafana Administration settings.

You can specify an organization or stack ID. The org realm type can be used for applying access policies to any stack within an organization. If you specify a stack realm type, then the tokens under that particular policy can be used only for that stack.

Tokens

A token belongs to an access policy and is used programmatically to identify the entity that requests actions on resources. Authorization is based on rules defined by an access policy and the token presented with a request. An access policy can have one or more tokens.

Tokens are created in the same places as access policies. You can use the Cloud Access Policy API, the Access Policies page in the Cloud Portal, or the Cloud access policies page in the Grafana Administration settings. Any tokens defined in the Grafana Administration settings are limited to that Grafana’s stack.

Scopes

A scope defines which permissions a token has. For example, metrics:read, metrics:write, etc. Scopes let you specify which actions can be performed with resources such as metrics, logs, traces, alerts, rules, and access policies. Additional scopes are available within the Cloud Portal UI.

ServiceDescriptionIdentifier
Access PoliciesDelete access policies.accesspolicies:delete
Access PoliciesRead access policies.accesspolicies:read
Access PoliciesCreate and edit access policies.accesspolicies:write
Active User ReportsCreate and edit active user reports.active-user-reports:write
Adaptive LogsAccess and edit patterns and sample rates for Adaptive Logsadaptive-logs:admin
Adaptive Metrics ConfigRead access for Adaptive Metrics configurationadaptive-metrics-config:read
Adaptive Metrics ConfigWrite access for Adaptive Metrics configurationadaptive-metrics-config:write
Adaptive Metrics ExemptionsDelete access for Adaptive Metrics exemptionsadaptive-metrics-exemptions:delete
Adaptive Metrics ExemptionsRead access for Adaptive Metrics exemptionsadaptive-metrics-exemptions:read
Adaptive Metrics ExemptionsWrite access for Adaptive Metrics exemptionsadaptive-metrics-exemptions:write
Adaptive Metrics RecommendationsRead access for Adaptive Metrics recommendationsadaptive-metrics-recommendations:read
Adaptive Metrics RulesDelete access for Adaptive Metrics rulesadaptive-metrics-rules:delete
Adaptive Metrics RulesRead access for Adaptive Metrics rulesadaptive-metrics-rules:read
Adaptive Metrics RulesWrite access for Adaptive Metrics rulesadaptive-metrics-rules:write
Agent managementRead from agent management API.agentmanagement:read
Agent managementCreate and edit within agent management API.agentmanagement:write
Alert State HistoryRead Grafana’s log-based Alert State History from a Grafana Cloud stack.alert-state-history:read
AlertsRead alerts from a Grafana Cloud stack.alerts:read
AlertsWrite alerts to a Grafana Cloud stack.alerts:write
Api Keys Metrics PublisherCreate API keys with MetricsPublisher role for Grafana.com.api-keys-metrics-publisher:write
Api KeysDelete API keys from Grafana.com.api-keys:delete
Api KeysRead API keys from Grafana.com.api-keys:read
Api KeysCreate API keys for Grafana.com.api-keys:write
Asserts Assertion DetectorGrants access to send alerts to the Asserts assertion alertmanager webhookasserts-assertion-detector:write
Audit LogsRead audit logs.audit-logs:read
Billing MetricsRead billing metrics from a Grafana Cloud stack.billing-metrics:read
Credit CardsDelete credit cards on Grafana.com.credit-cards:delete
Credit CardsRead credit cards on Grafana.com.credit-cards:read
Credit CardsCreate and edit credit cards on Grafana.com.credit-cards:write
Dashboard ReviewsDelete dashboard reviews.dashboard-reviews:delete
Dashboard ReviewsCreate and edit dashboard reviews.dashboard-reviews:write
DashboardsDelete dashboards on Grafana.com.dashboards:delete
DashboardsRead dashboards on Grafana.com.dashboards:read
DashboardsCreate and edit dashboards on Grafana.com.dashboards:write
DatasourcesDelete datasources from Grafana instance within a Grafana Cloud stack from Grafana.com.datasources:delete
DatasourcesRead datasources for Grafana instance within a Grafana Cloud stack from Grafana.com.datasources:read
DatasourcesCreate and edit datasources for Grafana instance within a Grafana Cloud stack from Grafana.com.datasources:write
Fleet ManagementProvides read access to Fleet Management.fleet-management:read
Fleet ManagementProvides write access to Fleet Management.fleet-management:write
IncidentCreate and edit within incident API.incident:write
Insight LogsRead insight logs from a Grafana Cloud stack.insight-logs:read
Integration ManagementRead from integration management API.integration-management:read
Integration ManagementCreate and edit within integration management API.integration-management:write
InvitesDelete organization invites on Grafana.com.invites:delete
InvitesRead organization invites on Grafana.com.invites:read
InvitesCreate and edit organization invites on Grafana.com.invites:write
InvoicesRead invoices from Grafana.com.invoices:read
License TokensDelete license tokens on Grafana.com.license-tokens:delete
License TokensRead license tokens on Grafana.com.license-tokens:read
License TokensCreate and edit license tokens on Grafana.com.license-tokens:write
LicensesDelete licenses on Grafana.com.licenses:delete
LicensesRead licenses on Grafana.com.licenses:read
LicensesAccess and manage licenses.licenses:write
LogsDelete logs from a Grafana Cloud stack.logs:delete
LogsRead logs from a Grafana Cloud stack.logs:read
LogsWrite logs to a Grafana Cloud stack.logs:write
MetricsDelete metrics from a Grafana Cloud stack.metrics:delete
MetricsImport metrics to a Grafana Cloud stack.metrics:import
MetricsRead metrics from a Grafana Cloud stack.metrics:read
MetricsWrite metrics to a Grafana Cloud stack.metrics:write
MlopsRead from machine learning ops API.mlops:read
MlopsCreate and edit within machine learning ops API.mlops:write
Oauth ClientsDelete OAuth clients from Grafana.com.oauth-clients:delete
Oauth ClientsRead OAuth clients from Grafana.com.oauth-clients:read
Oauth ClientsCreate and edit OAuth clients from Grafana.com.oauth-clients:write
Oauth CodesDelete OAuth codes from Grafana.com.oauth-codes:delete
Oauth CodesRead OAuth codes from Grafana.com.oauth-codes:read
Oauth CodesCreate and edit OAuth codes for Grafana.com.oauth-codes:write
Oauth GrantsDelete OAuth grants.oauth-grants:delete
Oauth GrantsRead OAuth grants.oauth-grants:read
Oauth GrantsCreate OAuth grants.oauth-grants:write
Oauth TokensDelete OAuth tokens from Grafana.com.oauth-tokens:delete
Oauth TokensRead OAuth tokens from Grafana.com.oauth-tokens:read
Org Billing InfoRead organization billing info from Grafana.com.org-billing-info:read
Org Billing InfoCreate and edit organization billing info within Grafana.com.org-billing-info:write
Org Billing RateRead organization billing rates from Grafana.com.org-billing-rate:read
Org Billing RateCreate and edit organization billing rates within Grafana.com.org-billing-rate:write
Org MembersDelete Grafana.com organization members.org-members:delete
Org MembersRead Grafana.com organization members.org-members:read
Org MembersCreate and edit Grafana.com organization members.org-members:write
Org Overage BillsAccess and manage org overage bills.org-overage-bills:write
Org Referral CodesRead referral codes from Grafana.com.org-referral-codes:read
Org Referral CodesCreate and edit org referral codes.org-referral-codes:write
OrgsDelete organizations from Grafana.com.orgs:delete
OrgsRead organizations from Grafana.com.orgs:read
OrgsCreate and edit organizations within Grafana.com.orgs:write
PaymentsMake payments for Grafana.com.payments:write
PdcDelete PDC on Grafana Cloud stack.pdc:delete
PdcRead PDC on Grafana Cloud stack.pdc:read
PdcCreate and edit PDC on Grafana Cloud stack.pdc:write
Plugin Submission CommentsCreate plugin submission comments on Grafana.com.plugin-submission-comments:write
Plugin SubmissionsDelete plugin submissions on Grafana.com.plugin-submissions:delete
Plugin SubmissionsRead plugin submissions on Grafana.com.plugin-submissions:read
Plugin SubmissionsCreate and edit plugin submissions on Grafana.com.plugin-submissions:write
Plugin VersionsDelete version of plugin on Grafana.com.plugin-versions:delete
Plugin VersionsUpdate version of plugin on Grafana.com.plugin-versions:write
PluginsCreate and edit plugins on Grafana.com.plugins:write
ProfilesRead profiles from a Grafana Cloud stack.profiles:read
ProfilesWrite profiles to a Grafana Cloud stack.profiles:write
Provisioned PluginsDelete plugins which are provisioned onto Grafana Cloud stack.provisioned-plugins:delete
Provisioned PluginsRead plugins which are provisioned onto Grafana Cloud stack.provisioned-plugins:read
Provisioned PluginsCreate and edit plugins which are provisioned onto Grafana Cloud stack.provisioned-plugins:write
Referral CodesDelete referral codes.referral-codes:delete
Referral CodesRead referral codes.referral-codes:read
Referral CodesCreate and edit referral codes.referral-codes:write
Relabel RulesRead relabel rules from a Grafana Cloud stack.relabel-rules:read
Relabel RulesCreate and edit relabel rules for a Grafana Cloud stack.relabel-rules:write
Repository TokensDelete repository tokens on Grafana.com.repository-tokens:delete
Repository TokensRead repository tokens on Grafana.com.repository-tokens:read
Repository TokensCreate and edit repository tokens on Grafana.com.repository-tokens:write
RulesRead rules from a Grafana Cloud stack.rules:read
RulesCreate and edit rules for a Grafana Cloud stack.rules:write
Service ModelDelete Service Catalogservice-model:delete
Service ModelRead Service Catalogservice-model:read
Service ModelCreate Service Catalogservice-model:write
SlosDelete SLOsslos:delete
SlosRead SLOsslos:read
SlosCreate SLOsslos:write
SourcemapsDelete stored source maps using the Frontend Observability APIsourcemaps:delete
SourcemapsRead source maps from the Frontend Observability APIsourcemaps:read
SourcemapsWrite (upload) source maps to the Frontend Observability APIsourcemaps:write
Sso ConfigsDelete SSO configs from Grafana.com.sso-configs:delete
Sso ConfigsRead SSO configs from Grafana.com.sso-configs:read
Sso ConfigsCreate and edit SSO configs.sso-configs:write
Stack Api KeysCreate API keys for a Grafana instance within a Grafana Cloud stack from Grafana.com.stack-api-keys:write
Stack ConfigRead stack config.stack-config:read
Stack ConfigCreate and edit stack config.stack-config:write
Stack DashboardsDelete dashboards from Grafana instance within a Grafana Cloud stack from Grafana.com.stack-dashboards:delete
Stack DashboardsRead dashboards for Grafana instance within a Grafana Cloud stack from Grafana.com.stack-dashboards:read
Stack DashboardsCreate and edit dashboards for Grafana instance within a Grafana Cloud stack from Grafana.com.stack-dashboards:write
Stack LogsRead stack logs.stack-logs:read
Stack OauthRead OAuth config for Grafana Cloud stacks from Grafana.com.stack-oauth:read
Stack OauthCreate and edit OAuth config for Grafana Cloud stacks from Grafana.com.stack-oauth:write
Stack PluginsDelete plugins from Grafana instance within a Grafana Cloud stack from Grafana.com.stack-plugins:delete
Stack PluginsRead plugins for Grafana instance within a Grafana Cloud stack from Grafana.com.stack-plugins:read
Stack PluginsCreate and edit plugins for Grafana instance within a Grafana Cloud stack from Grafana.com.stack-plugins:write
Stack Service AccountsCreate service accounts for a Grafana instance within a Grafana Cloud stack from Grafana.com.stack-service-accounts:write
Stack StatsCreate and edit stack stats.stack-stats:write
Stack UsersRead Grafana Cloud stack users from Grafana.com.stack-users:read
Stack UsersCreate and edit stack users.stack-users:write
StacksDelete Grafana Cloud stacks from Grafana.com.stacks:delete
StacksRead Grafana Cloud stacks from Grafana.com.stacks:read
StacksCreate and edit Grafana Cloud stacks from Grafana.com.stacks:write
Subscription Usage ConfigsAccess and manage subscription usage configs.subscription-usage-configs:delete
Subscription Usage ConfigsRead subscription usage configs from Grafana.com.subscription-usage-configs:read
Subscription Usage ConfigsAccess and manage subscription usage configs.subscription-usage-configs:write
SubscriptionsRead subscriptions from Grafana.com.subscriptions:read
SubscriptionsCreate and edit subscriptions within Grafana.com.subscriptions:write
Support Ticket CommentsDelete support tickets on Grafana.com.support-ticket-comments:write
Support TicketsRead support tickets on Grafana.com.support-tickets:read
Support TicketsCreate and edit support tickets on Grafana.com.support-tickets:write
TracesDelete traces from a Grafana Cloud stack.traces:delete
TracesRead traces from a Grafana Cloud stack.traces:read
TracesWrite traces to a Grafana Cloud stack.traces:write

The scopes you select limit the Grafana Cloud services you can query and the actions you can perform using the given access policy. Let’s say that you want to read metrics, traces, and logs and not write them. In this case, the access policy includes the metrics:read, logs:read, and traces:read scopes.

In the Grafana Administration settings, the same set of scopes, metrics:read, logs:read, and traces:read, are selected using checkboxes.

The available scopes in Cloud access policies within a stack.
The available scopes in Cloud access policies within a stack.

The Access Policies page in the Cloud Portal also has these scopes. You can specify a different realm using the Access policies page in the Cloud Portal.

LabelPolicy or Label selectors

A LabelPolicy is a set of Prometheus label selectors used to limit metrics and logs data to specific label criteria. For example, adding a label policy of {env="dev"} returns matches from the dev environment. If you create an access policy with that label selector, then entities with a token for that access policy will only be able to query for metrics or logs that include the { env="dev" } label.

LabelPolicies are only available for reading logs and metrics.

In the Cloud Access Policies Plugin, LabelPolicies are referred to as Label selectors.

Refer to Using label-based access control with access policies for additional information.

IP range based access control

You can use IP range based access control with access policies to limit access to your Grafana Cloud services based on IP subnets. When configured, all tokens created under the access policy will obey the settings. Connections initiated from IP addresses outside of the specified ranges will be denied.

Refer to Using IP range based access control with access policies for additional information.

Migrate Grafana Cloud API keys to access policies

To access legacy Grafana Cloud API keys, log into your Grafana Cloud instance, click on Administration in the left-side menu, then Users and access -> API Keys.

A legacy Grafana Cloud API key with the proper role allows programmatic interaction with the Grafana Cloud API and hosted services. Each API key is linked to an organization and provides Admin, Editor, and Viewer roles. These roles apply at the organization level which includes all stacks and data within an organization. These API keys lack fine-grained access control: access is controlled only by a few roles.

To address this issue, Grafana Cloud Access Policies provide granular access control over Grafana Cloud by adding the ability to limit access to a single stack, select fine-grained scopes, define label filters, and set the token expiration dates. One or more tokens are created for an access policy, and these tokens are only capable of what is defined within their access policy.

CapabilityLegacy Grafana Cloud API keysNew Grafana Cloud Access Policies
Control based at which levelOrganization levelOrganization or stack level
PermissionsViewer, Editor, Admin rolesLimited granular scopes
Token expirationNot availableAvailable
Label-based access controlNot availableAvailable, with read scopes for metrics and logs
IP range based access controlNot availableAvailable