In this guide, you'll use a sample application to retrieve secrets and passwords from Key Vault.
Download the samples and prepare
Download the Azure Key Vault client samples from the Azure Key Vault client samples page.
Extract the contents of the .zip file to your local computer.
Read the README.md file (this is a text file), and then follow the instructions.
Run Sample #1--HelloKeyVault
HelloKeyVault is a console application that walks through the key scenarios that are supported by Key Vault:
- Create/import a key (HSM or software key)
- Encrypt a secret using a content key
- Wrap the content key using a Key Vault key
- Unwrap the content key
- Decrypt the secret
- Set a secret
That console application should run with no changes, except that the appropriate configuration settings in App.Config will be updated according to the following steps:
- Update the app configuration settings in HelloKeyVault\App.config with your vault URL, application principal ID, and secret. The information can optionally be generated using scripts\GetAppConfigSettings.ps1.
- Update the values of the mandatory variables in GetAppConfigSettings.ps1.
- Launch the Windows PowerShell window.
- Run the GetAppConfigSettings.ps1 script within the PowerShell window.
- Copy the results of the script to the HelloKeyVault\App.config file.