Azure Key Vault: The Complete Advanced Guide

Azure Key Vault: The Complete Advanced Guide

A book-style walk through the service that guards the secrets, keys, and certificates of your cloud: how it is built, how to choose between vaults and hardware modules, how to control access and networks, how to rotate, protect, monitor, and recover what it holds, and how to keep it fast, governed, and affordable.

Imagine a bank with a vault in its basement. Customers do not carry their jewels home each evening. They leave them in a strong room that needs several keys, where guards check identity, and where a logbook records every visit. Applications have valuables too: database passwords, signing keys, encryption keys, and certificates that prove who a website is. If those valuables sit in code files, chat messages, or build scripts, they are like jewels left on a café table. Azure Key Vault is the strong room for your applications. It stores sensitive items, controls who may use them, records every use, and can even perform cryptographic work so that the most precious keys never leave the building.

In this guide we go well beyond a product tour. We will learn what Key Vault stores and why, how its two planes of control work, how to choose between its standard vaults, premium vaults, and managed hardware modules, and how to authorise and network-protect it. We will study rotation, certificates, recovery, high availability, monitoring, limits, and the 2026 changes that every team should know. Every new term is explained when we first meet it, with everyday pictures to keep the ideas simple.

1What Azure Key Vault Really Is

Before settings and diagrams, we need a clear picture of the problem Key Vault solves and of the three kinds of treasure it keeps.

The short definition

Azure Key Vault is a cloud service for safely storing and managing secrets, cryptographic keys, and certificates. A secret is any small piece of sensitive text, such as a password, a connection string, or an application programming interface key. A key is a cryptographic key used to encrypt, decrypt, sign, or verify data. A certificate is a digital identity document, usually used to prove that a website or service is genuine and to encrypt traffic. Key Vault keeps all three behind one consistent set of identity checks, permissions, and audit logs.

The service exists because secrets scatter. Developers paste a password into a configuration file to get a demo working, the file is committed to a repository, copies spread to laptops and build servers, and months later nobody knows where all the copies are or who can read them. Key Vault replaces scattered copies with one controlled home. Applications ask for what they need at the moment they need it, prove who they are, and are logged. If a secret leaks, you change it in one place and every application picks up the new value.

Simple Analogy

Think of a hotel front desk that holds room keys. Guests do not carry a master key. They ask the desk, show identification, and receive only the key for their own room. The desk keeps a log of every request, and if a key is lost the desk simply changes the lock and issues a new one. Key Vault is the front desk for your digital keys.

Why not just use environment variables or files?

Files and variables are easy, but they have no built-in identity checks, no audit trail, no automatic versioning, and no protection against accidental sharing. Key Vault gives you each of these. It also offers features that files never could: hardware-backed keys that cannot be extracted, automatic renewal of certificates, soft deletion that rescues you from mistakes, and events that tell other systems when a secret is about to expire.

Three object types
secrets, keys, and certificates
Every access logged
who, what, and when
Hardware options
keys protected inside HSMs

What it is not

Key Vault is not a general database. It is meant for small, sensitive items, not for storing large files or high-volume customer data. It is not a replacement for good application design: an application that fetches a secret on every request will be slow and may be throttled. It also does not make a bad process safe by itself, because a vault with careless permissions is only a nicer-looking box with the door open.

i
Remember This

Key Vault is not about hiding things. It is about controlling who may use sensitive items, proving who did, and being able to change them quickly when something goes wrong.

Why it matters to the business

Leaked credentials are among the most common causes of serious breaches. Attackers do not need clever tricks when a password sits in a public repository or an old configuration backup. A central vault reduces the number of places where secrets exist, shortens the time between a leak and a fix, and gives investigators a clear record of what was touched. For auditors, it provides evidence that sensitive items are controlled. For engineers, it removes the dull and risky chore of passing secrets around by hand.

2Core Concepts and Vocabulary

A handful of terms appear in every conversation about Key Vault. Learn them once and the rest of the guide becomes easy to read.

Container

Vault

The basic Key Vault resource. It holds secrets, keys, and certificates, and has its own address, settings, and permissions.

Container

Managed HSM

A separate service: a dedicated pool of hardware security modules managed by Azure, holding only hardware-protected keys, for the strictest needs.

Object

Secret

Small sensitive text such as a password or connection string, retrieved by authorised callers.

Object

Key

A cryptographic key. Applications ask the vault to perform operations with it rather than taking the key away.

Object

Certificate

An X.509 certificate managed with its lifecycle, including creation, renewal, and the key behind it.

Hardware

HSM

A hardware security module: a tamper-resistant device that creates and uses keys without ever exposing them.

Identity

Managed identity

An automatically managed identity for an Azure resource, so it can prove who it is without a stored password.

Access

Azure RBAC

Role-based access control: permissions given through roles at a scope. It is now the default model for new vaults.

Access

Access policy

The older, vault-specific permission list. Existing vaults may still use it.

Safety

Soft delete

Deleted vaults and objects stay recoverable for a retention period.

Safety

Purge protection

A lock that stops permanent deletion of soft-deleted items until the retention period ends.

Network

Private endpoint

A private address in your virtual network for reaching the vault without the public internet.

Versions, identifiers, and addresses

Every vault has a unique domain name, and every object inside has an identifier made from the vault name, the object type, the object name, and a version. When you update a secret, you do not overwrite it. You create a new version, and the old one remains. An application can ask for the current version by leaving the version out, or for an exact version by including it. This simple design makes rotation safe, since you can add the new version, move consumers over, and still return to the old version if something goes wrong.

Attributes that guard each object

Each object carries attributes such as enabled or disabled, activation time, and expiry time. A disabled object cannot be used. An object with an expiry time warns you, or other systems, that it needs renewing. Tags let you add your own labels, such as the owner or the system a secret belongs to. These attributes are small, but they are the basis of good governance: you can find every secret that expires within a month, or every key with no owner tag.

TermPlain meaningWhy it matters
Vault URIThe web address of a vaultApplications use it to find the vault
Object versionA numbered copy of a secret, key, or certificateAllows safe rotation and rollback
ExpiryThe date after which an object should not be usedDrives renewal reminders and compliance
TenantYour organisation’s identity directory in Microsoft Entra IDEvery vault belongs to one tenant
PrincipalA user, group, application, or managed identityThe one asking for access

Naming and addressing in practice

Vault names are globally unique and appear in web addresses, so choose them with care. A good name carries the application, environment, and region in a short, readable form, and avoids personal or secret details, since names are visible in logs and in network traffic. Object names should describe purpose rather than value, such as a database connection for the orders service, and should stay stable over time, because applications reference them. Changing a name later means changing every consumer.

3Architecture: Two Planes, One Front Door

The single most useful idea for understanding Key Vault security is that there are two separate planes, each with its own rules.

Simple Analogy

Think of a safe-deposit building. One group of staff builds the rooms, fits the doors, and sets the rules. They are the building managers. A different group of people actually opens boxes and uses what is inside. A building manager does not automatically get to open every box, and a box holder cannot rebuild the walls. Key Vault keeps these two jobs apart in the same way.

The management plane

The management plane, also called the control plane, is where vaults themselves are created, configured, and deleted. It runs through Azure Resource Manager, the standard Azure management layer. Here you choose the region, tier, network rules, soft delete settings, and diagnostic logging, and here you assign Azure roles that control who may manage vaults. Permissions on this plane are about the vault as a resource.

The data plane

The data plane is where objects are read, written, and used. When an application fetches a secret, signs data with a key, or downloads a certificate, it talks to the vault’s own address and uses its own authentication. Permissions on this plane decide what can be done with the contents. Today these permissions are given either through Azure role-based access control, the modern model, or through vault access policies, the older model.

flowchart TD
    subgraph MP[Management plane through Azure Resource Manager]
        ADM[Platform administrator] --> ARM[Create and configure vaults]
    end
    subgraph DP[Data plane through the vault address]
        APP[Application with managed identity] --> VAULT[Key Vault]
        DEV[Developer or operator] --> VAULT
    end
    ENTRA[Microsoft Entra ID] -->|Authenticates every caller| ARM
    ENTRA -->|Authenticates every caller| VAULT
    ARM --> VAULT
    VAULT --> LOG[Audit logs]
    VAULT --> EVT[Events for expiring objects]
        
FIG 1 — Two planes: managing the vault and using what is inside it, both authenticated by Entra ID

Authentication first, then authorisation

Every request to either plane begins with authentication, in which Microsoft Entra ID verifies who the caller is and issues a token. Key Vault then checks authorisation, asking whether that caller has permission for the operation on that object. If either step fails, the request is refused. There is no way to reach Key Vault without an Entra identity, which is a strength: the same directory, the same conditional access rules, and the same sign-in logs apply to the vault as to every other Azure service.

What happens inside

Inside the service, secrets and keys are encrypted at rest. Software-protected keys are processed in secured software on hardened servers. Hardware-protected keys are created and used inside hardware security modules, and cryptographic operations happen inside the module, so the key material is never revealed. When an application asks the vault to sign or decrypt something, it sends the data to the vault and receives the result, never the key. This pattern, where the key stays home and the work comes to it, is the heart of safe key management.

sequenceDiagram
    participant A as Application
    participant E as Microsoft Entra ID
    participant K as Key Vault
    A->>E: Prove identity with managed identity
    E-->>A: Access token
    A->>K: Request secret with token
    K->>K: Check token and permission
    K-->>A: Secret value
    K->>K: Write audit record
        
FIG 2 — How an application obtains a secret: identity, token, permission check, audit

Regional design

A vault lives in one region and its data stays inside that geography. Azure also replicates vault contents to a paired region for resilience in most cases, and the service uses availability zones where regions support them. Chapter 13 covers these resilience features in detail. For now, remember that vault location matters: put each vault near the applications that use it, to keep delay low and to respect data residency rules.

!
Do Not Mix the Planes

Owner or contributor rights on a vault as a resource do not, by themselves, allow reading secrets in the modern model. Keep the two kinds of permission separate in your design, and give each person only the plane they need.

Why the separation helps security

Splitting management from use limits damage. A person who can build or reconfigure vaults cannot automatically read what they hold, so a stolen administrator account does not instantly expose every secret. Likewise, an application that reads secrets cannot delete the vault. Auditors can review the two planes separately: who may change structure, and who may touch contents. This is why the modern permission model keeps role assignment itself as a protected action, available only to those with the right to grant access.

4The Three Objects: Secrets, Keys, and Certificates

Each object type solves a different problem. Choosing the right one avoids awkward designs and security gaps.

Secrets

A secret is the simplest object. It is a named value up to a modest size limit, stored encrypted and returned in full to any caller with permission to read it. Typical secrets are database passwords, connection strings, tokens for external services, and configuration values that must not be public. Because the caller receives the actual value, a secret is only as safe as the application that holds it afterwards. That is why you keep secret values in memory, avoid writing them to logs, and prefer identities over passwords wherever the target service allows it.

Secrets can have a content type label, such as a password or a certificate bundle, an activation date, an expiry date, and tags. Each update creates a new version. Applications that fetch the latest version automatically receive the newest value, which makes rotation smooth when the application can reload secrets without restarting.

Keys

A key object holds a cryptographic key and lets authorised callers use it through operations such as encrypt, decrypt, sign, verify, wrap, and unwrap. Wrapping means protecting another key by encrypting it with this one. Keys can be created in the vault, imported from elsewhere, and, in premium vaults and managed hardware modules, protected by hardware. The great benefit is that the private part of the key never leaves the service. Many Azure services use customer-managed keys stored here to encrypt your data at rest, such as storage accounts, databases, and disks.

Key types include RSA keys, elliptic curve keys, and for some services symmetric keys. Keys carry permitted operations, so a key made only for signing cannot be misused for decryption. Keys also support an automatic rotation policy that creates new versions on a schedule and can notify other systems beforehand.

Certificates

A certificate object is built on top of a key and a secret. Behind the scenes, Key Vault holds the key pair and the certificate chain, and exposes them as a certificate object with its own management features. You can create a certificate with a policy that states the subject name, key type, validity, and renewal behaviour. Key Vault can request it from a supported certificate authority, watch its expiry, and renew it automatically. You can also import existing certificates. We cover the full lifecycle in Chapter 11.

ObjectCaller receivesBest used forMain risk
SecretThe full valuePasswords, tokens, connection stringsValue leaks once it leaves the vault
KeyResults of operations, not the keyEncryption at rest, signing, wrappingLosing access to the key makes data unreadable
CertificatePublic part, or the bundle with private key if allowedTransport encryption and service identityExpiry causing outages
flowchart TD
    Q{What do you need to protect} -->|A value your app must read| S[Use a secret]
    Q -->|Encryption or signing without exposing the key| K[Use a key]
    Q -->|A website or service identity with renewal| C[Use a certificate]
    S --> S1[Prefer managed identity if the target supports it]
    K --> K1[Choose software, premium HSM, or Managed HSM by risk]
    C --> C1[Pick a trusted authority and enable auto renewal]
        
FIG 3 — Choosing the right object for the job

A common confusion: certificates versus secrets

Because a certificate’s private key can be read as a secret with the same name, some teams treat certificates as plain secrets. This loses the lifecycle features: the renewal policy, the issuer integration, and the expiry warnings. Store real certificates as certificate objects and let the vault manage them. Reserve plain secrets for values that are truly just text.

i
Rule of Thumb

If the application only needs to prove or protect something, use a key and let the vault do the work. If it must read the value, use a secret. If it is a certificate, use a certificate object.

“The safest key is the one that never leaves the vault, and the safest secret is the one you no longer need to store.”

Choosing good content types and tags

Small labels make large estates manageable. A content type tells readers what a secret contains, such as a connection string or a token, so tools can handle it correctly. Tags record the owner, the application, the environment, and the date of the last review. With consistent labels, a simple query can list every secret owned by a team, every key without an owner, or every object not reviewed this year. Without them, inventory becomes a guessing game during incidents and audits.

5Choosing Your Home: Standard, Premium, Managed HSM, and Dedicated Options

Azure offers several levels of protection. Choose by the strength of protection you need, the standards you must meet, and the money you can spend.

Simple Analogy

Compare a home safe, a bank’s shared vault, and a private armoured room built just for you. All three lock things away, but they differ in how strong the walls are, who else shares the building, and how much you pay. Pick the one that matches the value of what you keep.

Standard vaults

The standard tier stores secrets, certificates, and software-protected keys. The cryptography runs in software on Azure servers. It is the right choice for most applications: connection strings, tokens, ordinary certificates, and encryption keys where software protection satisfies your rules. It is also the cheapest option, charged per operation with no large fixed fee.

Premium vaults

The premium tier adds hardware-protected keys. Keys are created and used inside hardware security modules validated to published standards, so even Microsoft staff cannot extract them. Premium vaults still hold secrets and certificates like standard ones, and the same permission model applies. Choose premium when regulations or internal policy require hardware protection but you do not need a dedicated single-tenant module.

Managed HSM

Managed HSM is a separate service: a dedicated, single-tenant pool of hardware security modules that Azure operates for you. You control the security domain, which is an encrypted bundle needed to recover the module, and you own the key material completely. It supports only hardware-protected keys, not secrets or certificates. It has its own access control system and its own higher limits, and it is billed hourly per instance, so it costs much more than a vault. It suits strict regulatory settings, very high key volumes, and workloads that need high throughput of cryptographic operations.

Other hardware options

Azure also offers other dedicated hardware options for specific legacy or compliance needs, where you manage the device yourself. They are rarely needed for new projects, and Microsoft’s own guidance steers most customers to Key Vault or Managed HSM. Always check current documentation for what is offered in your region and for the standards each option meets.

OptionStoresKey protectionTenancyCost styleGood fit
Standard vaultSecrets, keys, certificatesSoftwareShared servicePer operation, lowMost applications
Premium vaultSecrets, keys, certificatesHardware for HSM keysShared service, hardware-backed keysPer operation, higher for HSM keysCompliance needing hardware protection
Managed HSMKeys onlyHardware, single tenantDedicated poolHourly per instanceStrict regulation and heavy key use
flowchart TD
    START[What do you need to protect] --> Q1{Secrets or certificates too}
    Q1 -->|Yes| Q2{Must keys be hardware protected}
    Q2 -->|No| STD[Standard vault]
    Q2 -->|Yes| PRE[Premium vault]
    Q1 -->|Keys only| Q3{Single tenant control or very high key volume}
    Q3 -->|No| Q2
    Q3 -->|Yes| MHSM[Managed HSM]
        
FIG 4 — A simple path for choosing between vaults and Managed HSM

Customer-managed keys and the tier choice

Many Azure services can encrypt data with a key you own. The tier you choose for those keys decides how strongly they are protected. For ordinary data, a software key in a standard vault is often enough. For highly regulated data, an HSM-backed key in a premium vault or Managed HSM may be required. Remember that the vault now becomes a dependency of the encrypted service, so its availability and access rules need the same care as the data itself.

Practical limits worth knowing

Vaults have no fixed cap on the number of objects, but each vault has transaction limits per ten-second window that differ by operation and key type. Managed HSM instances have their own caps, such as a limited number of keys per instance and a limited number of instances per subscription per region. These numbers change, so read the current limits page before sizing a design.

ANTI-PATTERN-01 Avoid
Problem

One giant vault is shared by every team, every environment, and every application, with broad roles for convenience.

Why It’s Harmful

A single mistake or compromise exposes everything. Throttling from one busy application affects all others. Permissions become impossible to review, and the blast radius is the whole company.

Correct Approach

Use separate vaults per application, environment, and sensitivity level, name them clearly, and give each application access only to its own vault.

6Proving Who You Are: Identity and Authentication

The best secret is one that never has to exist. Choosing the right identity method removes the “first secret” problem and shrinks your risk.

Simple Analogy

Imagine a company badge that is issued by the building itself, automatically changes every day, and cannot be copied or lent. Employees never see or carry a password. A managed identity is that kind of badge for an application: the platform issues and refreshes it, and nobody has to store it.

The first-secret problem

To fetch a secret from the vault, an application must first prove who it is. If it proves this with a password stored in a configuration file, you have only moved the problem: the password to the vault is now the most valuable secret in the system. Good design breaks this circle by using an identity that the platform itself provides.

Managed identities

A managed identity is an identity in Microsoft Entra ID attached to an Azure resource, such as a web app, function, virtual machine, container app, or Kubernetes workload. The platform creates it, rotates its credentials automatically, and hands tokens to code running on the resource. There are two kinds. A system-assigned identity lives and dies with its resource and belongs to it alone. A user-assigned identity is a separate resource that you create and can attach to several resources, which is helpful when many instances share the same permissions or when you need the identity to exist before the resource does.

Service principals

A service principal is the identity of an application registered in Entra ID. It can authenticate with a client secret or with a certificate. Both options need a credential that someone must store and rotate, so they are second choices, used when the caller runs outside Azure and cannot use a managed identity. Where possible, use workload identity federation, which lets an external system such as a build pipeline or another cloud exchange its own trusted token for an Entra token with no stored secret.

People

Humans sign in with their own Entra accounts, ideally with multi-factor authentication and conditional access policies that check device health and location. For sensitive vaults, use groups and just-in-time elevation so that nobody holds permanent powerful rights. Avoid shared accounts, because the audit log then cannot tell who did what.

MethodStored credentialRotationUse when
System-assigned managed identityNoneAutomaticOne resource, one set of permissions
User-assigned managed identityNoneAutomaticShared permissions across resources
Workload identity federationNoneNot neededPipelines and external platforms
Service principal with certificateCertificateManual or scriptedOutside Azure when federation is impossible
Service principal with secretClient secretManualLast resort, short lifetimes
flowchart TD
    Q{Where does the code run} -->|On an Azure resource| MI[Use a managed identity]
    Q -->|In a build pipeline or other cloud| FED[Use workload identity federation]
    Q -->|On a server outside Azure| ARC{Can it use Azure Arc}
    ARC -->|Yes| MI2[Use the Arc managed identity]
    ARC -->|No| SP[Service principal with certificate and short life]
        
FIG 5 — Prefer identities with no stored credential, falling back only when needed

Layers around identity

Identity is also protected by the tenant. Conditional access can block sign-in from unusual places. Privileged Identity Management can require approval and time limits for powerful roles. Sign-in logs record every authentication, and identity protection can flag risky sign-ins. These controls belong to Entra ID rather than Key Vault, but they decide how safe the vault really is.

i
Design Goal

Aim for a system where no human or application holds a long-lived password for the vault. Every caller proves identity through the platform, and every permission can be revoked in one place.

Short-lived tokens and caching of tokens

Tokens issued by Entra ID last a limited time, commonly about an hour, and libraries cache and refresh them automatically. This short life is a feature: a stolen token becomes useless soon. Applications should use the official identity libraries that handle caching and renewal, rather than requesting a new token for every call. Misusing them, by creating a new credential object per request, is a frequent cause of slowness and of throttling at the identity service rather than at the vault.

7Authorisation: Azure RBAC, Access Policies, and the 2026 Default Change

After identity comes permission. Key Vault has had two models, and Microsoft is steering everyone towards one of them.

The old model: vault access policies

Access policies are a list stored inside each vault. Each entry names a principal and ticks permissions for keys, secrets, and certificates, such as get, list, set, delete, sign, and so on. They are simple, but they have drawbacks. They apply to the whole vault, so you cannot give someone access to just one secret. The list lives inside each vault, which makes central review hard. Anyone who can edit the vault as a resource can add themselves to the list and then read every secret, a weakness known as privilege escalation. They also lack the conditions, scopes, and approval workflows that Azure role assignments support.

The modern model: Azure role-based access control

With Azure RBAC, permissions are given by assigning built-in or custom roles to principals at a scope. The scope can be a management group, subscription, resource group, vault, or even a single object, which allows fine control. Role assignments are visible in one place across the estate, can be audited by standard tools, can be time-limited through Privileged Identity Management, and are written down by the same processes as other Azure permissions. Because adding a role assignment needs separate rights, a person who can manage a vault cannot silently grant themselves access to its contents.

Role

Key Vault Administrator

Full control over objects in a vault. Keep it for a very small group and for break-glass situations.

Role

Key Vault Secrets User

Read secret values. The right role for an application that only needs to fetch its secrets.

Role

Key Vault Secrets Officer

Create, update, and delete secrets, for automation or teams that rotate them.

Role

Key Vault Crypto User

Perform cryptographic operations with keys, such as wrap, unwrap, sign, and decrypt, without managing them.

Role

Key Vault Crypto Officer

Manage keys: create, rotate, and delete them.

Role

Key Vault Certificates Officer

Manage certificates and their policies.

Role

Key Vault Reader

Read metadata but not secret values or key material. Useful for inventory and audits.

Role

Crypto Service Encryption User

Lets Azure services use a customer-managed key for encryption at rest, with only the operations they need.

The 2026 change in the default

Microsoft has announced that, with the Key Vault control plane API version 2026-02-01, Azure RBAC becomes the default access model for newly created vaults. Existing vaults keep their current model. Teams that create vaults through templates, scripts, or code and do not state the model explicitly may therefore get an RBAC vault where they expected access policies, and see denied requests until they assign roles. In addition, Microsoft has stated that older control plane API versions are retired on 27 February 2027, so templates and tools that pin older versions need updating. Treat these dates as pointers and confirm them in the official announcement and documentation.

1

Inventory

List every vault, its access model, and every template or tool that creates or updates vaults, with the API versions they use.

2

Make the model explicit

In every template, state the access model you want rather than relying on a default.

3

Update API versions

Move pinned versions to the current one well before the retirement date.

4

Plan migration to RBAC

For existing vaults, create equivalent role assignments first, then switch the model, and then verify access.

5

Clean up

Remove old access policy entries and review role assignments for least privilege.

!
Order Matters

When switching a vault to RBAC, existing access policies stop being honoured. Create the role assignments before the switch, or applications will suddenly lose access.

Choosing scopes

Assign roles at the smallest scope that works. An application that needs one secret can receive a role on that single secret. An application that uses several secrets from one vault gets a role on that vault. Broad roles at the subscription level are convenient but let a compromise reach every vault below. Use groups for people, and use managed identities for applications, so the number of direct assignments stays small and reviewable.

ANTI-PATTERN-02 Avoid
Problem

Every application identity receives the Key Vault Administrator role on the vault because it was the quickest way to stop permission errors.

Why It’s Harmful

A compromised application can read, change, and delete every secret, key, and certificate in the vault. Reviews cannot tell which permissions are really needed.

Correct Approach

Give each application only the narrow role it needs, such as Secrets User for reading, and keep administrator rights for a small, protected group.

Custom roles and just-in-time access

Built-in roles cover most needs, but sometimes a team needs a precise mix, such as permission to list and read secrets but never to change them. A custom role can express this. For people, combine roles with just-in-time activation so that powerful rights exist only for an hour, with a reason and an approver recorded. Standing administrator rights on production vaults are a habit worth breaking, because an unused permanent right is a target waiting for an attacker.

8Network Security: Firewalls, Private Endpoints, and Trusted Services

Even with perfect permissions, there is no reason to leave a vault visible to the whole internet. Network rules add a second wall.

Simple Analogy

Picture a strong room inside a building with a guarded entrance. Even a person with the right key must first get past the guard at the front door. Network rules are the guard at the door: they refuse visitors who come from the wrong direction, before their keys are even looked at.

The default and why to change it

By default, a vault’s endpoint is reachable from the public internet, protected by authentication and authorisation. That is already strong, but defence in depth says to reduce who can reach the door. The vault firewall lets you deny public traffic and allow only chosen sources.

Firewall rules and service endpoints

The firewall can allow specific public addresses, such as your office or build servers, and specific virtual network subnets using service endpoints. Service endpoints keep traffic on the Azure backbone but the vault still has a public address. This approach is easy and cheap, and suits many teams.

Private endpoints

A private endpoint gives the vault a private address inside your virtual network. Applications reach it through that address, traffic never crosses the public internet, and you can turn off public access completely. Private endpoints need correct name resolution: the vault’s normal name must resolve to the private address from inside your network, usually through a private DNS zone. On-premises networks need forwarding rules to resolve it too. Most private endpoint problems are really name resolution problems.

Trusted services

Some Azure services, such as storage, backup, and disk encryption, need to reach the vault on your behalf even when the firewall blocks public traffic. A setting lets trusted Microsoft services bypass the firewall. Use it deliberately, with the narrowest set of services you need, and understand that those services still need permission through roles.

flowchart LR
    subgraph VNET[Your virtual network]
        APP[Application] --> PE[Private endpoint]
    end
    PE --> KV[Key Vault with public access disabled]
    ONP[On-premises network] -->|VPN or private circuit with DNS forwarding| PE
    NET[Public internet] -.->|Blocked by firewall| KV
    TS[Trusted Azure service] -->|Allowed if bypass is enabled and roles permit| KV
        
FIG 6 — A private vault: applications and trusted services in, the open internet out

Choosing a network posture

PostureHow it worksStrengthEffort
Open to all networksPublic endpoint with authentication onlyBasicLowest
Firewall with address rulesOnly listed addresses and subnets may connectGoodLow
Private endpoint with public access offOnly private network paths reach the vaultStrongestHigher, needs DNS planning
!
Lockout Risk

If you disable public access before the private path works, you can lock out your own tools, including the portal on a laptop outside the network. Test from inside the network first, and keep a documented break-glass route.

Network settings and the platform

Some Azure services that read secrets, such as app hosting services and function platforms, need network integration of their own to reach a private vault. Plan the whole path: the application’s outbound network, the private endpoint, the DNS, and the role assignment. A failure at any step looks like “cannot read secret” even though each piece looks fine alone.

Testing network changes safely

Treat network changes to a vault like production releases. Apply them first to a test vault with the same pattern of endpoints and DNS. Use a test virtual machine inside the network to prove that name resolution points to the private address and that a read succeeds. Record the rollback step, which is usually to re-enable public access temporarily from a trusted address. Announce the change window to application teams, because the first sign of a mistake is often a flood of timeouts in a service nobody expected to be affected.

9Using Secrets in Real Applications

Storing secrets safely is half the work. The other half is how applications fetch, hold, and refresh them without causing slowness or outages.

Simple Analogy

A chef does not walk to the warehouse for every pinch of salt. The chef collects what is needed for the shift, keeps it at the station, and fetches more only when it runs out or changes. Applications should treat the vault the same way: ask once, remember in memory, and ask again when needed.

Ways to read secrets

Pattern

Direct read at startup

The application uses its managed identity to read secrets when it starts and keeps them in memory. Simple and fast for steady applications.

Pattern

Platform references

Hosting services such as app services and function platforms can resolve a reference to a vault secret and present it as an ordinary setting, so code needs no vault logic.

Pattern

Configuration providers

Application frameworks have providers that load secrets into configuration and can reload them periodically.

Pattern

Container and Kubernetes drivers

A secrets store driver mounts vault secrets into pods as files or syncs them into cluster secrets using workload identity.

Pattern

Pipeline integration

Build and release pipelines fetch deployment secrets at run time using federated identity instead of storing them in the pipeline.

Caching and refreshing

An application that calls the vault on every request will be slow and may be throttled. Cache values in memory for a sensible time, and handle failure with care: if a refresh fails, keep using the last good value and retry later, rather than failing the user. When a secret changes, applications should pick up the new version without a restart where possible, by reloading on a schedule or on an event. Never write secrets into logs, error messages, or crash dumps.

Rotation without drama

Rotation means replacing a secret regularly or after a suspected leak. It is safest when two valid values exist for a short time. A common design for databases uses two credentials in turn: the vault holds the active one, a new one is created and stored as a new version, applications move to it, and only then is the old one removed. Services that support Entra authentication avoid the whole problem, because there is no password to rotate.

sequenceDiagram
    participant R as Rotation process
    participant T as Target service
    participant V as Key Vault
    participant A as Applications
    V-->>R: Event says secret near expiry
    R->>T: Create new credential
    R->>V: Store as new secret version
    A->>V: Reload on schedule
    V-->>A: New version
    A->>T: Connect with new credential
    R->>T: Retire old credential after grace period
        
FIG 7 — A safe rotation: create, store, let consumers move, then retire the old value

Events and automation

Key Vault can publish events through Azure Event Grid when an object is near expiry, has expired, or has a new version. These events can start a function or workflow that rotates the secret, updates a dependent system, or opens a ticket. Short expiry dates on secrets, combined with these events, turn rotation from a yearly emergency into a routine job.

What to avoid

Do not copy secrets from the vault into other stores, because each copy escapes the audit trail and the rotation. Do not email or chat secret values. Do not put them in image layers, templates, or source repositories. Use secret scanning tools in your repositories so that accidents are caught early, and treat any secret that appeared in a repository as compromised, even if it was deleted afterwards.

i
Prefer No Secret at All

Before storing a database or storage credential in the vault, check whether the target accepts Entra identities. If it does, give the application a managed identity and delete the password.

Local development without real secrets

Developers need to run applications on laptops without receiving production secrets. Use separate development vaults with harmless values, and let the identity libraries pick up the developer’s own signed-in account, which has a role only on the development vault. This way, the same code runs everywhere, only the identity changes, and no secret is ever copied to a laptop. Production secrets then stay reachable only by production identities.

10Keys and Encryption: Customer-Managed Keys and Envelope Encryption

Keys in the vault protect your data in storage and in motion. Understanding envelope encryption explains almost every Azure service that uses a customer-managed key.

Simple Analogy

Imagine a warehouse where each box is locked with its own small padlock, and all the padlock keys are kept in a single locked cabinet. To protect everything, you only need to guard the cabinet’s key. If the cabinet key is changed, you re-lock the small keys rather than opening every box. That is envelope encryption.

Envelope encryption

Encrypting large data directly with a vault key would be slow and would send huge amounts of data to the vault. Instead, services generate a data encryption key to encrypt the data quickly. They then ask the vault to wrap that data key with a key encryption key stored in the vault. The wrapped key is stored beside the data. To read the data later, the service asks the vault to unwrap the data key, then decrypts locally. Only the small key crosses to the vault, and the master key never leaves it.

sequenceDiagram
    participant S as Azure service
    participant V as Key Vault
    S->>S: Create data encryption key
    S->>S: Encrypt data with data key
    S->>V: Wrap the data key with vault key
    V-->>S: Wrapped data key
    S->>S: Store wrapped key beside data
    Note over S,V: Later, S asks V to unwrap the data key, then decrypts locally
        
FIG 8 — Envelope encryption: a fast data key protected by a vault-held master key

Customer-managed keys in Azure services

By default, Azure services encrypt data at rest with keys that Microsoft manages. Many services let you bring your own key from Key Vault or Managed HSM instead, including storage, databases, disks, backup, messaging, and analytics services. The service uses a managed identity with a narrow encryption role on your key. Benefits are control over the key lifecycle, the ability to revoke access to data by disabling the key, and meeting rules that require customer control. The cost is responsibility: if the key is deleted, disabled, or becomes unreachable, the data becomes unreadable.

Safety settings you must have

Services that use a customer-managed key usually require both soft delete and purge protection on the vault, because accidental deletion of the key would destroy the data. Even where it is not enforced, treat it as mandatory. Also protect the key from careless rotation or disablement through tight permissions and alerts on key operations.

Key rotation

Keys can rotate on a schedule defined by a policy, producing new versions. Services that use the key either follow the latest version automatically or must be told to use the new one. Rotation of the master key is cheap in envelope designs, since only wrapped data keys need re-wrapping, not the data itself. Define how often keys rotate, who is notified, and what happens to old versions, which must stay available for as long as any data depends on them.

Bring your own key and key import

Organisations that generate keys in their own hardware can import them into premium vaults or Managed HSM using a protected transfer process, so the key travels encrypted from your device to the target module. This is often called bring your own key. It satisfies rules that demand on-premises key creation, but it adds procedures and risks around the original copy, so keep records of where copies exist and who can use them.

Other uses of vault keys

Signing

Applications ask the vault to sign data, such as software packages or documents, so the signing key is never present on build machines.

Application-level encryption

An application encrypts sensitive fields, such as national identifiers, before storing them in a database, using vault operations for the wrapping step.

Secure key release

In confidential computing, a key is released only to a trusted execution environment that proves its integrity. This pattern needs premium vaults or Managed HSM and has its own, lower transaction limits.

ANTI-PATTERN-03 Avoid
Problem

A customer-managed key for production storage lives in a vault without purge protection, and many administrators can delete keys.

Why It’s Harmful

One mistaken or malicious deletion followed by a purge makes the encrypted data permanently unreadable, with no recovery.

Correct Approach

Enable soft delete and purge protection, limit delete rights to a few break-glass roles, alert on key changes, and keep a tested recovery plan.

11Certificates: Creation, Renewal, and Lifecycle

Expired certificates are among the most common and most embarrassing causes of outages. Key Vault can take over the routine work that people forget.

Simple Analogy

A certificate is like a passport: it proves identity, it has an issuing authority, and it expires. Travellers who forget the expiry date are stopped at the border. A good passport service reminds you months ahead and even renews the document for you. Key Vault is that service for certificates.

What a certificate object contains

A certificate in Key Vault is more than a file. It combines the public certificate, the private key held safely, and a policy that describes how it was made and how it should be renewed. The vault creates an addressable key and an addressable secret linked to the certificate, which lets services retrieve the full bundle when allowed, while the policy controls everything else.

Creating certificates

There are three main routes. In the first, you create a self-signed certificate inside the vault, useful for development and internal tests, though no outside party trusts it. In the second, you ask a certificate authority that is integrated with Key Vault to issue one, and the vault handles the request and the issued result. In the third, you ask any other authority, such as a company’s own, by creating a signing request in the vault, getting it signed outside, and merging the result back. You may also import an existing certificate with its key, which is common during migrations.

The policy

The certificate policy states the subject and alternative names, the key type and size, whether the key can be exported, the validity period, the content type, and what to do near expiry. Near expiry, the vault can renew automatically at a chosen percentage of lifetime or number of days before the end, or it can send an email notice to named contacts so a person acts. Automatic renewal is available for self-signed certificates and for integrated authorities. For others, plan a reminder process.

SourceWho issuesRenewalGood for
Self-signedThe vault itselfAutomaticDevelopment and internal tests
Integrated authorityA partnered public authorityAutomatic after setupPublic websites and services
Other authorityYour own or another authorityManual, with notificationsPrivate authorities and special needs
ImportedIssued elsewhereManualMigration of existing certificates
stateDiagram-v2
    [*] --> Created: Create with policy
    Created --> PendingIssue: Request sent to authority
    PendingIssue --> Active: Issued and stored
    Active --> NearExpiry: Renewal threshold reached
    NearExpiry --> Active: Auto renewed with new version
    NearExpiry --> Notified: Manual path, contacts emailed
    Notified --> Active: Person renews or merges
    Active --> Expired: Missed renewal
    Expired --> [*]
        
FIG 9 — The life of a certificate, from creation to renewal or expiry

Getting certificates to where they are used

Many Azure services can fetch certificates directly from the vault: application gateways for listener certificates, web apps for custom domains, and API management for backends. They poll for new versions, so renewal can reach them without human action. Where a service cannot, an automation reads the new version and installs it. Test this path before the first real expiry, since a renewed certificate that never reaches the load balancer is still an outage.

Private keys and exportability

Decide whether the private key can ever leave the vault. A non-exportable key is the safest, because even an authorised reader cannot take it, but then only services that use the vault for the operation can use the certificate. An exportable key allows deployment to machines but creates copies that live outside the vault. Choose per certificate based on where it must work.

Certificate hygiene

Habit

Short lifetimes

Shorter validity limits damage from theft and forces healthy automation. Public certificate lifetimes are shrinking across the industry.

Habit

Monitor expiry

Alert well before expiry, and report on every certificate that lacks an owner or a renewal path.

Habit

Name contacts

Set notification contacts to a team mailbox, not to one person who may leave.

Habit

Inventory everywhere

Find certificates outside the vault too, and bring them under management.

i
Expiry Is a Process Problem

Most certificate outages come from nobody owning the renewal. Give every certificate an owner tag, an alert, and a tested path to the service that uses it.

Handling certificates for internal and test systems

Not every certificate needs a public authority. Internal services can use certificates from a private authority that your devices trust, with policies that issue short lives and renew often. Test environments may use self-signed certificates, but keep them clearly labelled and out of production paths. Mixing them up causes puzzling errors where a browser or client refuses a certificate that works elsewhere. Keep a simple map of which authority serves which environment, and review it whenever teams create new domains.

12Data Protection: Soft Delete, Purge Protection, and Backup

Losing a key can mean losing the data it protects. Key Vault gives you several safety nets, and you should use all of them.

Simple Analogy

Deleting an item in a well-run office does not throw it into an incinerator. It goes to a recycle bin for weeks, and the incinerator door is locked so that nobody can empty the bin early. Soft delete is the recycle bin. Purge protection is the lock on the incinerator.

Soft delete

When soft delete is on, deleting a vault or an object moves it into a recoverable state rather than destroying it. During the retention period you can list deleted items and recover them with all their versions and settings. The retention period can be set between seven and ninety days, with ninety as the default. Soft delete is on by default for new vaults and cannot be switched off, so mistakes are survivable. While an object is in the deleted state, its name stays reserved, so you cannot create a new object with the same name until you recover or purge the old one.

Purge protection

Purging means permanently deleting a soft-deleted item before its retention period ends. With purge protection enabled, nobody can purge, not even an administrator, until the period expires. Once you turn purge protection on, you cannot turn it off, and the vault itself can be permanently removed only after the retention time. Many services that use customer-managed keys require it. The price is that a mistaken vault name stays reserved for the retention period, so plan naming carefully for test vaults.

ProtectionWhat it preventsCan be turned offRecommended
Soft deleteImmediate permanent loss from deletionNo, on by defaultAlways, with a sensible retention
Purge protectionEarly permanent deletion by anyoneNo, once onProduction vaults and those with customer-managed keys
Resource lockAccidental deletion of the vault resourceYes, by authorised peopleProduction vaults
BackupLoss of an object beyond retentionNot applicableCritical keys and secrets

Backup and restore of objects

Key Vault lets you back up an individual secret, key, or certificate. The backup is an encrypted blob that includes all versions. You can restore it into a vault, but with limits: the restore target must be in the same subscription and Azure geography, and the backup can be decrypted only by the Key Vault service in that scope. Backups are therefore protection against loss and a way to copy objects between vaults in the same area, not a portable export. Objects with a very large number of versions may fail to back up, so avoid unbounded version growth.

Managed HSM backup

Managed HSM supports full backup of the whole module to a storage account and restore to the same or another module, together with its security domain. The security domain, which you download when you first set up the module, is a critical recovery asset: without it, a lost module cannot be recovered. Store it in more than one safe, offline location, split among several trusted people according to the quorum you choose.

flowchart TD
    DEL[Someone deletes a key or vault] --> SD{Soft delete on}
    SD -->|Yes, always| RET[Item kept for retention period]
    RET --> PP{Purge protection on}
    PP -->|Yes| LOCK[Nobody can purge early]
    PP -->|No| RISK[An administrator could purge]
    LOCK --> REC[Recover within the period]
    RET --> REC
        
FIG 10 — Deletion flows through soft delete, and purge protection removes the shortcut to permanent loss

Recovery practice

1

Rank objects

Decide which keys and secrets are irreplaceable, rebuildable, or disposable.

2

Turn on protections

Enable purge protection, resource locks, and alerts on deletions for the vaults that hold critical items.

3

Schedule backups

Back up critical objects to protected storage in a separate subscription with tight access.

4

Guard the recovery material

Keep security domains and break-glass credentials in separate offline locations with documented custodians.

5

Rehearse

Practise recovering a deleted key and restoring a backup, and record how long it takes.

Who may delete, and how to limit it

Deletion rights deserve special care. Separate the right to create or update objects from the right to delete them, and give delete rights to very few people or to a protected automation. Resource locks stop accidental removal of the vault itself, and policy can require purge protection so nobody forgets. Add alerts on deletions so that a worrying event is seen within minutes, while the recovery window is still wide open. Together, these habits make the destructive path hard to take by accident and easy to notice on purpose.

13High Availability and Disaster Recovery

When Key Vault is unreachable, the applications and services that depend on it may stop. Plan its availability like that of any critical dependency.

What Azure provides by default

The service stores vault contents redundantly. Within a region it uses availability zones where the region supports them, so the loss of a data centre does not remove the vault. In most regions, vault data is also replicated to a paired region, and if the primary region suffers a major outage, Microsoft can fail the vault over to the paired region, where it is typically available in read-only form until the primary returns. During that time you can read secrets and use keys, but you cannot change objects. Details differ by region and can change, so check the current reliability documentation for your location.

What it means for your design

Read-only failover is good enough for many applications, which mostly read. But operations that write, such as creating new secrets, rotating, or renewing certificates, will fail during the event. Applications should cope: cache values, retry sensibly, and avoid writing to the vault in their normal paths. Remember too that failover changes where requests are served, which can briefly increase delay.

Multi-region patterns

For applications deployed in several regions, a common pattern is one vault per region, each holding the same secrets, with each regional application using its local vault. This avoids cross-region delay and keeps each region independent if another fails. The cost is keeping the copies in sync, which is done through a deployment pipeline or rotation process that writes to every vault. Keep the process simple and test that all copies stay equal.

flowchart TD
    subgraph R1[Region one]
        A1[Application] --> V1[Vault one]
    end
    subgraph R2[Region two]
        A2[Application] --> V2[Vault two]
    end
    PIPE[Deployment and rotation pipeline] --> V1
    PIPE --> V2
    V1 -.->|Platform replication to paired region| P1[Paired region copy]
    V2 -.->|Platform replication to paired region| P2[Paired region copy]
        
FIG 11 — A vault per region, updated by one pipeline, plus platform replication for disasters

Dependencies on the vault

Map who depends on each vault. Storage accounts with customer-managed keys, databases with transparent encryption keys, disks, and web gateways may all fail or lose access if a vault or key is unreachable or disabled. The more services depend on one vault, the larger the impact of an outage, which is another reason to avoid a single giant vault. Choose recovery targets that reflect this dependency, and include the vault in business continuity tests.

Recovery steps for common failures

FailureEffectResponse
Region outageVault may become read-only after failoverRely on cached values, avoid writes, wait for service recovery
Key accidentally deletedDependent services cannot decryptRecover from soft delete immediately
Network rule too strictApplications get timeouts or denialsFix endpoints and DNS or use the break-glass route
Role removedApplication gets denied errorsRestore role assignment, review change history
ThrottlingRequests rejected with too many requestsCache, back off, spread load across vaults
i
Design for Degradation

The goal is not that the vault never fails, but that your applications keep serving users with cached values when it does, and recover cleanly afterwards.

Testing your recovery assumptions

Run a drill where the primary vault is made unavailable to a test application. Observe what the application does: does it keep serving with cached values, does it retry politely, does it alert the right people, and does it recover on its own when access returns? Many teams discover that one forgotten code path reads a secret on every request, or that a start-up routine fails hard when the vault is slow. Fixing such defects in a drill costs hours, while fixing them during a real outage costs far more.

14Monitoring, Auditing, and Threat Detection

A vault without logs is a locked room without a visitors’ book. Monitoring tells you who used what, how the service is behaving, and when something looks wrong.

Audit logs

Through diagnostic settings, a vault can send audit logs to a Log Analytics workspace, a storage account, or an event hub. Each record shows the caller identity, the operation, the object, the result, the source address, and the time. These logs answer the vital questions: who read this secret yesterday, which application keeps failing to authenticate, and who changed a role. Make sure logs go to a protected place that vault administrators cannot edit, since an intruder will try to hide.

Metrics

Azure Monitor metrics for a vault include total requests, availability, latency of service API calls, and saturation, which shows how close you are to limits. Watching saturation and the count of throttled responses warns you before applications fail. Charts of requests by result code quickly show a surge of denied or failed calls.

Alerts worth having

Unusual secret reads

Alert on a sudden rise in reads, reads from unfamiliar identities or addresses, or reads outside normal hours.

Destructive operations

Alert on deletions, purge attempts, key disabling, and changes to access models or network rules.

Authorisation failures

Alert on bursts of denied requests, which may indicate a misconfiguration or someone probing.

Saturation and throttling

Alert when saturation approaches limits or when throttled responses appear, so you can cache or split load.

Expiry

Alert on objects close to expiry, using events or log queries, with a clear owner for each.

Threat detection

Microsoft Defender for Cloud offers protection for Key Vault that analyses access patterns and raises alerts for suspicious activity, such as access from unusual locations, unusual lists of many secrets, or access by identities that rarely touch the vault. Alerts appear in Defender and can flow to your security operations tools. Treat them as prompts to investigate, with the audit logs as your evidence.

flowchart LR
    KV[Key Vault] --> DS[Diagnostic settings]
    KV --> MET[Metrics]
    KV --> EG[Event Grid events]
    DS --> LA[Log Analytics workspace]
    MET --> AL[Alert rules]
    LA --> AL
    EG --> AUTO[Automation for rotation and tickets]
    KV --> DEF[Defender threat detection]
    DEF --> SOC[Security team]
    AL --> OPS[Operations team]
        
FIG 12 — Logs, metrics, events, and threat detection flow to the right teams

Reviewing access regularly

Every quarter, list who holds roles on each vault and who actually used them. Remove roles that are unused, and move people from standing access to time-limited elevation. Compare the list of identities seen in logs with the list expected; a surprise in either direction deserves a conversation. Pair the review with a check of expiry dates and of any vault that lost its private endpoint or logging.

Writing runbooks for vault alerts

An alert is only useful if the receiver knows what to do. For each alert, write a short runbook that says what the alert means, which log query to open first, who owns the vault, how to tell a harmless cause from a dangerous one, and how to escalate. For a sudden burst of secret reads, the runbook might direct the responder to list the calling identities, compare them with expected ones, and rotate the affected secrets if any caller is unknown. Review runbooks after every incident and remove steps that nobody used.

15Performance, Throttling, and Service Limits

Key Vault was designed for retrieving secrets at start-up, not for being queried like a database on every request. Understanding limits keeps applications fast and steady.

Simple Analogy

A bank counter serves each customer carefully, but if a thousand people arrive at once, the clerk says “please wait” and sends some away. Asking the vault for the same value thousands of times a second is like all those customers arriving together. The better approach is to ask once and remember the answer.

How limits work

Limits are counted per vault, per region, in windows of ten seconds, and they differ by operation. The documentation currently describes a limit of a few hundred operations per window for creating secrets and importing certificates or keys, a much higher limit of several thousand for all other transactions, and much lower limits for creating or releasing keys, especially hardware-protected ones. Limits for reading keys depend on the key type and size: larger and hardware-backed keys cost more of the budget, so you can do fewer such operations. A broader limit applies across the whole subscription in a region. Treat all numbers as examples and check the current limits page.

What throttling looks like

When a client goes over a limit, the vault answers with a “too many requests” response, commonly seen as status code 429. Requests rejected this way do not count against the budget, but the client must slow down. Good clients wait and retry with exponentially increasing pauses, and honour any hint the service gives about how long to wait. Retrying immediately makes things worse because it keeps the vault saturated.

Ways to stay under the limits

Tactic

Cache in memory

Fetch a secret once, keep it in memory, and refresh on a schedule or when it stops working.

Tactic

Cache public key material

Encrypt and verify locally using the public part, and call the vault only for private operations.

Tactic

Split by domain

Use separate vaults per application or environment so one noisy workload cannot starve others.

Tactic

Fan out

Let one process read a secret and share it with many instances in memory, rather than each instance asking.

Tactic

Stagger start-ups

Avoid restarting hundreds of instances at once, which creates a stampede of reads.

Tactic

Use envelope encryption

Protect bulk data with local data keys and call the vault only for wrapping and unwrapping.

When the limits are not enough

Very high rates of key operations may call for Managed HSM, which has its own capacity and higher throughput for certain operations such as secure key release. If you must store millions of customer keys, do not put each one in the vault. Store them encrypted in a database and keep only the master key in the vault. Also remember that some limits apply to the number of versions of an object. Very large numbers of versions can break backups and slow operations, so clean up or restructure objects that rotate very often.

flowchart TD
    REQ[Application needs a secret] --> C{In memory cache and still valid}
    C -->|Yes| USE[Use cached value]
    C -->|No| CALL[Call Key Vault]
    CALL --> R{Response}
    R -->|Success| STORE[Cache and use]
    R -->|Too many requests| WAIT[Wait with growing pauses, then retry]
    WAIT --> CALL
    R -->|Denied| FIX[Alert and check roles and network]
        
FIG 13 — A well-behaved client caches first, calls the vault sparingly, and backs off when throttled
!
Start-Up Storms

A large deployment or a cluster restart can make hundreds of instances read the same secrets at once. Plan rollouts in batches and add small random delays so the vault is not hit by a wall of requests.

Measuring before tuning

Before redesigning anything, look at the vault’s own numbers. Check requests by operation, the share of throttled responses, and the saturation metric over a busy week. Identify which application produces the most calls and whether those calls ask for the same few values. Most problems turn out to be one chatty component, not a general shortage. Fixing that one component with a cache is cheaper and safer than splitting vaults or buying dedicated hardware.

16Governance, Cost, and Managing Change

At scale, Key Vault needs rules, budgets, and a plan for change. This chapter ties together policy, cost, naming, and the migrations you should expect.

Policy as guardrails

Azure Policy turns written rules into automatic checks. Built-in definitions can require soft delete and purge protection, require RBAC authorisation, require private endpoints or disabled public access, require diagnostic logging, require expiry dates on secrets and keys, restrict key types and minimum key sizes, limit certificate validity, and require certificates from approved authorities. Policies can audit, deny, or deploy fixes automatically. Start in audit mode to learn what would be blocked, then move the important ones to deny.

Policy

Expiry on every object

Deny secrets and keys without an expiry date so rotation is always scheduled.

Policy

Network lock-down

Require private endpoints or disabled public access for production vaults.

Policy

Logging on

Deploy diagnostic settings to every vault automatically.

Policy

Strong cryptography

Set a minimum key size and approved algorithms for new keys.

Policy

Data protection

Require purge protection and a minimum soft delete retention.

Naming, tagging, and ownership

Names should reveal application, environment, and region, within the limits of vault naming rules, which require globally unique names. Tag vaults with owner, cost centre, data classification, and expiry review date. Tag objects too, with the system that uses them. Ownership matters most of all: every vault, secret, key, and certificate needs a named team accountable for rotation and removal.

How the bill is made

Standard vaults charge per ten thousand operations, with different rates for secrets, keys, and certificate operations, and extra charges for certificate renewal requests with integrated authorities. Premium vaults add a monthly charge per hardware-protected key, with lower rates for additional versions, and per-operation costs for hardware key operations. Managed HSM is billed hourly per instance, so a dedicated instance running all month is a significant fixed cost. Prices differ by region and change, so use the official pricing page and calculator.

Cost driverApplies toHow to reduce
Operation countsAll vaultsCache values, avoid polling, use events for changes
HSM-protected key countPremium vaultsUse HSM keys only where required, delete unused keys
Hourly instance chargeManaged HSMShare an instance across workloads, avoid idle test instances
Certificate renewalsIntegrated authoritiesExtend lifetimes within policy, remove unused certificates
Logs and monitoringDiagnostic settingsSend needed categories only, set retention by purpose
Private endpointsNetwork isolationShare endpoints through hub networks where design allows

Managing change and retirements

Key Vault evolves. The shift to RBAC as the default, and the retirement of older control plane API versions on the dates Microsoft has announced, are recent examples. Other changes concern tightening defaults for new vaults, new key types and algorithms, and the lifetimes of public certificates. Assign someone to follow service announcements, keep an inventory of templates and tools that touch vaults, and test them against new API versions in a non-production subscription before deadlines.

1

Discover

Find all vaults, their models, networks, tiers, and owners with resource graph queries or inventory tools.

2

Classify

Mark each vault by sensitivity and criticality, and set standards for each class.

3

Enforce

Apply policy in audit, then deny, and automate fixes where safe.

4

Measure

Report on compliance, expiring objects, unused identities, and cost by owner.

5

Improve

Review incidents and announcements each quarter and adjust standards.

!
Confirm Dates Yourself

Retirement dates and default changes are updated by Microsoft. Treat the dates in this guide as pointers and confirm them on the official announcement and documentation pages before planning.

Reviewing exceptions

Every rule needs a way out, and every way out needs a record. When a team needs public access for a vault, a longer certificate lifetime, or a secret without expiry, capture the reason, the owner, the compensating controls, and a review date. Review exceptions every quarter and close those that no longer apply. A short, visible exceptions list keeps standards honest, because it shows where reality differs from policy and who has agreed to carry the risk.

17Design Patterns, Anti-Patterns, and Best Practices

Patterns are proven answers to repeated problems. This chapter gathers the ones seen in almost every well-run estate, together with the traps to avoid and a checklist for reviews.

Helpful patterns

Pattern 1

Vault per application and environment

Each application in each environment has its own vault, which limits blast radius and keeps permissions simple.

Pattern 2

Identity instead of passwords

Managed identities and federation for every caller, and Entra authentication for targets wherever possible.

Pattern 3

Least-privilege roles at small scopes

Secrets User for reading, Crypto User for using keys, and officers for small automation or teams.

Pattern 4

Private by default

Private endpoints, public access off, trusted services only as needed.

Pattern 5

Rotation by events

Short expiry plus events that trigger automatic rotation or tickets.

Pattern 6

Cache and back off

Applications cache in memory, refresh on schedule, and retry with growing pauses.

Pattern 7

Envelope encryption

Local data keys wrapped by vault keys for bulk data, keeping calls to the vault few.

Pattern 8

Vault as code

Vaults, roles, networks, and policies defined as templates, reviewed, and deployed by pipelines.

flowchart LR
    PIPE[Pipeline with federated identity] --> KVA[Vault for app A production]
    PIPE --> KVB[Vault for app B production]
    APPA[App A managed identity] -->|Secrets User on its vault only| KVA
    APPB[App B managed identity] -->|Secrets User on its vault only| KVB
    KVA --> LOGS[Central log workspace]
    KVB --> LOGS
    POL[Policy] -->|Audit and enforce standards| KVA
    POL --> KVB
        
FIG 14 — A common landing-zone pattern: one vault per application, narrow roles, central logging, policy guardrails

More anti-patterns

ANTI-PATTERN-04 Avoid
Problem

The credential for reaching the vault is stored in the application’s configuration file or in a pipeline variable as a long-lived client secret.

Why It’s Harmful

The vault is only as safe as that one credential. If it leaks, an attacker reads everything the application can read, and rotation is rarely done.

Correct Approach

Use managed identities or workload identity federation so there is no stored credential for the vault at all.

ANTI-PATTERN-05 Avoid
Problem

The application calls the vault for every user request to fetch the same connection string.

Why It’s Harmful

Latency rises, the vault is throttled, and an outage or throttling in the vault turns directly into an outage for users.

Correct Approach

Read once, cache in memory, refresh on a schedule, and keep the last good value if a refresh fails.

ANTI-PATTERN-06 Avoid
Problem

Secrets never expire, are never rotated, and nobody knows which are still in use.

Why It’s Harmful

Leaked or forgotten credentials stay valid for years, and former staff or old systems may still hold working copies.

Correct Approach

Require expiry dates by policy, rotate by events, tag owners, and delete unused objects.

Common mistakes and their fixes

MistakeWhat happensBetter habit
Letting templates choose the access model by defaultNew vaults surprise teams with denied requestsSet the model explicitly in every template
Switching to RBAC before creating role assignmentsApplications lose access instantlyCreate assignments first, then switch
Disabling public access before DNS worksTools and applications time outTest the private path first
Skipping purge protection for key vaultsOne deletion can destroy dataEnable purge protection and soft delete
Using plain secrets for certificatesNo renewal, surprise expiriesUse certificate objects and policies
Logging secret valuesSecrets spread to log storesNever log values, scan logs and code
Giving broad roles at the subscriptionOne compromise reaches every vaultAssign roles at vault or object scope
No alerts on deletes or role changesDamage found too lateAlert on destructive and permission operations

A pre-launch checklist

1

Foundation

Confirm tier, region, naming, tags, owner, and the explicit access model.

2

Identity and access

Confirm managed identities, narrow roles at small scopes, and time-limited elevation for people.

3

Network

Confirm private endpoints, DNS, disabled public access, and tested break-glass access.

4

Protection and recovery

Confirm soft delete, purge protection, locks, backups, and a rehearsed recovery.

5

Operations

Confirm logs, alerts, expiry events, cache behaviour, limits, policy, and cost reporting.

18Advantages and Trade-offs

Every service has strengths and costs. Here is an honest look at what Key Vault gives you and what it asks in return.

Advantages

  • One controlled home for secrets, keys, and certificates, replacing scattered copies
  • Strong identity checks through Microsoft Entra ID, including managed identities with no stored credentials
  • Detailed audit logs and integration with monitoring and threat detection
  • Hardware-protected keys in premium vaults and dedicated Managed HSM
  • Versioning, soft delete, purge protection, and rotation support that make mistakes survivable
  • Deep integration with Azure services for customer-managed encryption and certificates
  • Low cost for ordinary use in standard vaults

Disadvantages / Trade-offs

  • Transaction limits and throttling require caching and careful design
  • It becomes a critical dependency: when it is unreachable, dependent services may fail
  • Private networking needs endpoints and correct name resolution
  • Purge protection cannot be undone, and deleted names are reserved for the retention period
  • Backups are not portable across subscriptions or geographies
  • Managed HSM brings strong control but a high fixed cost and serious recovery duties
  • Platform changes, such as the access model default and API retirements, require ongoing attention

When Key Vault is the right fit

It is the natural choice when your workloads run on Azure, when you want one audited home for sensitive items, and when you want Azure services to use your own keys. It also fits hybrid cases through Azure Arc and applications elsewhere that can authenticate with Entra identities or federation. For most teams, a standard vault per application and environment is the sensible start.

When to think twice

If you must keep millions of per-customer secrets, a vault is not the right database. If your estate spans several clouds and you already run another secrets platform, think about which platform is the source of truth, to avoid duplicate copies and split audit trails. If a team needs only a feature flag or a non-sensitive setting, an application configuration service is the better home, with the vault holding only references to real secrets.

Fewer secrets
prefer identities over stored passwords
Small blast radius
a vault per application and environment
Always recoverable
soft delete, purge protection, and tested restores

Comparing with other approaches

Some teams keep secrets in files encrypted with a tool and stored in the repository. This is cheap and portable, but the encryption key itself needs a home, rotation is manual, and auditing is weak. Others run an open-source secrets platform on their own servers, gaining flexibility but taking on upgrades, availability, and unsealing procedures. Cloud-native vaults from other providers offer similar features inside their own clouds. Key Vault stands out for its tight integration with Azure identity, policy, networking, and services that use customer-managed keys, which is why it is the default choice for Azure-centred estates.

19Real-World Scenarios

These short stories show how the concepts fit together in situations you may recognise.

Scenario 1: A web shop removes passwords from its code

A web shop keeps its database password in a configuration file in the repository. The team creates a vault, grants the web app’s managed identity the Secrets User role on that vault, and replaces the setting with a reference that the hosting platform resolves. They then move the database to Entra authentication and delete the password. The repository is scanned, and the old password is rotated because it was once exposed in history.

Scenario 2: A bank encrypts data with its own keys

A bank must hold the keys protecting customer data. It uses a premium vault with hardware-protected keys, one vault per data domain, soft delete and purge protection, and private endpoints with public access disabled. Storage and database services use managed identities holding only the encryption-user role. Alerts watch any change to keys, and a quarterly drill proves that a deleted key can be recovered in minutes.

Scenario 3: A certificate outage that never happens

A company once lost its main website for hours because a certificate expired. It moves all certificates into the vault with policies that renew thirty days before expiry through an integrated authority. The application gateway fetches new versions automatically. Alerts also warn on any certificate that has no renewal path, and each certificate has an owner tag and a team mailbox as contact.

Scenario 4: A start-up storm

After a regional maintenance event, a cluster of five hundred containers restarts at once and every container reads twenty secrets. The vault throttles, and containers fail to start. The team adds caching, reads secrets through a shared sidecar, staggers restarts in batches, and adds retries with growing pauses. The next restart finishes smoothly.

Scenario 5: Preparing for the access model change

A platform team inventories its infrastructure templates and finds that dozens create vaults without stating an access model. Before the new default affects them, it updates templates to declare RBAC explicitly, creates role assignments for each application identity, migrates old vaults one by one during quiet periods, and updates pinned API versions well before the announced retirement date.

Scenario 6: A leaked pipeline token

A build pipeline’s token is exposed in a public log. Because the pipeline used federation and a narrow role on a single deployment vault, the exposed token expires quickly and can read only deployment secrets. Audit logs show exactly which secrets were read, so the team rotates those and no others. The incident closes in an afternoon rather than a week.

flowchart TD
    N[Need arises] --> T{Type of need}
    T -->|Remove passwords from code| A[Managed identity, Secrets User role, platform references]
    T -->|Control encryption keys| B[Premium vault or Managed HSM with purge protection]
    T -->|Avoid certificate outages| C[Certificate objects with auto renewal and alerts]
    T -->|Handle heavy read traffic| D[Caching, back-off, vault per workload]
    T -->|Meet strict network rules| E[Private endpoints and disabled public access]
    A --> G[Review roles, logs, and expiry regularly]
    B --> G
    C --> G
    D --> G
    E --> G
        
FIG 15 — Different needs lead to different designs, all improved by regular review

What these stories have in common

In every scenario, success came from decisions made early and boring habits kept over time. Teams that used identities instead of passwords had nothing to leak. Teams that gave each application its own vault and narrow role kept incidents small. Teams that cached and backed off survived busy moments. Teams that rehearsed recovery found gaps while they were cheap to fix. None of this needed exotic technology, only clear ownership, sensible defaults, and regular review.

20Frequently Asked Questions

Short, direct answers to questions that beginners and busy teams often ask.

Q1What is the difference between a secret, a key, and a certificate?

A secret is a value your application reads, such as a password. A key is a cryptographic key that stays in the vault while it performs operations. A certificate bundles a public certificate, its key, and a renewal policy.

Q2What is the difference between a vault and Managed HSM?

A vault is a shared service that holds secrets, keys, and certificates. Managed HSM is a dedicated, single-tenant pool of hardware modules that holds only hardware-protected keys, with its own access control and higher fixed cost.

Q3Standard or premium?

Standard stores keys protected by software and suits most needs. Premium adds hardware-protected keys for rules that require them. Both hold secrets and certificates.

Q4Should I use RBAC or access policies?

Use Azure RBAC. It is the modern model, offers finer scopes and better auditing, and has become the default for newly created vaults under the newest API version. Existing vaults keep their current model until you change it.

Q5Why does my new vault deny my application even though it worked before?

The new vault may use RBAC by default, so the application’s identity needs a role such as Secrets User on the vault. Access policies from an old vault do not carry over.

Q6How do I let an application read secrets without a password?

Give the application a managed identity, assign it the Secrets User role on the vault, and have it request tokens from the platform. No stored credential is needed.

Q7What do soft delete and purge protection do?

Soft delete keeps deleted vaults and objects recoverable for a retention period of seven to ninety days. Purge protection stops anyone from permanently deleting them early. Once purge protection is on, it cannot be turned off.

Q8Can I reuse the name of a deleted vault?

Not while it is in the soft-deleted state, because the name stays reserved. Recover it, or wait until the retention period ends if purge protection is on.

Q9How do I rotate a secret safely?

Create the new credential in the target, store it as a new version, let applications reload it, and retire the old credential after a grace period. Events can automate the steps.

Q10Why am I getting too many requests errors?

You are exceeding the vault’s per-window limits. Cache values in memory, spread load across vaults, stagger start-ups, and retry with growing pauses.

Q11Can I keep the vault off the public internet?

Yes. Use a private endpoint with correct private DNS and disable public network access. Test the private path before turning public access off.

Q12Do Azure services use my keys directly?

They use envelope encryption. The service encrypts data with its own data key and asks the vault to wrap that key with your key, so only small keys travel to the vault.

Q13What happens if my vault’s region fails?

In most regions, the vault can fail over to a paired region, usually in read-only mode, so reads and cryptographic operations continue while changes wait. Applications should cache values and avoid writes in normal paths.

Q14Can I move a backup to another subscription or geography?

Object backups restore only within the same subscription and Azure geography. Plan copies and recovery with that limit in mind.

Q15How do I keep costs down?

Cache to reduce operations, use hardware-protected keys only where required, share Managed HSM instances across workloads, delete unused objects, and send only needed log categories.

Q16How do I know who read a secret?

Enable diagnostic settings so audit logs flow to a protected workspace. Each record shows the caller, the object, the operation, the result, and the time.

21Summary and Key Takeaways

Azure Key Vault is the strong room for your applications. It keeps secrets, keys, and certificates in one place, checks every caller through Microsoft Entra ID, and records every use. A good design chooses the right tier and object type, gives each application its own vault and a narrow role through a managed identity, keeps the vault private, and uses envelope encryption so that precious keys stay inside. It protects against mistakes with soft delete, purge protection, locks, and tested recovery, plans for throttling and regional failure through caching and independent vaults, and watches the service with logs, alerts, and threat detection. It also keeps pace with change, such as the move of newly created vaults to Azure RBAC and the retirement of older API versions, while governance, policy, and cost reviews keep everything orderly.

Key Takeaways

  • Use the right object — secrets for values the application must read, keys for operations that should keep the key inside, and certificates for identity with managed renewal.
  • Choose protection by risk — standard vaults for most needs, premium for hardware-protected keys, and Managed HSM for dedicated control and heavy key use.
  • Prefer identities to passwords — managed identities and federation remove the first-secret problem, and Azure RBAC with narrow roles replaces broad access.
  • Close the doors — private endpoints, disabled public access, and tested break-glass routes add a second wall behind permissions.
  • Make mistakes survivable — soft delete, purge protection, locks, backups, and rehearsed recovery protect keys and the data they guard.
  • Design for limits and failure — cache, back off, split vaults by workload, and cope with read-only failover.
  • Govern and follow change — policy, ownership, expiry dates, audit logs, and attention to announcements such as the new RBAC default and API retirements, confirming dates on official pages.