Up And Running Azure Key Vaults ☁️

Introduction

 
In this tutorial, we will implement the Azure Key Vault in 10 simple steps. This will include from Provisioning of Resource, Verification, and Deployment of Key Vault as the configuration in a .NET Core App.
 

What is Azure Key Vault?

 
Azure Key Vault is a Tool for Securely Storing access secrets. We can store Keys, Secrets (Passwords), and Certificates. Having stored secrets at an external place is important when we want to share the same configuration, secret, or certificate is distributed across multiple systems.
 
Key Vaults are also important from the security perspective.
 
To access a key vault in either plane, all callers (users or applications) must be authenticated and authorized. Both planes use Azure Active Directory (Azure AD) for authentication. For authorization, the management plane uses role-based access control (RBAC) and the data plane uses a Key Vault access policy. [Source]
 
Tutorial
 
Now, we will create Azure Key Vault, Create a Password Record and Access It from ASP.NET Core 3.1 Application through Configuration. We will do this in 10 Steps.
Please follow along with the images that are available after the written steps!
 

Setting Up Azure Key Vault

  • Open Azure, Search and Open Key Vault
  • Click on +Add at Top Left.
  • Fill the Appropriate Configuration as per your needs, Click Review+Create, and then Create.
  • On the Left-Hand Side under Settings Section, Open Secrets, Click +Generate/Import.
  • Fill Fields like Name and Value or, other as per your needs and Click Create. 
Now our Azure Service Key Vault is Provisioned and we have created a Secret with Name MyPassword that contains our Secret Password.

Verifying Secrets
  • We can see MyPassword under Secrets Tab
  • We can see the current version. Here we can maintain the Versions of Our Secrets.
  • Open it to see the details, now we can click on Show Secret Value. We will find the value that we have added.

Now, we have successfully verified the secret value.

Using The Secret in Our Project
 
Now, we will implement the Secret in our project. For this tutorial, we will only read the secret.
  • Right-click on the project and add Connected Service, select Azure Key Vault (We need to be authenticated and authorized for Accessing Azure Service).
  • For testing, we will place a debug point in our application and see the value.

With the help of configuration, we were easily able to access the secure Credentials. This feels like credentials were a natural extension of the application. As per our need, we can use these secrets to help us work on business logic.

Summary

 
We have covered the following things:
  1. Setting Up Azure Key Vault.
  2. Verifying The Secret Password.
  3. Connecting with Our .NET Core 3.1 Application as Connected Service.
Please share your comments and suggestions for improvements.


Similar Articles