Understanding Secrets, Keys and Certificates in Azure Key Vault
This lesson explains what Key Vault stores, how access is authorized and how deletion is prevented.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish secrets, keys and certificates.
- Explain why Azure RBAC is preferred to access policies.
- Describe soft delete and purge protection.
- Identify network and vault separation recommendations.
What Key Vault stores
Key Vault separates sensitive material from application code and configuration. It holds three types of object, each with its own behaviour.
- Secrets are small pieces of data such as connection strings and API keys. The vault returns the value to an authorized caller.
- Keys are cryptographic keys. Operations such as encrypt, decrypt, sign and wrap happen inside the service, so private key material never reaches the caller.
- Certificates are X.509 certificates, built on keys and secrets, and add management features such as automated renewal.
The distinction between keys and secrets is significant. If an application retrieves a secret, it holds the value in memory. If an application uses a key, it asks the vault to perform an operation, and the key itself remains protected.
Secret, key or certificate?
Tiers
Key Vault has a Standard tier, in which keys are protected by software, and a Premium tier, which adds keys protected by hardware security modules (HSMs). Both tiers are multitenant services that Microsoft operates. Premium is the recommendation when a requirement demands HSM-backed keys but does not require a dedicated, single-tenant HSM. Higher levels of isolation are discussed in the next topic.
Authorizing access
Key Vault has two planes. The control plane manages the vault itself, such as its network settings, and uses Azure RBAC. The data plane reads and writes the objects inside. Azure RBAC is the recommended authorization system for the data plane, and it has been the default for new vaults since API version 2026-02-01. The older access policy model is a legacy system: it is vault-wide, grants permissions per principal, and allows anyone who can modify the vault to change data access.
With RBAC, a scope can be as narrow as a single secret, and built-in roles such as Key Vault Secrets User, Key Vault Crypto User and Key Vault Administrator support separation of duties. A vault's Contributor can manage the vault but cannot read its secrets through RBAC alone.
The following diagram shows a Key Vault design for a third-party API key used by one web app, and its controls.

RBAC for Key Vault
Protecting against deletion
Losing an encryption key can make data permanently unreadable, so deletion protection is central to a Key Vault design. Soft delete is always on, and keeps deleted vaults and objects for a recoverable period of 7 to 90 days, with 90 as the default. Purge protection is optional but, once enabled, cannot be turned off. It prevents anyone, including an administrator, from permanently removing a soft-deleted object before the retention period ends.
Azure services that use customer-managed keys generally require purge protection on the vault, because a purged key would destroy access to the encrypted data. Azure resource locks are not a substitute, because a lock protects the vault resource but not the objects inside.
Network access and reliability
A vault has a public endpoint by default. A production design normally disables public access and uses a private endpoint, so that the vault is reached over a private address, along with the matching private DNS zone. Trusted Azure services can be allowed through the firewall where needed.
Microsoft replicates vault contents within the region and to the paired region where one exists, and fails over automatically. Applications should still handle transient failures and throttling, and should cache secrets rather than calling the vault on every request. Microsoft recommends one vault per application per environment per region. Separate vaults limit the impact of a compromised identity, keep throttling limits apart and make audit logs simpler to interpret.
A production vault design
Designing vault access
A company runs a web application on App Service that needs a third-party API key. Security requires that the key is not stored in configuration, that only this application can read it, that no public network path exists to the vault, and that accidental permanent deletion is impossible. What should you recommend?
Store the API key as a secret in a dedicated Key Vault. Give the web application a managed identity, and assign Key Vault Secrets User to that identity on the single secret or on the vault. Use a Key Vault reference in the application setting, so the value is resolved by the platform rather than held in configuration.
Disable public access and add a private endpoint, with the web application using virtual network integration to reach it. Enable purge protection, which makes permanent deletion impossible during the retention period. An access policy at vault level would be broader and is the legacy model, and a resource lock would not prevent a secret from being purged.
Does an Azure resource lock stop someone from purging a secret?
Show answer
No. A lock protects the vault resource, not the objects in it. Purge protection is the feature that prevents permanent deletion.
Exam Tips
Remember for the exam
- Secrets are returned; key operations happen inside the service.
- Azure RBAC is the recommended data plane model; access policies are legacy.
- Soft delete is always on (7-90 days); purge protection blocks early permanent deletion and cannot be disabled.
- Use one vault per application, per environment, per region.