Azure Key Vault is a cloud service that works as a secure secrets store. You can securely store keys, passwords, certificates, and other secrets. For more information on Key Vault you may review the Overview. Azure CLI is used to create and manage Azure resources using commands or scripts. In this quickstart, you create a key vault. Once that you have completed that, you will store a secret.
If you choose to install and use the CLI locally, this quickstart requires the Azure CLI version 2.0.4 or later. Run az --version to find the version. If you need to install or upgrade, see Install the Azure CLI.
A resource group is a logical container into which Azure resources are deployed and managed. The following example creates a resource group named ContosoResourceGroup in the eastus location.
For this quickstart we use Contoso-vault2. You must provide a unique name in your testing.
Vault Name: In the example, this is Contoso-Vault2. You will use this name for other Key Vault commands.
To add a secret to the vault, you just need to take a couple of additional steps. This password could be used by an application. The password will be called ExamplePassword and will store the value of hVFkk965BuUv in it.
az keyvault secret set --vault-name "Contoso-Vault2" --name "ExamplePassword" --value "hVFkk965BuUv"
You can now reference this password that you added to Azure Key Vault by using its URI. Use https://ContosoVault.vault.azure.net/secrets/ExamplePassword to get the current version.
az keyvault secret show --name "ExamplePassword" --vault-name "Contoso-Vault2"
Now, you have created a Key Vault, stored a secret, and retrieved it.
In this quickstart, you have created a Key Vault and stored a secret in it. To learn more about Key Vault and how you can use it with your applications continue to the tutorial for web applications working with Key Vault.