<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>KMS integration on Grafana Labs</title><link>https://grafana.com/docs/grafana/v8.3/enterprise/kms-integration/</link><description>Recent content in KMS integration on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/grafana/v8.3/enterprise/kms-integration/index.xml" rel="self" type="application/rss+xml"/><item><title>Azure Key Vault</title><link>https://grafana.com/docs/grafana/v8.3/enterprise/kms-integration/using-azure-key-vault-to-encrypt-database-secrets/</link><pubDate>Fri, 07 Mar 2025 11:34:44 +0100</pubDate><guid>https://grafana.com/docs/grafana/v8.3/enterprise/kms-integration/using-azure-key-vault-to-encrypt-database-secrets/</guid><content><![CDATA[&lt;h1 id=&#34;using-azure-key-vault-to-encrypt-database-secrets&#34;&gt;Using Azure Key Vault to encrypt database secrets&lt;/h1&gt;
&lt;p&gt;You can use an encryption key from Azure Key Vault to encrypt secrets in the Grafana database.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An Azure account with permission to view and create Key Vault keys and programmatic credentials to access those keys&lt;/li&gt;
&lt;li&gt;Access to the Grafana &lt;a href=&#34;../../../administration/configuration/#config-file-locations&#34;&gt;configuration&lt;/a&gt; file&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.microsoft.com/en-us/azure/key-vault/general/quick-create-portal#create-a-vault&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Create a vault&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a key in the &lt;strong&gt;Key Vault&lt;/strong&gt; with the name that you want by using &lt;strong&gt;RSA&lt;/strong&gt; as the type and &lt;code&gt;2048&lt;/code&gt; as the size with encrypt and decrypt permissions.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#register-an-application&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Register an application&lt;/a&gt; and generate a client secret for it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.microsoft.com/en-us/azure/key-vault/general/assign-access-policy?tabs=azure-portal&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Assign a Key Vault access policy&lt;/a&gt; for the key vault that you created:&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the Key Permissions section, set encrypt and decrypt permissions, and click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From within Grafana, turn on &lt;a href=&#34;../../../administration/envelope-encryption/&#34;&gt;envelope encryption&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add your Azure Key Vault details to the Grafana configuration file; depending on your operating system, is usually named &lt;code&gt;grafana.ini&lt;/code&gt;:
&lt;br&gt;&lt;br&gt;a. Add a new section to the configuration file, with a name in the format of &lt;code&gt;[security.encryption.azurekv.&amp;lt;KEY-NAME&amp;gt;]&lt;/code&gt;, where &lt;code&gt;&amp;lt;KEY-NAME&amp;gt;&lt;/code&gt; is any name that uniquely identifies this key among other provider keys.
&lt;br&gt;&lt;br&gt;b. Fill in the section with the following values:
&lt;br&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tenant_id&lt;/code&gt;: the &lt;strong&gt;Directory ID&lt;/strong&gt; (tenant) from the application that you registered.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;client_id&lt;/code&gt;: the &lt;strong&gt;Application ID&lt;/strong&gt; (client) from the application that you registered.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;client_secret&lt;/code&gt;: the VALUE of the secret that you generated in your app. (Don&amp;rsquo;t use the Secret ID).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;key_id&lt;/code&gt;: the key name that you created in the key vault.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vault_uri&lt;/code&gt;: the URL of your key vault.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An example of an Azure Key Vault provider section in the &lt;code&gt;grafana.ini&lt;/code&gt; file is as follows:&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;# Azure Key Vault provider setup
;[security.encryption.azurekv.example-encryption-key]
# Azure Application directory ID (tenant)
tenant_id = 1234abcd-12ab-34cd-56ef-1234567890ab
# Azure Application application ID (client).
client_id = 1356dfgh-12ab-34cd-56ef-3322114455cc
# Azure Application client secret.
client_secret = FbE4X~4Jq45ERKxx823Aheb9plBjQqHHe81Sc
# Azure Key Vault key name.
key_id = mysecretkey
# Azure Key Vault uri.
vault_uri = https://my-vault-name.vault.azure.net&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update the &lt;code&gt;[security]&lt;/code&gt; section of the &lt;code&gt;grafana.ini&lt;/code&gt; configuration file with the new Encryption Provider key that you created:&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;[security]
# previous encryption key, used for legacy alerts, decrypting existing secrets or used as default provider when external providers are not configured
secret_key = AaaaAaaa
# encryption provider key in the format &amp;lt;PROVIDER&amp;gt;.&amp;lt;KEY-NAME&amp;gt;
encryption_provider = azurekv.example-encryption-key
# list of configured key providers, space separated
available_encryption_providers =  azurekv.example-encryption-key&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; The encryption key stored in the &lt;code&gt;secret_key&lt;/code&gt; field is still used by Grafana’s legacy alerting system to encrypt secrets. Do not change or remove that value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;/docs/grafana/v8.3/installation/restart-grafana/&#34;&gt;Restart Grafana&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) From the command line and the root directory of Grafana Enterprise, re-encrypt all of the secrets within the Grafana database with the new key using the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;grafana-cli admin secrets-migration re-encrypt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you do not re-encrypt existing secrets, then they will remain encrypted by the previous encryption key. Users will still be able to access them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; This process could take a few minutes to complete, depending on the number of secrets (such as data sources or alert notification channels) in your database. Users might experience errors while this process is running, and alert notifications might not be sent.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; If you are updating this encryption key during the initial setup of Grafana before any data sources, alert notification channels, or dashboards have been created, then this step is not necessary because there are no secrets in Grafana to migrate.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="using-azure-key-vault-to-encrypt-database-secrets">Using Azure Key Vault to encrypt database secrets&lt;/h1>
&lt;p>You can use an encryption key from Azure Key Vault to encrypt secrets in the Grafana database.&lt;/p></description></item><item><title>AMS KMS</title><link>https://grafana.com/docs/grafana/v8.3/enterprise/kms-integration/using-aws-kms-to-encrypt-database-secrets/</link><pubDate>Fri, 07 Mar 2025 11:34:44 +0100</pubDate><guid>https://grafana.com/docs/grafana/v8.3/enterprise/kms-integration/using-aws-kms-to-encrypt-database-secrets/</guid><content><![CDATA[&lt;h1 id=&#34;using-aws-kms-to-encrypt-database-secrets&#34;&gt;Using AWS KMS to encrypt database secrets&lt;/h1&gt;
&lt;p&gt;You can use an encryption key from AWS Key Management Service to encrypt secrets in the Grafana database.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;An AWS account with permission to view and create KMS keys and programmatic credentials to access those keys&lt;/li&gt;
&lt;li&gt;Access to the Grafana &lt;a href=&#34;../../../administration/configuration/#config-file-locations&#34;&gt;configuration&lt;/a&gt; file&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a symmetric API key either from the AWS Management Console or by using the AWS KMS API.
&lt;br&gt;&lt;br&gt;For detailed instructions, refer to &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Creating keys&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Retrieve the Key ID.
&lt;br&gt;&lt;br&gt;In AWS terms, this can be a key ID, a key ARN (Amazon Resource Name), an alias name, or an alias ARN. For more information about how to retrieve a key ID from AWS, refer to &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/find-cmk-id-arn.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Finding the key ID and key ARN&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;a href=&#34;https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;programmatic credential&lt;/a&gt; (access key ID and secret access key), which has permission to view the key that you created.
&lt;br&gt;&lt;br&gt;In AWS, you can control access to your KMS keys by using &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;key policies&lt;/a&gt;, &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;IAM policies&lt;/a&gt;, and &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/grants.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;grants&lt;/a&gt;. You can also create &lt;a href=&#34;https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;temporary credentials&lt;/a&gt;, which must provide a session token along with an access key ID and a secret access key.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From within Grafana, turn on &lt;a href=&#34;../../../administration/envelope-encryption/&#34;&gt;envelope encryption&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add your AWS KMS details to the Grafana configuration file; depending on your operating system, it is usually named &lt;code&gt;grafana.ini&lt;/code&gt;:
&lt;br&gt;&lt;br&gt;a. Add a new section to the configuration file, with a name in the format of &lt;code&gt;[security.encryption.awskms.&amp;lt;KEY-NAME&amp;gt;]&lt;/code&gt;, where &lt;code&gt;&amp;lt;KEY-NAME&amp;gt;&lt;/code&gt; is any name that uniquely identifies this key among other provider keys.
&lt;br&gt;&lt;br&gt;b. Fill in the section with the following values:
&lt;br&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;key_id&lt;/code&gt;: a reference to a key stored in the KMS. This can be a key ID, a key Amazon Resource Name (ARN), an alias name, or an alias ARN. If you are using an alias, use the prefix &lt;code&gt;alias/&lt;/code&gt;. To specify a KMS key in a different AWS account, use its ARN or alias. For more information about how to retrieve a key ID from AWS, refer to &lt;a href=&#34;https://docs.aws.amazon.com/kms/latest/developerguide/find-cmk-id-arn.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Finding the key ID and key ARN&lt;/a&gt;.&lt;br&gt;&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;&lt;code&gt;key_id&lt;/code&gt; option&lt;/th&gt;
              &lt;th&gt;Example value&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Key ID&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;1234abcd-12ab-34cd-56ef-1234567890ab&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Key ARN&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Alias name&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;alias/ExampleAlias&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Alias ARN&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias&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;&lt;code&gt;access_key_id&lt;/code&gt;: The AWS Access Key ID that you previously generated.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;secret_access_key&lt;/code&gt;: The AWS Secret Access Key you previously generated.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;region&lt;/code&gt;: The AWS region where you created the KMS key. The region is contained in the key’s ARN. For example: &lt;code&gt;arn:aws:kms:*us-east-2*:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;An example of an AWS KMS provider section in the &lt;code&gt;grafana.ini&lt;/code&gt; file is as follows:&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;# AWS key management service provider setup
;[security.encryption.awskms.example-encryption-key]
# Reference to a KMS key - either key ID, key ARN, alias name, or ARN
;key_id = 1234abcd-12ab-34cd-56ef-1234567890ab
# AWS access key ID
;access_key_id = AKIAIOSFODNN7EXAMPLE
# AWS secret access key
;secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
# AWS region, for example eu-north-1
;region = eu-north-1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update the &lt;code&gt;[security]&lt;/code&gt; section of the &lt;code&gt;grafana.ini&lt;/code&gt; configuration file with the new Encryption Provider key that you created:&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;[security]
# previous encryption key, used for legacy alerts, decrypting existing secrets or used as default provider when external providers are not configured
secret_key = AaaaAaaa
# encryption provider key in the format &amp;lt;PROVIDER&amp;gt;.&amp;lt;KEY_NAME&amp;gt;
encryption_provider = awskms.example-encryption-key
# list of configured key providers, space separated
available_encryption_providers = awskms.example-encryption-key&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; The encryption key that is stored in the &lt;code&gt;secret_key&lt;/code&gt; field is still used by Grafana’s legacy alerting system to encrypt secrets, for decrypting existing secrets, or it is used as the default provider when external providers are not configured. Do not change or remove that value when adding a new KMS provider.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;/docs/grafana/v8.3/installation/restart-grafana/&#34;&gt;Restart Grafana&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;(Optional) From the command line and the root directory of Grafana, re-encrypt all of the secrets within the Grafana database with the new key using the following command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;grafana-cli admin secrets-migration re-encrypt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you do not re-encrypt existing secrets, then they will remain encrypted by the previous encryption key. Users will still be able to access them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; This process could take a few minutes to complete, depending on the number of secrets (such as data sources or alert notification channels) in your database. Users might experience errors while this process is running, and alert notifications might not be sent.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt; Note:&lt;/strong&gt; If you are updating this encryption key during the initial setup of Grafana before any data sources, alert notification channels, or dashboards have been created, then this step is not necessary because there are no secrets in Grafana to migrate.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="using-aws-kms-to-encrypt-database-secrets">Using AWS KMS to encrypt database secrets&lt;/h1>
&lt;p>You can use an encryption key from AWS Key Management Service to encrypt secrets in the Grafana database.&lt;/p></description></item></channel></rss>