<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.2/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.2/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.2/as-code/observability-as-code/grafana-cli/gcx/</link><pubDate>Thu, 30 Jul 2026 16:41:53 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/gcx/</guid><content><![CDATA[

  
    
      
    
  

  &lt;div&gt;
  &lt;div class=&#34;d-flex flex-direction-row flex-direction-column-small gap-2 justify-content-start align-items-center align-items-start-small flex-wrap &#34;&gt;&lt;div class=&#34;d-flex flex-direction-column&#34;&gt;
      &lt;div&gt;&lt;h1
  
  id=&#34;gcx-cli&#34;
  &gt;gcx CLI&lt;/h1&gt;&lt;/div&gt;
      
        &lt;div class=&#34;&#34;&gt;Manage Grafana and Grafana Cloud from the terminal and from agentic coding tools.&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is the Grafana CLI that allows you and your AI coding agent to work with Grafana Cloud, Grafana Enterprise, and Grafana OSS.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;gcx&lt;/code&gt; is designed to be used in common scenarios such as authentication against Grafana, query telemetry, inspect and manage resources, and automate observability workflows as code.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also integrated with Grafana Assistant, combining the previously fragmented user experience into one single tool.&lt;/p&gt;
&lt;h2 id=&#34;get-started&#34;&gt;Get started&lt;/h2&gt;

&lt;div class=&#34;w-100p&#34;&gt;
  &lt;div class=&#34;card-content-grid mt-1&#34;&gt;&lt;a class=&#34;card sm&#34; href=&#34;./gcx&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;gcx CLI (recommended)&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;Overview of the Grafana CLI &lt;code&gt;gcx&lt;/code&gt;, compatible with AI agents&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;a class=&#34;card sm&#34; href=&#34;./grafanactl&#34;&gt;
  &lt;div class=&#34;card-content-container p-1 d-flex flex-direction-column align-items-start justify-content-start &#34;&gt;&lt;div class=&#34;card-title body-default fw-500 lh-2 text-gray-16&#34;&gt;grafanactl CLI (deprecated)&lt;/div&gt;&lt;div class=&#34;card-description body-small text-gray-12 fw-400&#34;&gt;Learn how to install, set up and use the Grafana CLI &lt;code&gt;grafanactl&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;div>
&lt;div class="d-flex flex-direction-row flex-direction-column-small gap-2 justify-content-start align-items-center align-items-start-small flex-wrap ">&lt;div class="d-flex flex-direction-column">
&lt;div>&lt;h1
id="gcx-cli"
>gcx CLI&lt;/h1>&lt;/div>
&lt;div class="">Manage Grafana and Grafana Cloud from the terminal and from agentic coding tools.&lt;/div>
&lt;/div>
&lt;/div>
&lt;/div>
&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>&lt;code>gcx&lt;/code> is the Grafana CLI that allows you and your AI coding agent to work with Grafana Cloud, Grafana Enterprise, and Grafana OSS.&lt;/p></description></item><item><title>Install and set up the grafanactl CLI</title><link>https://grafana.com/docs/grafana/v13.2/as-code/observability-as-code/grafana-cli/grafanactl/</link><pubDate>Tue, 18 Aug 2026 10:15:08 +0000</pubDate><guid>https://grafana.com/docs/grafana/v13.2/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.2/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.2/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>