Skip to content

Create Workspace Service Account Token

managedgrafana_create_workspace_service_account_token R Documentation

Creates a token that can be used to authenticate and authorize Grafana HTTP API operations for the given workspace service account

Description

Creates a token that can be used to authenticate and authorize Grafana HTTP API operations for the given workspace service account. The service account acts as a user for the API operations, and defines the permissions that are used by the API.

When you create the service account token, you will receive a key that is used when calling Grafana APIs. Do not lose this key, as it will not be retrievable again.

If you do lose the key, you can delete the token and recreate it to receive a new key. This will disable the initial key.

Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.

Usage

managedgrafana_create_workspace_service_account_token(name,
  secondsToLive, serviceAccountId, workspaceId)

Arguments

name

[required] A name for the token to create.

secondsToLive

[required] Sets how long the token will be valid, in seconds. You can set the time up to 30 days in the future.

serviceAccountId

[required] The ID of the service account for which to create a token.

workspaceId

[required] The ID of the workspace the service account resides within.

Value

A list with the following syntax:

list(
  serviceAccountId = "string",
  serviceAccountToken = list(
    id = "string",
    key = "string",
    name = "string"
  ),
  workspaceId = "string"
)

Request syntax

svc$create_workspace_service_account_token(
  name = "string",
  secondsToLive = 123,
  serviceAccountId = "string",
  workspaceId = "string"
)