Lesson 1 of 5 Azure Key Vault

Deploying and Configuring Key Vault

This lesson explains what Key Vault protects, how to choose a tier, and which settings prevent the loss of keys and secrets.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish keys, secrets and certificates.
  • Choose among Standard, Premium and Managed HSM.
  • Explain soft delete and purge protection.
  • Deploy a vault with protective settings.

What Key Vault protects

Applications depend on sensitive values: connection strings, API tokens, encryption keys and TLS certificates. When these values are scattered through configuration files and pipelines, nobody can say who has seen them, and rotating them is slow. Azure Key Vault centralizes them behind Microsoft Entra authentication, Azure authorization, network rules and audit logging.

A vault holds three types of object, and each answers a different need.

ObjectWhat it isHow it is usedExample
SecretAny value of up to 25 KB, stored encryptedAn application retrieves the valueA database connection string
KeyAn RSA or elliptic curve cryptographic keyOperations occur inside the vault, so the private key never leavesA customer-managed key for Azure Storage encryption
CertificateAn X.509 certificate with its private key and policyKey Vault can create and renew it, and services can use itA TLS certificate for Azure Application Gateway

The distinction between secrets and keys matters. An application reads a secret and then holds the value in memory. An application asks a key to perform an operation, such as sign or unwrap, and the key material stays protected.

Sort into groups

Secret, key or certificate?

Exam skills 1.2.1 · 1.2.5

Decide which Key Vault object type fits each item.

Log in to try this activity Interactive activities are free with an account.

Choosing a tier and a design

Azure offers several options for key storage. Standard protects keys in software. Premium adds keys protected by hardware security modules (HSMs). Managed HSM is a separate, fully managed, single-tenant service, for cases in which an organization must have sole control of the security domain or must meet a higher validation level.

Key Vault Standard
Key protectionSoftware
Stores secrets and certificatesYes
Access controlAzure RBAC or access policies
Choose when Secrets, certificates and software keys
Key Vault Premium
Key protectionSoftware or multitenant HSM
Stores secrets and certificatesYes
Access controlAzure RBAC or access policies
Choose when HSM-protected keys in a shared service
Managed HSM
Key protectionSingle-tenant HSM
Stores secrets and certificatesNo, keys only
Access controlLocal RBAC
Choose when Dedicated HSM control for regulated workloads

The recommended design is one vault per application per environment. A shared vault means that a person or workload with access to it can reach everyone's secrets, and that throttling by one workload affects all the others. Separate vaults also make it easy to apply different network rules, and to delete a project without affecting anything else. A vault name is globally unique, because it forms part of the DNS name VAULT.vault.azure.net.

Scenario questions

Tier and design

Exam skills 1.2.1

Choose a Key Vault tier and design.

Log in to try this activity Interactive activities are free with an account.

Protecting against deletion

A deleted key can be a disaster: data encrypted with it becomes unreadable. Two settings work together to prevent this.

  • Soft delete keeps a deleted vault or object in a recoverable state. It is on by default, cannot be disabled once enabled, and has a retention period of 7 to 90 days, with a default of 90. The period is set when the vault is created and cannot be changed afterwards.
  • Purge protection prevents anyone, including an administrator, from permanently deleting a soft-deleted item before the retention period ends. It is not on by default, and it cannot be turned off once it is set.

Soft delete alone leaves a gap, because someone with the Key Vault Purge Operator role can purge a deleted object immediately. A malicious insider, or an attacker who holds such a role, could therefore destroy a key for ransom. Purge protection closes this gap, and services that use customer-managed keys, such as Azure Storage and Azure Disk Encryption, depend on it.

The following diagram compares a deleted key with and without purge protection.

Soft delete and purge protection. When a vault or an object is deleted, soft delete keeps it recoverable for the retention period, from 7 to 90 days, 90 by default. Without purge protection, someone with the purge permission can destroy it permanently at once. With purge protection, nobody, including an administrator, can purge it before the retention period ends. Purge protection cannot be turned off once it is set.
Purge protection closes the gap that soft delete leaves.

Purge protection is permanent

Because purge protection cannot be reversed, a vault with this setting cannot be removed from your subscription until the retention period passes, and the same vault name cannot be reused during that time. Plan for this in test environments.

Fill in the value

Soft delete numbers

Exam skills 1.2.2

Recall the soft delete retention settings.

Log in to try this activity Interactive activities are free with an account.

Access configuration settings

The Access configuration page sets the permission model and allows selected Azure services to retrieve vault contents. The three resource access options are Azure Virtual Machines for deployment, which lets a VM retrieve certificates, Azure Resource Manager for template deployment, which lets a deployment retrieve secrets, and Azure Disk Encryption for volume encryption. Each is off by default, and each should be enabled only when needed.

Vaults created through control plane API version 2026-02-01 or later use Azure RBAC by default. Earlier API versions retire on 27 February 2027, so older deployment templates must be updated. Existing vaults keep their current model. The API change matters for automation: a template that assumes access policies will produce a vault that ignores them unless enableRbacAuthorization is set to false.

True or false

Access configuration

Exam skills 1.2.2

Check the Key Vault access configuration settings.

Log in to try this activity Interactive activities are free with an account.

Deploying a vault with a command

The following Azure CLI command creates a vault with purge protection and a 90-day retention period. The values in capitals are placeholders.

az keyvault create --name VAULT --resource-group RG --location westeurope \
  --sku standard --enable-purge-protection true --retention-days 90

Enable diagnostic settings after creating a vault, because access events are not recorded by default. Sending AuditEvent logs to a Log Analytics workspace allows Microsoft Sentinel and other tools to analyse who accessed what.

Worked example

Protecting a customer-managed key

A company stores a customer-managed key for Azure Storage in a key vault. A regulator requires that no individual, including a subscription owner, can permanently destroy the key within 60 days of its deletion. The vault was created with 30-day soft delete retention. What must you do?

Two facts decide the answer. Retention cannot be changed after a vault is created, so this vault can never offer 60 days. Soft delete alone also fails, because an authorized person can purge an object. The solution is a new vault created with retention of at least 60 days and purge protection enabled, followed by moving the key to it and updating the storage account's key reference. Moving a key between vaults uses backup and restore, within the same subscription and geography, or a new key can be created and data re-wrapped.

Enabling purge protection on the existing vault would stop purging, but only within its 30-day retention. A resource lock protects the vault resource, but it does not prevent the deletion of an object in the data plane.

Check yourself

Who can permanently delete a soft-deleted key before the retention period ends if purge protection is on?

Show answer

Nobody. Purge protection blocks purging, even by an administrator, until the retention period passes.

Exam Tips

Remember for the exam

  • Soft delete retention is fixed at creation, from 7 to 90 days.
  • Purge protection cannot be turned off.
  • Use one vault per application per environment.
  • Enable diagnostic settings, or access events are not logged.