Migrate to Azure Managed Grafana

This guide shows how to migrate content from a local or a cloud-managed Grafana to Azure Managed Grafana using the Azure CLI. The following elements can be migrated automatically:

  • data sources
  • folders
  • library panels
  • dashboards
  • snapshots
  • annotations

Prerequisites

The following instructions show how to migrate content from a Grafana instance to Azure Managed Grafana using the Azure platform.

Tip

Consider migrating content using the Azure CLI, which is the quickest method.

Note

Some of the instructions presented in this tutorial vary slightly depending on the version of Grafana used. This tutorial was created using Grafana 10.

Prerequisites

Create a service account token

Start by creating a service account token to grant the necessary permissions to access and export content from your Grafana instance.

  1. In the Grafana you want to collect content from (source), create a new service account with Admin permissions by going to Administration > Users and access > Service accounts > Add service account.

    Screenshot of the Grafana UI  showing the Add service account action.

    Tip

    This step requires using Grafana service accounts. If you're migrating from an Azure Managed Grafana workspace, enable service accounts in Azure Managed Grafana.

  2. Enter a display name for the new service account, select the Admin role, Apply, and Create.

  3. Once the service account has been created, select Add token, optionally set an expiration date, and select Generate token. Remember to copy the token now as you won't be able to see it again once you leave this page.

Run the Grafana migrate command

In the Azure CLI, run the az grafana migrate command. When running the command below, replace the placeholders <target-grafana> <target-grafana-resource-group> <--src-endpoint>, <source-grafana-endpoint>and <source-token> with the name and resource group of the Azure Managed Grafana workspace you want to migrate to (target), the endpoint of the Grafana you're collecting content from (source), and the service account token you created earlier.

az grafana migrate --name <target-grafana> --resource-group <target-grafana-resource-group> --src-endpoint <source-grafana-endpoint> --src-token-or-key <source-token>

The Azure CLI output lists all the elements that were migrated over to your Azure Managed Grafana workspace.

Optional parameters for this command include:

  • --dry-run: Preview changes without committing.
  • --folders-to-exclude: Folders to exclude in backup or sync.
  • --folders-to-include: Folders to include in backup or sync.
  • --overwrite: If you try to migrate a dashboard that already exists in your target Grafana workspace, by default, Azure Managed Grafana skips the creation of the new data source to avoid creating a duplicate. The overwrite option lets you overwrite previous dashboards, library panels, and folders with the same uid or title.

Finalize Grafana migration

Go to your target workspace and check that you can find everything you migrated from your Grafana instance.

Important

If your data sources are set up using secrets, you need to manually reconfigure these secrets in your target workspace to successfully configure your data sources.

Export your Grafana dashboards

Start by exporting your Grafana dashboards as JSON files.

  1. Open your Grafana user interface and go Dashboards.

  2. Open one of your dashboards and select the Share panel or dashboard icon.

  3. Go to the Export tab and select Save to file.

    Screenshot of the Grafana user interface showing the JSON data in the JSON Model tab.

  4. Repeat this process for each dashboard you want to export.

Import your Grafana dashboards into Azure Managed Grafana

Create a new dashboard in Azure Managed Grafana by importing the JSON files you exported.

  1. In the Overview page of your Azure Managed Grafana workspace, open the Endpoint URL to open the Grafana portal.

  2. Select + at the top of the page, then Import dashboard.

    Screenshot of the Grafana UI in the Azure Managed Grafana workspace. The image shows the + and Import dashboard buttons at the top of the page.

  3. Select Upload dashboard JSON file and select the file on your local machine.

  4. Select Load and review the dashboard settings. Optionally edit the dashboard name, folder, and unique identifier (UID).

  5. Select Import to save the dashboard. Repeat this process for each dashboard you want to import.

    Screenshot of the Grafana UI in the Azure Managed Grafana workspace. The image shows the import option.

For more information about how to create and edit dashboards, go to Create a dashboard in Azure Managed Grafana.

Install data source plugins

Core data source plugins supported by your workspace's pricing plan are installed by default. To install other optional plugins, follow the process below:

  1. Open your workspace in the Azure portal and go to Plugin management (Preview).
  2. Choose a plugin to install by selecting its checkbox and select Save.
  3. Repeat this process for each data source plugin you want to install.

Refer to Add a plugin for more information.

Configure your data sources

Configure your new data sources in Azure Managed Grafana.

  1. In the Overview page of your Azure Managed Grafana workspace, open the Endpoint URL to open the Grafana portal.
  2. In the Grafana user interface, go to Connections > Data sources > Add new datasource.
  3. Select a data source from the list.
  4. Fill out the required fields and select Save & test to save the configuration and verify that Grafana can connect to the data source.
  5. Repeat this process for each data source.

For more information about plugins, data sources, and dashboards, check the following content: