Azure Key Vault: Secrets Management for Applications

On this page

Stop putting secrets in config files. Azure Key Vault centralizes secret management with proper access control and auditing.

Create Key Vault

Bash1 line
az keyvault create --name myappkv --resource-group myapp-rg --location westeurope

Add Secrets

Bash1 line
az keyvault secret set --vault-name myappkv --name "DatabasePassword" --value "secret123"

Access from .NET

C#8 lines
// In Program.cs
config.AddAzureKeyVault(
    new Uri("https://myappkv.vault.azure.net/"),
    new DefaultAzureCredential()
);

// Access as config
var password = Configuration["DatabasePassword"];

Best Practices

  • Use Managed Identity for Azure services
  • Enable soft-delete and purge protection
  • Rotate secrets regularly
  • Audit access logs

References


Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Written by

Nithin Mohan TK

Hello Namaste! 👋🏻 I'm an accomplished Enterprise Solution Architect & Engineering Leader with 20+ years of progressive experience architecting, building, and scaling transformative enterprise solutions. ⚜️ Solution Architect / AI & Cloud 📌 Galway, Ireland

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.