Azure Key Vault and Encryption: Secrets, Keys, Certificates, Managed HSM, Disk Encryption and Customer-Managed Keys

Microsoft Azure Architect Technologies AZ 300 55 min min read Updated: Nov 17, 2026 Intermediate
Azure Key Vault and Encryption: Secrets, Keys, Certificates, Managed HSM, Disk Encryption and Customer-Managed Keys
Intermediate Topic 1 of 3

What Key Vault Stores

ObjectExamples
SecretsConnection strings, passwords, API keys
KeysRSA/EC keys for encrypt, sign and wrap. Software or HSM protected
CertificatesTLS certificates with auto renewal and rotation
ServiceProtection
Key Vault StandardSoftware-protected keys
Key Vault PremiumHSM-protected keys (FIPS 140-2/3 validated hardware, check current level)
Managed HSMDedicated, single-tenant HSM pool under your control

Create and Use a Vault

bash az keyvault create -g rg-sec -n kv-shop-482 -l centralindia --enable-rbac-authorization true --enable-purge-protection true --retention-days 90 az role assignment create --assignee <user-or-group-id> --role "Key Vault Secrets Officer" --scope $(az keyvault show -n kv-shop-482 --query id -o tsv) az keyvault secret set --vault-name kv-shop-482 -n SqlPassword --value '<StrongPassword>' az keyvault secret show --vault-name kv-shop-482 -n SqlPassword --query value -o tsv

Authorization Models

  • Azure RBAC (recommended): roles like Key Vault Secrets User (read secrets), Secrets Officer, Crypto User, Certificates Officer, Administrator
  • Access policies (legacy): per-vault permission lists
  • Separate management plane (create the vault) from data plane (read secrets)

Protect Against Deletion

  • Soft delete (always on): deleted objects can be recovered for the retention period
  • Purge protection: even admins cannot purge before the retention ends. Required for customer-managed keys scenarios
  • Add resource locks, diagnostic logs and alerts for access

Apps Read Secrets with Managed Identity

python from azure.identity import DefaultAzureCredential from azure.keyvault.secrets import SecretClient client = SecretClient(vault_url="https://kv-shop-482.vault.azure.net", credential=DefaultAzureCredential()) password = client.get_secret("SqlPassword").value
  • Turn on a system-assigned identity for the app and give it Key Vault Secrets User. No password is stored in the app
  • App Service and Functions can read secrets directly with a Key Vault reference in app settings: @Microsoft.KeyVault(SecretUri=https://kv-shop-482.vault.azure.net/secrets/SqlPassword/)
  • AKS can use the Secrets Store CSI driver with workload identity

Network Security for Key Vault

  • Use firewall rules or a private endpoint with the privatelink.vaultcore.azure.net DNS zone, then disable public access
  • Allow trusted Microsoft services only when needed

Encryption in Azure

LayerOption
Storage and many servicesAlways encrypted at rest. Use customer-managed keys with Key Vault for control
VM disksServer-side encryption with platform or customer keys (default). Encryption at host covers temp disks and caches. Azure Disk Encryption uses BitLocker or dm-crypt inside the VM
DatabasesTDE (customer-managed key optional), Always Encrypted for client-side column encryption
Confidential computingProtect data in use with confidential VMs and containers
In transitTLS 1.2+ everywhere, HTTPS only
bash az disk-encryption-set create -g rg-sec -n des-prod -l centralindia --key-url https://kv-shop-482.vault.azure.net/keys/disk-key/<version> --source-vault kv-shop-482 --identity-type SystemAssigned # Give the set's identity "Key Vault Crypto Service Encryption User", then use --disk-encryption-set when creating disks or VMs

Key Rotation and Certificates

  • Set rotation policies on keys and use Event Grid events for near-expiry notices
  • Key Vault can issue and renew certificates from integrated CAs and notifies before expiry
  • Use versionless key URIs so services pick up rotated keys

Practice

  1. Create a vault with RBAC and purge protection
  2. Store a secret and read it from a VM or app using managed identity
  3. Create a disk encryption set with a customer-managed key
  4. Add a private endpoint and disable public access

Conclusion

Key Vault centralizes secrets, keys and certificates. Use RBAC, soft delete and purge protection, managed identities for access, private endpoints for network safety and customer-managed keys when policy requires.

Quick Summary: objects; vault creation; authorization; protection; managed identity; encryption; rotation.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators