How to deploy a Key Vault with Key, Secret and Certificate on Microsoft Azure
Published: 2023-03-13 16:12:59

Azure Key Vault is a cloud service for securely storing and accessing secrets. A secret is anything that you want to tightly control access to, such as API keys, passwords, certificates, or cryptographic keys. Key Vault service supports two types of containers: vaults and managed hardware security module(HSM) pools. Vaults support storing software and HSM-backed keys, secrets, and certificates. Managed HSM pools only support HSM-backed keys.


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


STEP 1
Create a Microsoft Azure account and login.


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

STEP 2
Search for 'Keyvaults' and click on it


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

STEP 3
Click on 'Create Key vault'

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

STEP 4
-Fill in the boxes. Choose your subscription.
-Create/choose a resource group[mine was the marchworkload].
-Type in a unique keyvault name
-Choose a region of your choice and the pricing tier.
-**Soft delete**: This feature allows you to recover or permanently delete a key vault and secrets for the duration of the retention period. It is automatically enabled in a key vault.
-**Days to retain deleted vaults**: helps you choose between 7-90 days to recover your vault if it gets deleted by chance.
-**Purge protection**: It enforces mandatory retention period and prevents the permanent deleting of key vaults prior to the retention period elapsing.
Click on 'Review and create'


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

STEP 5
Click on 'Create'

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

STEP 6
Click on 'Go to resource'

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

STEP 7
The Key Vault is active

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

STEP 8
To create Keys in Key Vault,
Search for 'Keys' and click on it


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

STEP 9
Click on 'Generate/Import'


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

STEP 10
-Choose a unique name
-Set an activation and expiration date
-You can choose to add a tag or not
Click on 'Create'


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

STEP 11
Key has been successfully created


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

STEP 12
To create Secrets in Key Vault,
Search for 'Secrets' and click on it,
Then click on 'Generate/Import'


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

STEP 13
-Choose a unique name
-Set an activation and expiration date
-You can choose to add a tag or not
Click on 'Create'


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

STEP 14
Secrets has been successfully created

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

STEP 15
To create Certificates in Key Vault,
Search for 'Certificates' and click on it,
Then click on 'Generate/Import'


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

STEP 16
-**Method of Certificate Creation**: Generate 
-Create a unique name
-**Subject** - CN here stands for Common Name. Use any name of your choice but it must follow the required format. I used 'CN=myowncertificate.com'
-Fill the remaining boxes accordingly
Click on 'Create'


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

STEP 17
Certificates has been created.


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