Editja

Ixxerja permezz ta’


How to use service accounts in Azure Managed Grafana

In this guide, learn how to use service accounts. Service accounts are used to run automated operations and authenticate applications in Grafana with the Grafana API.

Common use cases include:

  • Provisioning or configuring dashboards
  • Scheduling reports
  • Defining alerts
  • Setting up an external SAML authentication provider
  • Interacting with Grafana without signing in as a user

Prerequisites

Enable service accounts

If your existing Grafana workspace doesn't have service accounts enabled, you can enable them by updating the preference settings of your Grafana instance.

  1. In the Azure portal, under Settings, select Configuration, and then under API keys and service accounts, select Enable.

    Screenshot of the Azure platform. Enable service accounts.

  2. Select Save to confirm that you want to enable API keys and service accounts in Azure Managed Grafana.

Create a service account

Follow the steps below to create a new Grafana service account and list existing service accounts:

  1. Go to your Grafana instance endpoint, and under Configuration, select Service accounts.

  2. Select Add service account, and enter a Display name and a Role for your new Grafana service account: Viewer, Editor or Admin and select Create.

    Screenshot of Grafana. Add service account page.

  3. The page displays the notification Service account successfully created and some information about your new service account.

  4. Select the back arrow sign to view a list of all the service accounts of your Grafana instance.

Add a service account token and review tokens

Once you've created a service account, add one or more access tokens. Access tokens are generated strings used to authenticate to the Grafana API.

  1. To create a service account token, select Add token.

  2. Use the automatically generated Display name or enter a name of your choice, and optionally select an Expiration date or keep the default option to set no expiry date.

    Screenshot of the Azure platform. Add service account token page.

  3. Select Generate token, and take note of the token generated. This token will only be shown once, so make sure you save it, as loosing a token requires creating a new one.

  4. Select the service account to access information about your service account, including a list of all associated tokens.

Edit a service account

In this section, learn how to update a Grafana service account in the following ways:

  • Edit the name of a service account
  • Edit the role of a service account
  • Disable a service account
  • Enable a service account

Actions:

  • To edit the name, select the service account and under Information select Edit.
  • To edit the role, select the service account and under Information, select the role and choose another role name.
  • To disable a service account, select a service account and at the top of the page select Disable service account, then select Disable service account to confirm. Disabled service accounts can be re-enabled by selecting Enable service account.

Screenshot of the Azure platform. Edit service account page.

The notification Service account updated is instantly displayed.

Delete a service account

To delete a Grafana service account, select a service account and at the top of the page select Delete service account, then select Delete service account to confirm. Deleting a service account is final and a service account can't be recovered once deleted.

Screenshot of the Azure platform. Deleting service account page.

Delete a service account token

To delete a service account token, select a service account and under Tokens, select Delete (x). Select Delete to confirm.

Screenshot of the Azure platform. Deleting service account token page.

Next steps

In this how-to guide, you learned how to create and manage service accounts and tokens to run automated operations in Azure Managed Grafana. When you're ready, explore more articles: