<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Introduction to the Grafana CLI on Grafana Labs</title><link>https://grafana.com/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/</link><description>Recent content in Introduction to the Grafana CLI on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/index.xml" rel="self" type="application/rss+xml"/><item><title>gcx CLI</title><link>https://grafana.com/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/gcx/</link><pubDate>Tue, 28 Jul 2026 13:41:43 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/gcx/</guid><content><![CDATA[&lt;h1 id=&#34;overview-of-the-gcx-cli&#34;&gt;Overview of the &lt;code&gt;gcx&lt;/code&gt; CLI&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is a single CLI that ships with a suite of agent skills and allows you and your AI coding agent structured access to both Grafana (dashboards, folders, alert rules, data sources) and Grafana Cloud products such as Synthetic Monitoring, K6, Fleet Management, Incidents, or Adaptive Telemetry. It&amp;rsquo;s integrated with Grafana Assistant, combining the previously fragmented user experience into one single tool.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is under continuous development. &lt;a href=&#34;/help/&#34;&gt;Contact Grafana&lt;/a&gt; for support or to report any issues you encounter and help us improve this feature.&lt;/p&gt;
&lt;h2 id=&#34;compatibility&#34;&gt;Compatibility&lt;/h2&gt;
&lt;p&gt;The following applies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is compatible with any agentic coding tool.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; works across a wide range of Grafana product offerings. Feature availability depends on your Grafana deployment. For more information, refer to the &lt;a href=&#34;https://github.com/grafana/gcx#compatibility&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Compatibility matrix&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is available for Grafana Cloud and Grafana OSS/Enterprise v12 or later, and older Grafana versions are not supported.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;migrate-from-grafanactl&#34;&gt;Migrate from &lt;code&gt;grafanactl&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;If you want to migrate from &lt;code&gt;grafanctl&lt;/code&gt; to &lt;code&gt;gcx&lt;/code&gt;, search-and-replace &lt;code&gt;grafanactl&lt;/code&gt; with &lt;code&gt;gcx&lt;/code&gt;. For &lt;code&gt;grafanactl resources serve&lt;/code&gt;, use &lt;code&gt;gcx dev serve&lt;/code&gt; instead.&lt;/p&gt;
&lt;h2 id=&#34;learn-more&#34;&gt;Learn more&lt;/h2&gt;
&lt;p&gt;Refer to the documents in this section and the &lt;a href=&#34;https://github.com/grafana/gcx&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;gcx&lt;/code&gt; repository&lt;/a&gt; in GitHub for more information on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installation&lt;/li&gt;
&lt;li&gt;Configuration&lt;/li&gt;
&lt;li&gt;Migration of your configuration files to v1 format&lt;/li&gt;
&lt;li&gt;Usage statistics&lt;/li&gt;
&lt;li&gt;How to manage resources, including dashboards-as-code&lt;/li&gt;
&lt;li&gt;CLI command reference&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="overview-of-the-gcx-cli">Overview of the &lt;code>gcx&lt;/code> CLI&lt;/h1>
&lt;p>&lt;code>gcx&lt;/code> is a single CLI that ships with a suite of agent skills and allows you and your AI coding agent structured access to both Grafana (dashboards, folders, alert rules, data sources) and Grafana Cloud products such as Synthetic Monitoring, K6, Fleet Management, Incidents, or Adaptive Telemetry. It&amp;rsquo;s integrated with Grafana Assistant, combining the previously fragmented user experience into one single tool.&lt;/p></description></item><item><title>Install and set up the grafanactl CLI</title><link>https://grafana.com/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/grafanactl/</link><pubDate>Tue, 23 Jun 2026 13:06:40 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/grafanactl/</guid><content><![CDATA[&lt;h1 id=&#34;install-and-set-up-the-grafanactl-cli&#34;&gt;Install and set up the &lt;code&gt;grafanactl&lt;/code&gt; CLI&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;&lt;code&gt;grafanactl&lt;/code&gt; is being deprecated, and we&amp;rsquo;re bringing all our learning and experience into the new, improved CLI tool 
    &lt;a href=&#34;/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/gcx/&#34;&gt;&lt;code&gt;gcx&lt;/code&gt;&lt;/a&gt;. The &lt;code&gt;grafanactl&lt;/code&gt; repository in GitHub will be archived on June 1, 2026.&lt;/p&gt;
&lt;p&gt;To migrate from &lt;code&gt;grafanactl&lt;/code&gt; to &lt;code&gt;gcx&lt;/code&gt;, search-and-replace &lt;code&gt;grafanactl&lt;/code&gt; with &lt;code&gt;gcx&lt;/code&gt;. For &lt;code&gt;grafanactl resources serve&lt;/code&gt;, use &lt;code&gt;gcx dev serve&lt;/code&gt; instead.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;grafanactl&lt;/code&gt; command-line tool allows you to authenticate, manage multiple environments, and perform administrative tasks through the Grafana REST API, all from the terminal. It&amp;rsquo;s available for Grafana OSS, Enterprise, and Cloud.&lt;/p&gt;
&lt;h2 id=&#34;install-the-grafana-cli-grafanactl&#34;&gt;Install the Grafana CLI &lt;code&gt;grafanactl&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can install the project using one of the following supported methods:&lt;/p&gt;
&lt;h3 id=&#34;1-download-a-pre-built-binary&#34;&gt;1. Download a pre-built binary&lt;/h3&gt;
&lt;p&gt;Download the latest binary for your platform from the &lt;a href=&#34;https://github.com/grafana/grafanactl/releases&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Releases page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Prebuilt binaries are available for a variety of operating systems and architectures. Visit the latest release page, and scroll down to the Assets section.&lt;/p&gt;
&lt;p&gt;To install the binary, follow the instructions below:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the archive for the desired operating system and architecture&lt;/li&gt;
&lt;li&gt;Extract the archive&lt;/li&gt;
&lt;li&gt;Move the executable to the desired directory&lt;/li&gt;
&lt;li&gt;Ensure this directory is included in the PATH environment variable&lt;/li&gt;
&lt;li&gt;Verify that you have execute permission on the file&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;2-build-from-source&#34;&gt;2. Build from source&lt;/h3&gt;
&lt;p&gt;To build &lt;code&gt;grafanactl&lt;/code&gt; from source you must:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Have &lt;code&gt;git&lt;/code&gt; installed&lt;/li&gt;
&lt;li&gt;Have &lt;code&gt;go&lt;/code&gt; v1.24 (or greater) installed&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;go install github.com/grafana/grafanactl/cmd/grafanactl@latest&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;configure-grafanactl&#34;&gt;Configure &lt;code&gt;grafanactl&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can configure &lt;code&gt;grafanactl&lt;/code&gt; in two ways: using environment variables or through a configuration file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Environment variables&lt;/strong&gt; are ideal for CI environments and support a single context. A full list of supported environment variables is available in the &lt;a href=&#34;https://github.com/grafana/grafanactl/blob/main/docs/reference/environment-variables/index.md#environment-variables-reference&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;reference documentation&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuration files&lt;/strong&gt; can manage multiple contexts, making it easier to switch between different Grafana instances.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Configuration items may change depending on your set-up. For example, use &lt;code&gt;org-id&lt;/code&gt; for self-managed Grafana, but use &lt;code&gt;stack-id&lt;/code&gt; for Grafana Cloud.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;configure-grafana-cli-with-environment-variables&#34;&gt;Configure Grafana CLI with environment variables&lt;/h3&gt;
&lt;p&gt;Grafana CLI communicates with Grafana via the REST API, which requires authentication credentials.&lt;/p&gt;
&lt;p&gt;At a minimum, set the URL of your Grafana instance and the organization ID:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;GRAFANA_SERVER=&amp;#39;http://localhost:3000&amp;#39; GRAFANA_ORG_ID=&amp;#39;1&amp;#39; grafanactl config check&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Depending on your authentication method, you may also need to set:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;a href=&#34;https://github.com/grafana/grafanactl/blob/main/docs/reference/environment-variables/index.md#grafana_token&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;token&lt;/a&gt; for a &lt;a href=&#34;/docs/grafana/latest/administration/service-accounts/&#34;&gt;Grafana service account&lt;/a&gt; (recommended)&lt;/li&gt;
&lt;li&gt;A &lt;a href=&#34;https://github.com/grafana/grafanactl/blob/main/docs/reference/environment-variables/index.md#grafana_user&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;username&lt;/a&gt; and &lt;a href=&#34;https://github.com/grafana/grafanactl/blob/main/docs/reference/environment-variables/index.md#grafana_password&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;password&lt;/a&gt; for basic authentication&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To persist your configuration, consider &lt;a href=&#34;#use-configuration-contexts&#34;&gt;creating a context&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;use-configuration-contexts&#34;&gt;Use configuration contexts&lt;/h4&gt;
&lt;p&gt;Contexts allow you to easily switch between multiple Grafana instances.&lt;/p&gt;
&lt;p&gt;By default, the CLI uses a context named &lt;code&gt;default&lt;/code&gt;. To configure it use:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config set contexts.default.grafana.server http://localhost:3000
grafanactl config set contexts.default.grafana.org-id 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Authenticate with a service account token:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config set contexts.default.grafana.token service-account-token&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Or use basic authentication:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config set contexts.default.grafana.user admin
grafanactl config set contexts.default.grafana.password admin&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can define additional contexts in the same way:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config set contexts.staging.grafana.server https://staging.grafana.example
grafanactl config set contexts.staging.grafana.org-id 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;In these examples, &lt;code&gt;default&lt;/code&gt; and &lt;code&gt;staging&lt;/code&gt; are the names of the contexts.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;configure-grafana-cli-with-configuration-files&#34;&gt;Configure Grafana CLI with configuration files&lt;/h3&gt;
&lt;p&gt;Grafana CLI stores its configuration in a YAML file. The CLI determines the configuration file location in the following order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If the &lt;code&gt;--config&lt;/code&gt; flag is provided, the specified file is used.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;$XDG_CONFIG_HOME&lt;/code&gt; is set:
&lt;code&gt;$XDG_CONFIG_HOME/grafanactl/config.yaml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;$HOME&lt;/code&gt; is set:
&lt;code&gt;$HOME/.config/grafanactl/config.yaml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;$XDG_CONFIG_DIRS&lt;/code&gt; is set:
&lt;code&gt;$XDG_CONFIG_DIRS/grafanactl/config.yaml&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Use &lt;code&gt;grafanactl config check&lt;/code&gt; to display the configuration file currently in use.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;useful-commands&#34;&gt;Useful commands&lt;/h2&gt;
&lt;p&gt;Check the current configuration:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config check&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;This command is useful to troubleshoot your configuration.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;List all available contexts:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config list-contexts&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Switch to a specific context:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config use-context staging&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;View the full configuration:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;grafanactl config view&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="install-and-set-up-the-grafanactl-cli">Install and set up the &lt;code>grafanactl&lt;/code> CLI&lt;/h1>
&lt;div class="admonition admonition-caution">&lt;blockquote>&lt;p class="title text-uppercase">Caution&lt;/p>&lt;p>&lt;code>grafanactl&lt;/code> is being deprecated, and we&amp;rsquo;re bringing all our learning and experience into the new, improved CLI tool
&lt;a href="/docs/grafana/v13.1/as-code/observability-as-code/grafana-cli/gcx/">&lt;code>gcx&lt;/code>&lt;/a>. The &lt;code>grafanactl&lt;/code> repository in GitHub will be archived on June 1, 2026.&lt;/p></description></item></channel></rss>