How to Implement Key Vault in Azure
Tags: azurekeyvault, keys, secrets, vault
Published: 2023-05-26 19:17:02

Azure Key Vault is an Azure service that falls under the category of key management solutions. It is used to securely store application secrets in a centralised cloud location so that access permissions and access logging can be controlled. 

It is very useful for the followings:
(1) To manage storage and access to secrets such as tokens, passwords, certificates, API keys, and other secrets
(2) It makes creating and controlling the encryption keys used to encrypt your data easy
(3) It facilitates certificate management
(4) It's used to store secrets that are backed by hardware security modules (HSMs)

Let me quickly take you through how to implement this valuable cloud based security service in Azure

**1st Step - Create a Key Vault**
Log in to Azure portal and search for Azure Key Vault

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d62ke7ajl73qjb90d1hn.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilc929vtrntybwyv5ot6.png)



Click on it


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r11fuutd5v6yu39rrjtw.png)
Then Click on Create


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t5qaz0axn2b6b1x1nfas.png)
Complete the Project Details and the Instance details
Select your subscription. I will use Azure Pass Sponsorship
I will use the Resource group **MayWorkload1**
Then under Instance details, you can give any random name to your key vault that you want to create. I will name this one **dovault1**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yl0lcy7284eitb330s70.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9o87o9ifeovar00ohoy3.png)


Soft-delete is enabled. This feature allows recovery of the deleted vaults and deleted key vault objects like secret, key, and certificate. It will remain recoverable for a configurable period of 7 to 90 calendar days. Its at default of 90days in the image above
Enable purge protection

Then click on Review and Create

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/28mnqgf1tghu49p7agd8.png)


Click on create and wait for the deployment to be complete

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7sklflrkyyyto3cidfqi.png)
The Key Vault **dovault1** has been created

**2nd Step - Create a Key**
Go to Resource and Click on Keys

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/agjebku5yetaet6mwi0m.png)



Click on Generate/Import

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y2fx5kyactnzlzzavtph.png)


Give the key any name of your choice.I will name this key **dokey1**
Leave the creating option at Generate
Leave key type and RSA key size at default
Set the Activation and Expiry dates

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4tazbk0rnk3fynoqv7e.png)



Then click on Create

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fu0l1c7e78u4a5umzzqe.png)


dokey1 has been created

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wr50422nwfc9wfz5nuhf.png)


**3rd Step - Create a Secret**
Go back to the Key vault and click on Secrets

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3ac1g7ldhsa7idozoq4.png)


Give the secret a name of your choice. I will name this one **dosecret1**
Then leave other parameters at default and set the activation and expiry date

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72lwj5idkwk7zgg5dzvu.png)


Click on Create

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/we7gmsd8osihpavt999t.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/276l70enlq94svt7x4n0.png)



Just as simple as that. We have created a Key Vault and we have created a key and a secret in it.

This is helpful? Kindly give a comment.