Share via


az grafana dashboard

Note

This reference is part of the amg extension for the Azure CLI (version 2.61.0 or higher). The extension will automatically install the first time you run an az grafana dashboard command. Learn more about extensions.

Commands to manage dashboards of an instance.

Commands

Name Description Type Status
az grafana dashboard create

Create a new dashboard.

Extension GA
az grafana dashboard delete

Delete a dashboard.

Extension GA
az grafana dashboard import

Import a dashboard.

Extension GA
az grafana dashboard list

List all dashboards of an instance.

Extension GA
az grafana dashboard show

Get the details of a dashboard.

Extension GA
az grafana dashboard sync

Sync Azure Managed Grafana dashboards from one instance to another instance. Library panels within the dashboards will be automatically included in the sync. Note, dashboards with "Provisioned" state will be skipped due to being read-only.

Extension Preview
az grafana dashboard update

Update a dashboard.

Extension GA

az grafana dashboard create

Create a new dashboard.

az grafana dashboard create --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]
                            [--title]

Examples

Create a dashboard with definition in a json file. For quick start, clone from the output of "az grafana dashboard show", remove "id" and "uid", and apply changes.

az grafana dashboard create -g MyResourceGroup -n MyGrafana --title "My dashboard" --folder folder1 --definition '{
  "dashboard": {
    "annotations": {
        ...
    },
    "panels": {
        ...
    }
  },
  "message": "Create a new test dashboard"
}'

Required Parameters

--definition

The complete dashboard model in json string, a path or url to a file with such content.

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--folder

Uid or title which can identify a folder. CLI will search with uid first, then title, till it finds a match.

--overwrite

Overwrite a dashboard with same uid.

Accepted values: false, true
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--title

Title of a dashboard.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard delete

Delete a dashboard.

az grafana dashboard delete --dashboard
                            --name
                            [--api-key]
                            [--resource-group]

Examples

Delete a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)

az grafana dashboard delete -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz

Required Parameters

--dashboard

Dashboard uid.

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard import

Import a dashboard.

CLI command will fill in required parameters for data sources if configured.

az grafana dashboard import --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]

Examples

import the dashboard of "AKS Container Insights" from Grafana gallery.

az grafana dashboard import -g MyResourceGroup -n MyGrafana --definition 12180

import a dashboard from a file.

az grafana dashboard import -g MyResourceGroup -n MyGrafana --definition @c:\temp\dashboard.json

Required Parameters

--definition

The complete dashboard model in json string, Grafana gallery id, a path or url to a file with such content.

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--folder

Uid or title which can identify a folder. CLI will search with uid first, then title, till it finds a match.

--overwrite

Overwrite a dashboard with same uid.

Accepted values: false, true
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard list

List all dashboards of an instance.

az grafana dashboard list --name
                          [--api-key]
                          [--resource-group]

Examples

Find the dashboard for K8s API Server and retrieve the unique identifier(in order to invoke "az grafana dashboard show" command)

az grafana dashboard list -g MyResourceGroup -n MyGrafana --query "[?contains(@.title, 'API server')].uid"

Required Parameters

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard show

Get the details of a dashboard.

az grafana dashboard show --dashboard
                          --name
                          [--api-key]
                          [--resource-group]

Examples

Get details of a dashboard specified by an unique identifier(use "az grafana dashboard list" command to retrieve the uid)

az grafana dashboard show -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz

Required Parameters

--dashboard

Dashboard uid.

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard sync

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Sync Azure Managed Grafana dashboards from one instance to another instance. Library panels within the dashboards will be automatically included in the sync. Note, dashboards with "Provisioned" state will be skipped due to being read-only.

az grafana dashboard sync --destination
                          --source
                          [--dashboards-to-exclude]
                          [--dashboards-to-include]
                          [--dry-run {false, true}]
                          [--folders-to-exclude]
                          [--folders-to-include]

Examples

Sync only dashboards under a few folders

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --folders-to-include "Azure Monitor Container Insights" "Azure Monitor"

Sync a single dashboard

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --folders-to-include "MyFolder" --dashboards-to-include "My Service Health"

Preview the sync

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --dry-run

Required Parameters

--destination -d

Resource id of the destination workspace.

--source -s

Resource id of the source workspace.

Optional Parameters

--dashboards-to-exclude

Space separated titles of dashboards to exclude in sync. Pair with --folders-to-exclude for folders specific.

--dashboards-to-include

Space separated titles of dashboards to include in sync. Pair with --folders-to-include for folders specific.

--dry-run

Preview changes w/o committing.

Accepted values: false, true
--folders-to-exclude -e

Folders to exclude in backup or sync.

--folders-to-include -i

Folders to include in backup or sync.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az grafana dashboard update

Update a dashboard.

az grafana dashboard update --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]

Examples

Update a dashboard with definition in a json file. For quick start, get existing configuration from "az grafana dashboard show", and apply changes. "version" field need to be updated, and "overwrite" field should be true.

az grafana dashboard update -g MyResourceGroup -n MyGrafana --definition @c:\temp\dashboard.json

Required Parameters

--definition

The complete dashboard model in json string, a path or url to a file with such content.

--name -n

Name of the Azure Managed Grafana.

Optional Parameters

--api-key --token -t

Api key or service account token, a randomly generated string used to interact with Grafana endpoint; if missing, CLI will use current logged-in user's credentials.

--folder

Uid or title which can identify a folder. CLI will search with uid first, then title, till it finds a match.

--overwrite

Overwrite a dashboard with same uid.

Accepted values: false, true
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.