<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Configure the Prometheus data source on Grafana Labs</title><link>https://grafana.com/docs/grafana/v12.4/datasources/prometheus/configure/</link><description>Recent content in Configure the Prometheus data source on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v12.4/datasources/prometheus/configure/index.xml" rel="self" type="application/rss+xml"/><item><title>Configure the Prometheus data source</title><link>https://grafana.com/docs/grafana/v12.4/datasources/prometheus/configure/aws-authentication/</link><pubDate>Fri, 03 Apr 2026 19:43:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/datasources/prometheus/configure/aws-authentication/</guid><content><![CDATA[&lt;h1 id=&#34;connect-to-amazon-managed-service-for-prometheus&#34;&gt;Connect to Amazon Managed Service for Prometheus&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the data source configuration page, locate the &lt;strong&gt;Auth&lt;/strong&gt; section&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable &lt;strong&gt;SigV4 auth&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure the following settings:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Example&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Authentication Provider&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Choose your auth method&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;AWS SDK Default&lt;/code&gt;, &lt;code&gt;Access &amp;amp; secret key&lt;/code&gt;, or &lt;code&gt;Credentials file&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Default Region&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;AWS region for your workspace&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;us-west-2&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Access Key ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Your AWS access key (if using access key auth)&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;AKIA...&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Secret Access Key&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Your AWS secret key (if using access key auth)&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;wJalrXUtn...&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Assume Role ARN&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;IAM role ARN (optional)&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;arn:aws:iam::123456789:role/GrafanaRole&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set the &lt;strong&gt;HTTP URL&lt;/strong&gt; to your Amazon Managed Service for Prometheus workspace endpoint: &lt;code&gt;https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-12345678-1234-1234-1234-123456789012/&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to verify the connection&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example-configuration&#34;&gt;Example configuration&lt;/h2&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;YAML&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-yaml&#34;&gt;# Example provisioning configuration
apiVersion: 1
datasources:
  - name: &amp;#39;Amazon Managed Prometheus&amp;#39;
    type: &amp;#39;grafana-amazonprometheus-datasource&amp;#39;
    url: &amp;#39;https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-12345678-1234-1234-1234-123456789012/&amp;#39;
    jsonData:
      httpMethod: &amp;#39;POST&amp;#39;
      sigV4Auth: true
      sigV4AuthType: &amp;#39;keys&amp;#39;
      sigV4Region: &amp;#39;us-east-2&amp;#39;
    secureJsonData:
      sigV4AccessKey: &amp;#39;&amp;lt;access key&amp;gt;&amp;#39;
      sigV4SecretKey: &amp;#39;&amp;lt;secret key&amp;gt;&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;migrate-to-amazon-managed-service-for-prometheus&#34;&gt;Migrate to Amazon Managed Service for Prometheus&lt;/h2&gt;
&lt;p&gt;Learn more about why this is happening: &lt;a href=&#34;/blog/2025/06/16/prometheus-data-source-update-redefining-our-big-tent-philosophy/&#34;&gt;Prometheus data source update: Redefining our big tent philosophy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Before you begin, ensure you have the organization administrator role. If you are self-hosting Grafana, back up your existing dashboard configurations and queries.&lt;/p&gt;
&lt;p&gt;Grafana Cloud users will be automatically migrated to the relevant version of Prometheus, so no action needs to be taken.&lt;/p&gt;
&lt;p&gt;For air-gapped environments, download and install &lt;a href=&#34;/grafana/plugins/grafana-amazonprometheus-datasource/&#34;&gt;Amazon Managed Service for Prometheus&lt;/a&gt;, then follow the standard migration process.&lt;/p&gt;
&lt;h3 id=&#34;migrate&#34;&gt;Migrate&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Enable the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle. For more information on feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-grafana/feature-toggles/#manage-feature-toggles&#34;&gt;Manage feature toggles&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Restart Grafana for the changes to take effect.&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;This feature toggle will be removed in Grafana 13, and the migration will be automatic.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;check-migration-status&#34;&gt;Check migration status&lt;/h3&gt;
&lt;p&gt;To determine if your Prometheus data sources have been migrated:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Select your Prometheus data source&lt;/li&gt;
&lt;li&gt;Look for a migration banner at the top of the configuration page&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The banner displays one of the following messages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&amp;ldquo;Migration Notice&amp;rdquo;&lt;/strong&gt; - The data source has already been migrated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&amp;ldquo;Deprecation Notice&amp;rdquo;&lt;/strong&gt; - The data source has not been migrated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No banner&lt;/strong&gt; - No migration is needed for this data source&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;common-migration-issues&#34;&gt;Common migration issues&lt;/h2&gt;
&lt;p&gt;The following sections contain troubleshooting guidance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Migration banner not appearing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle is enabled&lt;/li&gt;
&lt;li&gt;Restart Grafana after enabling the feature toggle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Amazon Managed Service for Prometheus is not installed&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that Amazon Managed Service for Prometheus is installed by going to &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Add new connection&lt;/strong&gt; and search for &amp;ldquo;Amazon Managed Service for Prometheus&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Install Amazon Managed Service for Prometheus if not already installed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;After migrating, my data source returns &amp;ldquo;401 Unauthorized&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you are using self-hosted Grafana, check your .ini for &lt;code&gt;grafana-amazonprometheus-datasource&lt;/code&gt; is included in &lt;code&gt;forward_settings_to_plugins&lt;/code&gt; under the &lt;code&gt;[aws]&lt;/code&gt; heading.&lt;/li&gt;
&lt;li&gt;If you are using Grafana Cloud, contact Grafana support.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rollback-self-hosted-grafana-without-a-backup&#34;&gt;Rollback self-hosted Grafana without a backup&lt;/h3&gt;
&lt;p&gt;If you don’t have a backup of your Grafana instance before the migration, remove the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle, and run the following script. It reverts all Amazon Managed Service for Prometheus data sources back to core Prometheus.&lt;/p&gt;
&lt;p&gt;To revert the migration:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Disable the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle. For more information on feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-grafana/feature-toggles/#manage-feature-toggles&#34;&gt;Manage feature toggles&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Obtain a bearer token that has &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; permissions for your Grafana data source API. For more information on the data source API, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/developers/http_api/data_source/&#34;&gt;Data source API&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Run the script below. Make sure to provide your Grafana URL and bearer token.&lt;/li&gt;
&lt;li&gt;(Optional) Report the issue you were experiencing on the &lt;a href=&#34;https://github.com/grafana/grafana/issues&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana repository&lt;/a&gt;. Tag the issue with &amp;ldquo;datasource/migrate-prometheus-type&amp;rdquo;&lt;/li&gt;
&lt;/ol&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;#!/bin/bash

# Configuration
GRAFANA_URL=&amp;#34;&amp;#34;
BEARER_TOKEN=&amp;#34;&amp;#34;
LOG_FILE=&amp;#34;grafana_migration_$(date &amp;#43;%Y%m%d_%H%M%S).log&amp;#34;

# Function to log messages to both console and file
log_message() {
    local message=&amp;#34;$1&amp;#34;
    local timestamp=$(date &amp;#39;&amp;#43;%Y-%m-%d %H:%M:%S&amp;#39;)
    echo &amp;#34;[$timestamp] $message&amp;#34; | tee -a &amp;#34;$LOG_FILE&amp;#34;
}

# Function to update a data source
update_data_source() {
    local uid=&amp;#34;$1&amp;#34;
    local data=&amp;#34;$2&amp;#34;

    response=$(curl -s -w &amp;#34;\n%{http_code}&amp;#34; -X PUT \
        -H &amp;#34;Content-Type: application/json&amp;#34; \
        -H &amp;#34;Authorization: Bearer $BEARER_TOKEN&amp;#34; \
        -d &amp;#34;$data&amp;#34; \
        &amp;#34;$GRAFANA_URL/api/datasources/uid/$uid&amp;#34;)

    http_code=$(echo &amp;#34;$response&amp;#34; | tail -n1)
    response_body=$(echo &amp;#34;$response&amp;#34; | sed &amp;#39;$d&amp;#39;)

    if [[ &amp;#34;$http_code&amp;#34; -ge 200 &amp;amp;&amp;amp; &amp;#34;$http_code&amp;#34; -lt 300 ]]; then
        log_message &amp;#34;$uid successful&amp;#34;
    else
        log_message &amp;#34;$uid error: HTTP $http_code - $response_body&amp;#34;
    fi
}

# Function to process and update data source types
update_data_source_type() {
    local result=&amp;#34;$1&amp;#34;
    local processed_count=0
    local updated_count=0
    local readonly_count=0
    local skipped_count=0

    # Use jq to parse and process JSON
    echo &amp;#34;$result&amp;#34; | jq -c &amp;#39;.[]&amp;#39; | while read -r data; do
        uid=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.uid&amp;#39;)
        prometheus_type_migration=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] // false&amp;#39;)
        data_type=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.type&amp;#39;)
        read_only=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.readOnly // false&amp;#39;)

        processed_count=$((processed_count &amp;#43; 1))

        # Check conditions
        if [[ &amp;#34;$prometheus_type_migration&amp;#34; != &amp;#34;true&amp;#34; ]] || [[ &amp;#34;$data_type&amp;#34; != &amp;#34;grafana-amazonprometheus-datasource&amp;#34; ]]; then
            skipped_count=$((skipped_count &amp;#43; 1))
            continue
        fi

        if [[ &amp;#34;$read_only&amp;#34; == &amp;#34;true&amp;#34; ]]; then
            readonly_count=$((readonly_count &amp;#43; 1))
            log_message &amp;#34;$uid is readOnly. If this data source is provisioned, edit the data source type to be \`prometheus\` in the provisioning file.&amp;#34;
            continue
        fi

        # Update the data
        updated_data=$(echo &amp;#34;$data&amp;#34; | jq &amp;#39;.type = &amp;#34;prometheus&amp;#34; | .jsonData[&amp;#34;prometheus-type-migration&amp;#34;] = false&amp;#39;)
        update_data_source &amp;#34;$uid&amp;#34; &amp;#34;$updated_data&amp;#34;
        updated_count=$((updated_count &amp;#43; 1))

        # Log the raw data for debugging (optional - uncomment if needed)
        # log_message &amp;#34;DEBUG - Updated data for $uid: $updated_data&amp;#34;
    done

    # Note: These counts won&amp;#39;t work in the while loop due to subshell
    # Moving summary to the main function instead
}

# Function to get summary statistics
get_summary_stats() {
    local result=&amp;#34;$1&amp;#34;
    local total_datasources=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;. | length&amp;#39;)
    local migration_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-amazonprometheus-datasource&amp;#34;)] | length&amp;#39;)
    local readonly_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-amazonprometheus-datasource&amp;#34; and .readOnly == true)] | length&amp;#39;)
    local updateable_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-amazonprometheus-datasource&amp;#34; and (.readOnly == false or .readOnly == null))] | length&amp;#39;)

    log_message &amp;#34;=== MIGRATION SUMMARY ===&amp;#34;
    log_message &amp;#34;Total data sources found: $total_datasources&amp;#34;
    log_message &amp;#34;Migration candidates found: $migration_candidates&amp;#34;
    log_message &amp;#34;Read-only candidates (will be skipped): $readonly_candidates&amp;#34;
    log_message &amp;#34;Updateable candidates: $updateable_candidates&amp;#34;
    log_message &amp;#34;==========================&amp;#34;
}

# Main function to remove Prometheus type migration
remove_prometheus_type_migration() {
    log_message &amp;#34;Starting remove Azure Prometheus migration&amp;#34;
    log_message &amp;#34;Log file: $LOG_FILE&amp;#34;
    log_message &amp;#34;Grafana URL: $GRAFANA_URL&amp;#34;

    response=$(curl -s -w &amp;#34;\n%{http_code}&amp;#34; -X GET \
        -H &amp;#34;Content-Type: application/json&amp;#34; \
        -H &amp;#34;Authorization: Bearer $BEARER_TOKEN&amp;#34; \
        &amp;#34;$GRAFANA_URL/api/datasources/&amp;#34;)

    http_code=$(echo &amp;#34;$response&amp;#34; | tail -n1)
    response_body=$(echo &amp;#34;$response&amp;#34; | sed &amp;#39;$d&amp;#39;)

    if [[ &amp;#34;$http_code&amp;#34; -ge 200 &amp;amp;&amp;amp; &amp;#34;$http_code&amp;#34; -lt 300 ]]; then
        log_message &amp;#34;Successfully fetched data sources&amp;#34;
        get_summary_stats &amp;#34;$response_body&amp;#34;
        update_data_source_type &amp;#34;$response_body&amp;#34;
        log_message &amp;#34;Migration process completed&amp;#34;
    else
        log_message &amp;#34;error fetching data sources: HTTP $http_code - $response_body&amp;#34;
    fi
}

# Function to initialize log file
initialize_log() {
    echo &amp;#34;=== Grafana Azure Prometheus Migration Log ===&amp;#34; &amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;Started at: $(date)&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;=============================================&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
}

# Check if jq is installed
if ! command -v jq &amp;amp;&amp;gt; /dev/null; then
    echo &amp;#34;Error: jq is required but not installed. Please install jq to run this script.&amp;#34;
    exit 1
fi

# Check if required variables are set
if [[ -z &amp;#34;$GRAFANA_URL&amp;#34; || -z &amp;#34;$BEARER_TOKEN&amp;#34; ]]; then
    echo &amp;#34;Error: Please set GRAFANA_URL and BEARER_TOKEN variables at the top of the script.&amp;#34;
    exit 1
fi

# Initialize log file
initialize_log

# Execute main function
log_message &amp;#34;Script started&amp;#34;
remove_prometheus_type_migration
log_message &amp;#34;Script completed&amp;#34;

# Final log message
echo &amp;#34;&amp;#34;
echo &amp;#34;Migration completed. Full log available at: $LOG_FILE&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you continue to experience issues, check the Grafana server logs for detailed error messages and contact &lt;a href=&#34;/help/&#34;&gt;Grafana Support&lt;/a&gt; with your troubleshooting results.&lt;/p&gt;
]]></content><description>&lt;h1 id="connect-to-amazon-managed-service-for-prometheus">Connect to Amazon Managed Service for Prometheus&lt;/h1>
&lt;ol>
&lt;li>
&lt;p>In the data source configuration page, locate the &lt;strong>Auth&lt;/strong> section&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Enable &lt;strong>SigV4 auth&lt;/strong>&lt;/p>
&lt;/li>
&lt;li>
&lt;p>Configure the following settings:&lt;/p>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Setting&lt;/th>
&lt;th>Description&lt;/th>
&lt;th>Example&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>&lt;strong>Authentication Provider&lt;/strong>&lt;/td>
&lt;td>Choose your auth method&lt;/td>
&lt;td>&lt;code>AWS SDK Default&lt;/code>, &lt;code>Access &amp;amp; secret key&lt;/code>, or &lt;code>Credentials file&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Default Region&lt;/strong>&lt;/td>
&lt;td>AWS region for your workspace&lt;/td>
&lt;td>&lt;code>us-west-2&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Access Key ID&lt;/strong>&lt;/td>
&lt;td>Your AWS access key (if using access key auth)&lt;/td>
&lt;td>&lt;code>AKIA...&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Secret Access Key&lt;/strong>&lt;/td>
&lt;td>Your AWS secret key (if using access key auth)&lt;/td>
&lt;td>&lt;code>wJalrXUtn...&lt;/code>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>&lt;strong>Assume Role ARN&lt;/strong>&lt;/td>
&lt;td>IAM role ARN (optional)&lt;/td>
&lt;td>&lt;code>arn:aws:iam::123456789:role/GrafanaRole&lt;/code>&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;/li>
&lt;li>
&lt;p>Set the &lt;strong>HTTP URL&lt;/strong> to your Amazon Managed Service for Prometheus workspace endpoint: &lt;code>https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-12345678-1234-1234-1234-123456789012/&lt;/code>&lt;/p></description></item><item><title>Configure the Prometheus data source</title><link>https://grafana.com/docs/grafana/v12.4/datasources/prometheus/configure/azure-authentication/</link><pubDate>Fri, 03 Apr 2026 19:43:06 +0000</pubDate><guid>https://grafana.com/docs/grafana/v12.4/datasources/prometheus/configure/azure-authentication/</guid><content><![CDATA[&lt;h1 id=&#34;connect-to-azure-monitor-managed-service-for-prometheus&#34;&gt;Connect to Azure Monitor Managed Service for Prometheus&lt;/h1&gt;
&lt;p&gt;After creating a Azure Monitor Managed Service for Prometheus data source:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the data source configuration page, locate the &lt;strong&gt;Authentication&lt;/strong&gt; section&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select your authentication method:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Managed Identity&lt;/strong&gt;: For Azure-hosted Grafana instances. To learn more about Entra login for Grafana, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-access/configure-authentication/azuread/#configure-azure-adentra-id-oauth-authentication&#34;&gt;Configure Entra ID/Entra ID OAuth authentication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;App Registration&lt;/strong&gt;: For service principal authentication&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Current User&lt;/strong&gt;: Uses the current user&amp;rsquo;s Entra ID credentials&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure based on your chosen method:&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Example&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Directory (tenant) ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Your Entra ID tenant ID&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;12345678-1234-1234-1234-123456789012&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Application (client) ID&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Your app registration client ID&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;87654321-4321-4321-4321-210987654321&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;strong&gt;Client secret&lt;/strong&gt;&lt;/td&gt;
              &lt;td&gt;Your app registration secret&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;your-client-secret&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;p&gt;When using Managed Identity for authentication:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No additional configuration required if using system-assigned identity.&lt;/li&gt;
&lt;li&gt;For user-assigned identity, provide the &lt;strong&gt;Client ID&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;Set the &lt;strong&gt;Prometheus server URL&lt;/strong&gt; to your Azure Monitor workspace endpoint:&lt;/p&gt;

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&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&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;https://your-workspace.eastus2.prometheus.monitor.azure.com&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to verify the connection&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;example-configuration&#34;&gt;Example configuration&lt;/h2&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;YAML&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-yaml&#34;&gt;# Example provisioning configuration for App Registration
apiVersion: 1
datasources:
  - name: &amp;#39;Azure Monitor Prometheus&amp;#39;
    type: &amp;#39;grafana-azureprometheus-datasource&amp;#39;
    url: &amp;#39;https://your-workspace.eastus2.prometheus.monitor.azure.com&amp;#39;
    jsonData:
      azureCredentials:
        authType: &amp;#39;clientsecret&amp;#39;
        azureCloud: &amp;#39;AzureCloud&amp;#39;
        clientId: &amp;#39;&amp;lt;client_id&amp;gt;&amp;#39;
        httpMethod: &amp;#39;POST&amp;#39;
        tenantId: &amp;#39;&amp;lt;tenant_id&amp;gt;&amp;#39;
    secureJsonData:
      clientSecret: &amp;#39;your-client-secret&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;migrate-to-azure-monitor-managed-service-for-prometheus&#34;&gt;Migrate to Azure Monitor Managed Service for Prometheus&lt;/h2&gt;
&lt;p&gt;Learn more about why this is happening: &lt;a href=&#34;/blog/2025/06/16/prometheus-data-source-update-redefining-our-big-tent-philosophy/&#34;&gt;Prometheus data source update: Redefining our big tent philosophy&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Before you begin, ensure you have the organization administrator role. If you are self-hosting Grafana, back up your existing dashboard configurations and queries.&lt;/p&gt;
&lt;p&gt;Grafana Cloud users will be automatically migrated to the relevant version of Prometheus, so no action needs to be taken.&lt;/p&gt;
&lt;p&gt;For air-gapped environments, download and install &lt;a href=&#34;/grafana/plugins/grafana-azureprometheus-datasource/&#34;&gt;Azure Monitor Managed Service for Prometheus&lt;/a&gt;, then follow the standard migration process.&lt;/p&gt;
&lt;h3 id=&#34;migrate&#34;&gt;Migrate&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Enable the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle. For more information on feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-grafana/feature-toggles/#manage-feature-toggles&#34;&gt;Manage feature toggles&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Restart Grafana for the changes to take effect.&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;This feature toggle will be removed in Grafana 13, and the migration will be automatic.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To determine if your Prometheus data sources have been migrated:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Select your Prometheus data source&lt;/li&gt;
&lt;li&gt;Look for a migration banner at the top of the configuration page&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The banner displays one of the following messages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&amp;ldquo;Migration Notice&amp;rdquo;&lt;/strong&gt; - The data source has already been migrated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&amp;ldquo;Deprecation Notice&amp;rdquo;&lt;/strong&gt; - The data source has not been migrated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No banner&lt;/strong&gt; - No migration is needed for this data source&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;common-migration-issues&#34;&gt;Common migration issues&lt;/h2&gt;
&lt;p&gt;The following sections contain troubleshooting guidance.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Migration banner not appearing&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle is enabled.&lt;/li&gt;
&lt;li&gt;Restart Grafana after enabling the feature toggle&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Azure Monitor Managed Service for Prometheus is not installed&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that Azure Monitor Managed Service for Prometheus is installed by going to &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Add new connection&lt;/strong&gt; and search for &amp;ldquo;Azure Monitor Managed Service for Prometheus&amp;rdquo;&lt;/li&gt;
&lt;li&gt;Install Azure Monitor Managed Service for Prometheus if not already installed&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;After migrating, my data source returns &amp;ldquo;401 Unauthorized&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you are using self-hosted Grafana, check your .ini for &lt;code&gt;grafana-azureprometheus-datasource&lt;/code&gt; is included in &lt;code&gt;forward_settings_to_plugins&lt;/code&gt; under the &lt;code&gt;[azure]&lt;/code&gt; heading.&lt;/li&gt;
&lt;li&gt;If you are using Grafana Cloud, contact Grafana support.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;rollback-self-hosted-grafana-without-a-backup&#34;&gt;Rollback self-hosted Grafana without a backup&lt;/h3&gt;
&lt;p&gt;If you don’t have a backup of your Grafana instance before the migration, remove the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle, and run the following script. It reverts all the Azure Monitor Managed Service data source instances back to core Prometheus.&lt;/p&gt;
&lt;p&gt;To revert the migration:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Disable the &lt;code&gt;prometheusTypeMigration&lt;/code&gt; feature toggle. For more information on feature toggles, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/setup-grafana/configure-grafana/feature-toggles/#manage-feature-toggles&#34;&gt;Manage feature toggles&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Obtain a bearer token that has &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; permissions for your Grafana data source API. For more information on the data source API, refer to 
    &lt;a href=&#34;/docs/grafana/v12.4/developers/http_api/data_source/&#34;&gt;Data source API&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Run the script below. Make sure to provide your Grafana URL and bearer token.&lt;/li&gt;
&lt;li&gt;(Optional) Report the issue you were experiencing on the &lt;a href=&#34;https://github.com/grafana/grafana/issues&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Grafana repository&lt;/a&gt;. Tag the issue with &amp;ldquo;datasource/migrate-prometheus-type&amp;rdquo;&lt;/li&gt;
&lt;/ol&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;#!/bin/bash

# Configuration
GRAFANA_URL=&amp;#34;&amp;#34;
BEARER_TOKEN=&amp;#34;&amp;#34;
LOG_FILE=&amp;#34;grafana_migration_$(date &amp;#43;%Y%m%d_%H%M%S).log&amp;#34;

# Function to log messages to both console and file
log_message() {
    local message=&amp;#34;$1&amp;#34;
    local timestamp=$(date &amp;#39;&amp;#43;%Y-%m-%d %H:%M:%S&amp;#39;)
    echo &amp;#34;[$timestamp] $message&amp;#34; | tee -a &amp;#34;$LOG_FILE&amp;#34;
}

# Function to update a data source
update_data_source() {
    local uid=&amp;#34;$1&amp;#34;
    local data=&amp;#34;$2&amp;#34;

    response=$(curl -s -w &amp;#34;\n%{http_code}&amp;#34; -X PUT \
        -H &amp;#34;Content-Type: application/json&amp;#34; \
        -H &amp;#34;Authorization: Bearer $BEARER_TOKEN&amp;#34; \
        -d &amp;#34;$data&amp;#34; \
        &amp;#34;$GRAFANA_URL/api/datasources/uid/$uid&amp;#34;)

    http_code=$(echo &amp;#34;$response&amp;#34; | tail -n1)
    response_body=$(echo &amp;#34;$response&amp;#34; | sed &amp;#39;$d&amp;#39;)

    if [[ &amp;#34;$http_code&amp;#34; -ge 200 &amp;amp;&amp;amp; &amp;#34;$http_code&amp;#34; -lt 300 ]]; then
        log_message &amp;#34;$uid successful&amp;#34;
    else
        log_message &amp;#34;$uid error: HTTP $http_code - $response_body&amp;#34;
    fi
}

# Function to process and update data source types
update_data_source_type() {
    local result=&amp;#34;$1&amp;#34;
    local processed_count=0
    local updated_count=0
    local readonly_count=0
    local skipped_count=0

    # Use jq to parse and process JSON
    echo &amp;#34;$result&amp;#34; | jq -c &amp;#39;.[]&amp;#39; | while read -r data; do
        uid=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.uid&amp;#39;)
        prometheus_type_migration=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] // false&amp;#39;)
        data_type=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.type&amp;#39;)
        read_only=$(echo &amp;#34;$data&amp;#34; | jq -r &amp;#39;.readOnly // false&amp;#39;)

        processed_count=$((processed_count &amp;#43; 1))

        # Check conditions
        if [[ &amp;#34;$prometheus_type_migration&amp;#34; != &amp;#34;true&amp;#34; ]] || [[ &amp;#34;$data_type&amp;#34; != &amp;#34;grafana-azureprometheus-datasource&amp;#34; ]]; then
            skipped_count=$((skipped_count &amp;#43; 1))
            continue
        fi

        if [[ &amp;#34;$read_only&amp;#34; == &amp;#34;true&amp;#34; ]]; then
            readonly_count=$((readonly_count &amp;#43; 1))
            log_message &amp;#34;$uid is readOnly. If this data source is provisioned, edit the data source type to be \`prometheus\` in the provisioning file.&amp;#34;
            continue
        fi

        # Update the data
        updated_data=$(echo &amp;#34;$data&amp;#34; | jq &amp;#39;.type = &amp;#34;prometheus&amp;#34; | .jsonData[&amp;#34;prometheus-type-migration&amp;#34;] = false&amp;#39;)
        update_data_source &amp;#34;$uid&amp;#34; &amp;#34;$updated_data&amp;#34;
        updated_count=$((updated_count &amp;#43; 1))

        # Log the raw data for debugging (optional - uncomment if needed)
        # log_message &amp;#34;DEBUG - Updated data for $uid: $updated_data&amp;#34;
    done

    # Note: These counts won&amp;#39;t work in the while loop due to subshell
    # Moving summary to the main function instead
}

# Function to get summary statistics
get_summary_stats() {
    local result=&amp;#34;$1&amp;#34;
    local total_datasources=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;. | length&amp;#39;)
    local migration_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-azureprometheus-datasource&amp;#34;)] | length&amp;#39;)
    local readonly_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-azureprometheus-datasource&amp;#34; and .readOnly == true)] | length&amp;#39;)
    local updateable_candidates=$(echo &amp;#34;$result&amp;#34; | jq &amp;#39;[.[] | select(.jsonData[&amp;#34;prometheus-type-migration&amp;#34;] == true and .type == &amp;#34;grafana-azureprometheus-datasource&amp;#34; and (.readOnly == false or .readOnly == null))] | length&amp;#39;)

    log_message &amp;#34;=== MIGRATION SUMMARY ===&amp;#34;
    log_message &amp;#34;Total data sources found: $total_datasources&amp;#34;
    log_message &amp;#34;Migration candidates found: $migration_candidates&amp;#34;
    log_message &amp;#34;Read-only candidates (will be skipped): $readonly_candidates&amp;#34;
    log_message &amp;#34;Updateable candidates: $updateable_candidates&amp;#34;
    log_message &amp;#34;==========================&amp;#34;
}

# Main function to remove Prometheus type migration
remove_prometheus_type_migration() {
    log_message &amp;#34;Starting remove Azure Prometheus migration&amp;#34;
    log_message &amp;#34;Log file: $LOG_FILE&amp;#34;
    log_message &amp;#34;Grafana URL: $GRAFANA_URL&amp;#34;

    response=$(curl -s -w &amp;#34;\n%{http_code}&amp;#34; -X GET \
        -H &amp;#34;Content-Type: application/json&amp;#34; \
        -H &amp;#34;Authorization: Bearer $BEARER_TOKEN&amp;#34; \
        &amp;#34;$GRAFANA_URL/api/datasources/&amp;#34;)

    http_code=$(echo &amp;#34;$response&amp;#34; | tail -n1)
    response_body=$(echo &amp;#34;$response&amp;#34; | sed &amp;#39;$d&amp;#39;)

    if [[ &amp;#34;$http_code&amp;#34; -ge 200 &amp;amp;&amp;amp; &amp;#34;$http_code&amp;#34; -lt 300 ]]; then
        log_message &amp;#34;Successfully fetched data sources&amp;#34;
        get_summary_stats &amp;#34;$response_body&amp;#34;
        update_data_source_type &amp;#34;$response_body&amp;#34;
        log_message &amp;#34;Migration process completed&amp;#34;
    else
        log_message &amp;#34;error fetching data sources: HTTP $http_code - $response_body&amp;#34;
    fi
}

# Function to initialize log file
initialize_log() {
    echo &amp;#34;=== Grafana Azure Prometheus Migration Log ===&amp;#34; &amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;Started at: $(date)&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;=============================================&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
    echo &amp;#34;&amp;#34; &amp;gt;&amp;gt; &amp;#34;$LOG_FILE&amp;#34;
}

# Check if jq is installed
if ! command -v jq &amp;amp;&amp;gt; /dev/null; then
    echo &amp;#34;Error: jq is required but not installed. Please install jq to run this script.&amp;#34;
    exit 1
fi

# Check if required variables are set
if [[ -z &amp;#34;$GRAFANA_URL&amp;#34; || -z &amp;#34;$BEARER_TOKEN&amp;#34; ]]; then
    echo &amp;#34;Error: Please set GRAFANA_URL and BEARER_TOKEN variables at the top of the script.&amp;#34;
    exit 1
fi

# Initialize log file
initialize_log

# Execute main function
log_message &amp;#34;Script started&amp;#34;
remove_prometheus_type_migration
log_message &amp;#34;Script completed&amp;#34;

# Final log message
echo &amp;#34;&amp;#34;
echo &amp;#34;Migration completed. Full log available at: $LOG_FILE&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you continue to experience issues, check the Grafana server logs for detailed error messages and contact &lt;a href=&#34;/help/&#34;&gt;Grafana Support&lt;/a&gt; with your troubleshooting results.&lt;/p&gt;
]]></content><description>&lt;h1 id="connect-to-azure-monitor-managed-service-for-prometheus">Connect to Azure Monitor Managed Service for Prometheus&lt;/h1>
&lt;p>After creating a Azure Monitor Managed Service for Prometheus data source:&lt;/p>
&lt;ol>
&lt;li>
&lt;p>In the data source configuration page, locate the &lt;strong>Authentication&lt;/strong> section&lt;/p></description></item></channel></rss>