How to create a Key Vault and add Key, Secret and Certificate in Microsoft Azure
Tags: azure, cloud, kubernetes, microsoftcloud
Published: 2023-03-22 21:44:48

Azure Key Vault is a cloud service that securely stores and manages application secrets in a centralized cloud location where it is safeguarded by industry-standard algorithms and hardware security modules in order to control access, permission and login.
The key vault securely keep sensitive information like keys, secrets, certificates, passwords etc.
Azure key vaults are created and managed through the Azure portal.
In this Quick Start, we will concentrate on creating a Key Vault, then add Key, Secret and Certificate to it.

**Step 1**

Go to search bar, Click and Search for KEY VAULT 

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

**Step 2**

Click on 'Create key vault'

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

**Step 3**

**Subscription**   -Choose your prefer Subscription

**Resource group** -Create or Select a resource group[mine was the MarchworkFlow]

**Key vault name** - Choose a unique name

**Region** - East us

**Pricing tier** - Standard

**Soft delete** -  Is  always automatically enabled, to enable user to recover permanently delete a key vault and secrets durimg the retention period. .

**Days to retain deleted vaults** - The retention period is 7 to 90 days. This means if you purposefully or mistakenly delete a key vault, you can recover it within 7 - 90 days, depending on the 

**Purge protection** - It enforces mandatory retention period and prevents the permanent deleting of key vaults prior to the retention period **select and click enable purge protection**.


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

**Step 4**

Select and Click **'Review + Create'**


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

**Step 5**
Select and Click **'Create'**

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

**Step 6**
Select and Click **'Go to resource'**

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


**Step 7**
Key Vault is created and ready to use

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

**Step 8**

CLick and select **key** on the right hand side as indicated in the diagram below

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


**Step 9**
Select and Click **'Generate/Import'**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4neflsb3gzpkdaisclig.jpg)


**Step 10**

**Name** - Choose a unique name

**key type**  - left as RSA 

**RSA key size** - 2048

* Enable **'Set activation date'** and **'Set expiration date**' to your preference 
**Enabled** - Yes

**Tags** - This is optional you can use to create tags or not 
Click on 'Tags' to choose a Tag Name and Tag Value for the project. E.g Tag Name - Windows and Tag Value - Hp


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

**Step 11**
Select and Click **'Create'**

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

**Step 12**
Congratulations you`ve successfully created a **Key**

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

**Step 13**

Now to create **Secrets **in key vault
Click on '**Secrets**'

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

**Step 14**
Select and Click **'Generate/Import'**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50f5cod8tq9p6gt5g9z3.jpg)


**Step 15**

**Name  **Create a unique name

**'Set activation date'** and **'Set expiration date**' to your preference 

**Enabled** - Yes

Click on **'Create'**



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




**Step 16**

Congratulations you`ve successfully created a **Secret**

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

Finally to create **Certificate**in key vault
Click on '**Certificate**'


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7khjolhojzvz7hu6t92a.jpg)

**Step 18**
Select and Click **'Generate/Import'**


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

**Step 19**

**Method of Certificate Creation** - You can either  Generate one or Import an existing certificate
 
**Certificate Name** - Create a unique name for your Certificate

**Type** - Should be left at defualt ( self-Signed Certificate)

**Subject**  - Subject would be a unique Domain to access your certificate and must be written this way **"CN=tommysCerti12c3.com"**

**Validity Period** - adjust to your peference

**Content Type** - leave at default

**Lifetime Action Type **-  Automatic renew at the given percentage lifetime

**Percentage lifetime** - adjust to your perference


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8w0yv8ypt9yda9dquvru.jpg)


**Step 20**
Select and Click **'Create'**

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

**Step 21**
**Congratulations!!**
on completing creating the **3 Main Components** of Creating a key Fault
which are the** key , Secret , Certificate
**

**NOTE**: Make sure to always delete Azure Resource when they are not in use

**Enjoy!!!!!**