Azure Key Vault protects secrets, cryptographic keys, and certificates behind Entra authentication, authorization, logging, recovery, and network controls. Store a password as a secret, use a key for cryptographic operations without exporting its private material, and use certificate objects for certificate lifecycle. Applications should access the vault with managed identity.
Lab: 35 minutes · Cost: operations and premium/HSM choices can be billable · Creates: vault and one dummy secret · Never use: a real password in this lab.
Do not store large files or general configuration in Key Vault. Store only sensitive values and cryptographic material that need its controls.
Ways to build
Choose the Azure tool you want to use. The underlying resource stays the same.
Search Key vaults → Create. Choose subscription, resource group, globally unique name, region, pricing tier, recovery settings, authorization model, and network access. Prefer Azure RBAC for consistent authorization. After creation, assign Key Vault Secrets Officer at the narrow vault scope and use Objects → Secrets → Generate/Import for the harmless DemoMessage value.
Python example:
The same code can use a developer's Azure login locally and managed identity in Azure. Production authorization still depends on explicit RBAC.
Deploy the vault, private endpoint, private DNS link, managed identity, and role assignment as code. Do not pass secret values in Bicep parameters or Terraform variables unless the delivery mechanism and state handling are explicitly secured. Terraform state can contain sensitive values even when CLI output hides them.
Soft delete retains a deleted vault or object for recovery. Purge protection prevents permanent purge until retention expires. These protections defend against accidents and malicious deletion, but they affect name reuse and teardown. A lab vault with purge protection may keep its globally unique name unavailable until recovery retention ends.
Prefer identities and tokens that do not require stored passwords. When a secret remains necessary:
Use Event Grid, Functions, automation, or supported rotation integrations. Monitor expiry well before it becomes an outage.
Delete the dummy secret and vault or resource group. Remember purge protection may retain the deleted vault until the retention window ends.