Lesson 2 of 2 Secrets, Certificates and Keys

Choosing Key Management and HSM Services

This lesson explains customer-managed keys, levels of HSM isolation and rotation.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain when a customer-managed key is justified.
  • Compare Key Vault Premium, Managed HSM and Azure Cloud HSM.
  • Describe automated rotation of keys, secrets and certificates.

Service-managed and customer-managed keys

Azure services encrypt data at rest by default with service-managed keys, which need no effort from the customer. A customer-managed key (CMK) is an encryption key that the customer creates and controls in Key Vault or an HSM. The service uses envelope encryption: a data encryption key protects the data, and the CMK wraps the data encryption key. The service reaches the CMK through a managed identity that has wrap and unwrap permissions.

A CMK adds control, because the customer can rotate the key or revoke access, which immediately makes the data unreadable. It also adds operational risk and work, since losing the key loses the data. A design should use a CMK only when a compliance requirement or a security policy demands it. If a question asks merely for encryption at rest, the default service-managed encryption already meets it.

Levels of key isolation

When an HSM is required, the correct service depends on how much isolation is demanded and on how applications use the keys.

Key Vault Premium

Key Vault Premium stores keys in HSMs that are shared between tenants, operated as a multitenant service. It is the simplest and cheapest option, and it integrates with Azure services that support customer-managed keys.

Azure Key Vault Managed HSM

Managed HSM is a fully managed, single-tenant, highly available service using FIPS 140-3 Level 3 validated HSMs. The customer holds the security domain, so Microsoft has no access to the keys. It keeps the Key Vault style of API and integrates with Azure services for customer-managed keys. It is the recommendation when a regulation demands single-tenant HSMs and sole control of keys, but the solution should remain a managed cloud service.

Azure Cloud HSM

Azure Cloud HSM is a single-tenant HSM cluster validated to FIPS 140-3 Level 3, and it is the successor to Azure Dedicated HSM, which accepts no new customers and is supported only until 31 July 2028. The customer has full administrative control and uses standard interfaces, such as PKCS#11. It suits lift-and-shift applications that already talk directly to HSMs, such as an application that performs its own signing or a database using TDE with an HSM provider. It does not plug into Azure services as a customer-managed key store in the way Managed HSM does.

The following comparison summarizes the options. A separate service, Azure Payment HSM, exists for payment processing workloads only.

Key Vault Premium
TenancyMultitenant
Who controls the HSMMicrosoft operates it
InterfaceKey Vault API
Customer-managed keys for Azure servicesYes
Choose when HSM-backed keys at the lowest cost
Managed HSM
TenancySingle-tenant
Who controls the HSMCustomer security domain
InterfaceKey Vault style API
Customer-managed keys for Azure servicesYes
Choose when Single-tenant HSM for Azure service encryption
Azure Cloud HSM
TenancySingle-tenant
Who controls the HSMCustomer administrators
InterfacePKCS#11 and similar standards
Customer-managed keys for Azure servicesNot the typical use
Choose when Applications that call HSMs directly

The following diagram compares Azure key management services against a bank's requirement for single-tenant HSMs under its sole control.

Choosing a key service for single-tenant, FIPS 140-3 Level 3 HSMs under the bank's sole control, as a managed service. Managed HSM is single-tenant, the bank holds the security domain, it meets the validation and it is fully managed; Azure Storage and Azure SQL Database use it for customer-managed keys. Key Vault Premium is multi-tenant, and a dedicated HSM appliance would need staff to operate it.
The scenario is illustrative.
Scenario questions

Which key service?

Exam skills 1.2.5

Choose the key service for each isolation requirement.

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

Rotation and lifecycle

Keys and secrets should change regularly, and automation prevents both expiry and forgotten rotation. Key Vault supports a key rotation policy, which creates new key versions on a schedule. Services configured to use the latest version pick up the new key automatically. Secrets that have an external source need more work: Key Vault publishes events to Azure Event Grid when a secret nears expiry, and a Function can then rotate the credential and update the vault.

Certificates receive their own lifecycle management. Key Vault can create certificates through integrated public certificate authorities, or import certificates, and it can renew supported certificates automatically or send notifications before expiry. Services such as Application Gateway and Front Door can consume certificates from Key Vault, so renewal propagates without manual deployment. Managed certificates offered by App Service and Front Door are simpler when they meet the requirements, as there is no vault to run.

Match the pairs

Automating the lifecycle

Exam skills 1.2.5

Match each lifecycle need with the mechanism that automates it.

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

Selecting a key service

A financial regulator requires a bank to use encryption keys held in single-tenant, FIPS 140-3 Level 3 validated HSMs under the bank's sole control. The keys will encrypt Azure Storage and Azure SQL Database. The bank wants a managed service, and has no staff who can operate HSMs. Which service should you recommend?

Managed HSM is the answer. It is single-tenant, the bank holds the security domain, it meets the validation requirement, and it is fully managed. Azure Storage and Azure SQL Database can both use it for customer-managed keys.

Key Vault Premium is multitenant, which fails the regulator's rule. Azure Cloud HSM is single-tenant, but it asks the customer to administer the HSM and is aimed at applications that call an HSM directly. Azure Dedicated HSM accepts no new customers. Service-managed keys would leave control with Microsoft and fail the requirement outright.

Check yourself

A requirement says only that data must be encrypted at rest. Is a customer-managed key needed?

Show answer

No. Azure services already encrypt at rest with service-managed keys. A customer-managed key is justified by a requirement to control the key.

Exam Tips

Remember for the exam

  • Use a customer-managed key only when a requirement demands control of the key.
  • Key Vault Premium is multitenant; Managed HSM is single-tenant and managed; Cloud HSM is single-tenant and customer-administered.
  • Azure Dedicated HSM is closed to new customers; Azure Cloud HSM is its successor.
  • Automate rotation with a key rotation policy, and use Event Grid events for secrets.