Share via


az grafana data-source

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 data-source command. Learn more about extensions.

Commands to manage data sources of an instance.

Commands

Name Description Type Status
az grafana data-source create

Create a data source.

Extension GA
az grafana data-source delete

Delete a data source.

Extension GA
az grafana data-source list

List all data sources of an instance.

Extension GA
az grafana data-source query

Query a data source having backend implementation.

Extension GA
az grafana data-source show

Get the details of a data source.

Extension GA
az grafana data-source update

Update a data source.

Extension GA

az grafana data-source create

Create a data source.

az grafana data-source create --definition
                              --name
                              [--api-key]
                              [--resource-group]

Examples

create an Azure Monitor data source using Managed Identity

az grafana data-source create -n MyGrafana --definition '{
  "access": "proxy",
  "jsonData": {
    "azureAuthType": "msi",
    "subscriptionId": "3a7edf7d-1488-4017-a908-111111111111"
  },
  "name": "Azure Monitor-3",
  "type": "grafana-azure-monitor-datasource"
}'

create an Azure Monitor data source using App Registration

az grafana data-source create -n MyGrafana --definition '{
  "name": "Azure Monitor-2",
  "type": "grafana-azure-monitor-datasource",
  "access": "proxy",
  "jsonData": {
    "subscriptionId": "3a7edf7d-1488-4017-a908-111111111111",
    "azureAuthType": "clientsecret",
    "cloudName": "azuremonitor",
    "tenantId": "72f988bf-86f1-41af-91ab-111111111111",
    "clientId": "fb31a2f5-9122-4be9-9705-111111111111"
  },
  "secureJsonData": { "clientSecret": "verySecret" }
}'

create an Azure Data Explorer data source using Managed Identity

az grafana data-source create -n MyGrafana --definition '{
  "name": "Azure Data Explorer Datasource-2",
  "type": "grafana-azure-data-explorer-datasource",
  "access": "proxy",
  "jsonData": {
    "dataConsistency": "strongconsistency",
    "clusterUrl": "https://mykusto.westcentralus.kusto.windows.net"
  }
}'

create an Azure Data Explorer data source using App Registration

az grafana data-source create -n MyGrafana --definition '{
  "name": "Azure Data Explorer Datasource-1",
  "type": "grafana-azure-data-explorer-datasource",
  "access": "proxy",
  "jsonData": {
    "clusterUrl": "https://mykusto.westcentralus.kusto.windows.net",
    "azureCredentials": {
      "authType": "clientsecret",
      "azureCloud": "AzureCloud",
      "tenantId": "72f988bf-86f1-41af-91ab-111111111111",
      "clientId": "fb31a2f5-9122-4be9-9705-111111111111"
    }
  },
  "secureJsonData": { "azureClientSecret": "verySecret" }
}'

create an Azure Managed Prometheus data source using App Registration

az grafana data-source create -n MyGrafana --definition '{
  "name": "Azure Managed Prometheus-1",
  "type": "prometheus",
  "access": "proxy",
  "url": "https://myprom-abcd.westcentralus.prometheus.monitor.azure.com",
  "jsonData": {
    "httpMethod": "POST",
    "azureCredentials": {
      "authType": "clientsecret",
      "azureCloud": "AzureCloud",
      "tenantId": "72f988bf-86f1-41af-91ab-111111111111",
      "clientId": "fb31a2f5-9122-4be9-9705-111111111111"
    },
    "timeInterval": "30s"
  },
  "secureJsonData": { "azureClientSecret": "verySecret" }
}'

create an Azure Managed Prometheus data source using managed identity

az grafana data-source create -n MyGrafana --definition '{
  "name": "Azure Managed Prometheus-1",
  "type": "prometheus",
  "access": "proxy",
  "url": "https://myprom-jryu.westcentralus.prometheus.monitor.azure.com",
  "jsonData": {
    "httpMethod": "POST",
    "azureCredentials": { "authType": "msi" }
  }
}'

create an Azure SQL data source

az grafana data-source create -n MyGrafana --definition '{
  "access": "proxy",
  "database": "testdb",
  "jsonData": {
    "authenticationType": "SQL Server Authentication",
    "encrypt": "false"
  },
  "secureJsonData": {
    "password": "verySecretPassword"
  },
  "name": "Microsoft SQL Server",
  "type": "mssql",
  "url": "testsql.database.windows.net",
  "user": "admin1"
}'

Required Parameters

--definition

Json string with data source definition, or a path 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.

--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 data-source delete

Delete a data source.

az grafana data-source delete --data-source
                              --name
                              [--api-key]
                              [--resource-group]

Required Parameters

--data-source

Name, id, uid which can identify a data source. CLI will search in the order of name, id, and uid, till finds a match.

--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 data-source list

List all data sources of an instance.

az grafana data-source list --name
                            [--api-key]
                            [--resource-group]

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 data-source query

Query a data source having backend implementation.

az grafana data-source query --data-source
                             --name
                             [--api-key]
                             [--conditions]
                             [--from]
                             [--internal-ms]
                             [--max-data-points]
                             [--query-format]
                             [--resource-group]
                             [--to]

Required Parameters

--data-source

Name, id, uid which can identify a data source. CLI will search in the order of name, id, and uid, till finds a match.

--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.

--conditions

Space-separated condition in a format of <name>=<value>.

--from

Start time in iso 8601, e.g. '2022-01-02T16:15:00'. Default: 1 hour early.

--internal-ms

The time interval in milliseconds of time series. Default: 1000.

Default value: 1000
--max-data-points

Maximum amount of data points that dashboard panel can render. Default: 1000.

Default value: 100
--query-format

Format of the resule, e.g. table, time_series.

--resource-group -g

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

--to

End time in iso 8601, e.g. '2022-01-02T17:15:00'. Default: current time.

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 data-source show

Get the details of a data source.

az grafana data-source show --data-source
                            --name
                            [--api-key]
                            [--resource-group]

Required Parameters

--data-source

Name, id, uid which can identify a data source. CLI will search in the order of name, id, and uid, till finds a match.

--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 data-source update

Update a data source.

az grafana data-source update --data-source
                              --definition
                              --name
                              [--api-key]
                              [--resource-group]

Required Parameters

--data-source

Name, id, uid which can identify a data source. CLI will search in the order of name, id, and uid, till finds a match.

--definition

Json string with data source definition, or a path 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.

--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.