Keeping Secrets Safe in .NET/.NET Core Applications with Azure Key Vault

Ashish Patel
Awesome Azure
Published in
2 min readJan 22, 2019

--

Store and read app settings from Azure Key Vault in .NET 5.x/ASP.NET Core 3.x apps.

Azure Key Vault

TL;DR

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. It’s also a great way to keep secrets out of source control.

This article explains how to use the Microsoft Azure Key Vault configuration provider to load app configuration values from Azure Key Vault secrets.

Why Store Secrets in Azure Key Vault

  1. Keeping Secrets out of source control like GitHub, BitBucket, etc.
  2. Centralized Storage of Secrets.
  3. Access control and logging.
  4. Quick and easy to implement.
  5. Very cheap to use.

Store settings in Azure Key Vault

  1. First create a vault.
  2. Add a secret to your vault.
  3. Secure your app service using Managed Service Identity.
  4. Access the secret from your source code with a KeyVaultClient.

--

--

Ashish Patel
Awesome Azure

Cloud Architect • 4x AWS Certified • 6x Azure Certified • 1x Kubernetes Certified • MCP • .NET • Terraform • DevOps • Blogger [https://bit.ly/iamashishpatel]