Store a secret in Azure Key Vault

Updated on September 12, 2025

Once you’ve created an Azure Key Vault, you need to store a secret in it (such as a shared password or API key). If you haven’t created the vault yet, see How to create an Azure Key Vault. If you’ve already stored the secret and need to grant access, see How to grant access to secrets in an Azure Key Vault.

Definitions

An Azure Key Vault is a cloud service that securely stores sensitive information like secrets, encryption keys, and certificates. It helps safeguard access to these resources using fine-grained permissions.

A secret is a piece of data such as a password, connection string, API key, or any other sensitive information. Azure Key Vault can securely store these secrets for your later retrieval.

Instructions

  1. Go to your key vault on Azure

    From the top search bar, you can search for your vault by name, or search for “key vaults” and navigate to your vault. If you need to create a key vault, see How to create an Azure Key Vault.

  2. In the left menu, expand Objects and select Secrets

  3. Click +Generate/Import

  4. Specify the name of your secret

    The name must consist of letters, numbers and dashes (no spaces), and cannot begin with a number.

  5. Specify the secret value

  6. Optionally set a Content Type (typically blank)

    The content type is an optional metadata field that describes the format or purpose of the secret’s value, e.g., "application/json" or "text/plain". You probably don’t need this unless you are a developer. It doesn’t affect how the secret is stored or accessed, but it can help applications interpret the data correctly.

  7. Optionally set an activation date and/or expiration date (typically unset)

    You can optionally set a date when the secret becomes active, and/or set a date when the secret is expired. These dates impact developers who are accessing the secret through API calls. Even if the secret is pre-activation or post-expiration, you can still view its value on the Azure portal.

  8. Optionally disable the secret (typically enabled)

    You can also disable the secret right away. This impacts developers who are accessing the secret through API calls. If the secret is disabled, the API call will not retrieve the value. But even if the secret is disabled, it can still be viewed on the Azure portal.

  9. Click Create

Reference

See also

License

Licensed under CC BY 4.0

You are free to share and adapt this content for any purpose as long as you give appropriate credit in a reasonable manner.

No affiliate links

We do not participate in affiliate marketing, and we are not paid to mention products.

Leave a Reply

Your email address will not be published. Required fields are marked *