Skip to main content
emnode
Compliance

Put Azure Key Vault behind a private network

One capability across every vault in the estate: make sure the store that holds your secrets, keys and certificates is not reachable from the public internet, and that the only paths to it are a private endpoint or a tightly scoped firewall, unless you genuinely intend otherwise.

14 min·10 sections·AZURE

Last reviewed

Remediates Microsoft Defender for Cloud: azure-keyvault-firewall-enabledazure-keyvault-private-link

Key Vault network hardening: the basics

What does a publicly reachable Key Vault actually look like?

Key Vault is the most concentrated trust object in an Azure subscription: it holds the secrets, keys and certificates that unlock everything else. By default a vault has a public endpoint that answers from anywhere on the internet, and the protection sitting in front of it shows up as two distinct shapes rather than one setting. The first is network access control: the vault firewall can be left open so its 'networkAcls.defaultAction' is Allow and any address can reach the data plane, instead of Deny with a private endpoint or a known set of addresses. The second is whether the public endpoint exists at all: 'publicNetworkAccess' can be left Enabled when the workload only ever needs private connectivity. Each is its own Defender for Cloud recommendation, but the underlying risk is the same: the store of your secrets is reachable by more of the internet than you meant.

Microsoft Defender for Cloud turns each of these into its own recommendation, which is why one secret-heavy subscription can fail several Key Vault network checks at once. 'Azure Key Vaults should use private link' wants every vault fronted by a private endpoint so traffic never leaves the Microsoft backbone, and 'Azure Key Vault should have firewall enabled or public network access disabled' wants the public door either firewalled down to allowed sources or closed entirely. They read as separate problems on the report, but they are one job: take the vault off the open internet and put the only paths to it under your control.

Most of this exposure is drift, not intent. A vault created from a quickstart that never set a firewall, a module that left 'publicNetworkAccess' on its Enabled default, a 'defaultAction' of Allow that a quick test needed and nobody tightened again. The work is to find every vault that is reachable more widely than intended, decide which handful genuinely need a controlled public path, route the rest through a private endpoint, and switch the public endpoint to Deny or Disabled so the secret store stops answering the open internet.

In this lesson you will learn how Azure Key Vault expresses public reachability through its firewall and public-network-access settings, how to find every over-exposed vault in a subscription, and how to lock them down with a private endpoint without breaking the services that legitimately read from them. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.

Fun fact

The vault is the skeleton key

In real-world cloud breaches the secret store is rarely the first thing an attacker touches, but it is almost always the thing they want. A leaked deployment token or an over-permissive identity is the way in; the vault is the prize, because one reachable vault can hand over the credentials for databases, storage and partner integrations in a single read. That is why network hardening matters even when access policies look tight: a vault that still answers the public internet leaves the door reachable for any credential that leaks later. Putting the vault behind a private endpoint means a stolen secret is not enough on its own, because the attacker also has to be inside your network to use it.

Finding exposed vaults across a subscription

Priya is the security lead at a fintech preparing for a SOC 2 Type II audit. Defender for Cloud shows Key Vault network findings spread across nine vaults in three subscriptions that pre-date the team's current platform guardrails.

Rather than work the findings one by one, Priya starts by listing which vaults still have an open firewall and which still expose a public endpoint, so the vaults that genuinely need a controlled public path can be separated from drift before anything changes.

Start by listing every vault with its firewall default action and whether its public endpoint is still on. Allow plus Enabled is the widest-open shape.

$ az keyvault list --query "[].{name:name, default:properties.networkAcls.defaultAction, public:properties.publicNetworkAccess}" -o table
Name Default Public
---------------- --------- --------
kv-payments-prod Allow Enabled
kv-shared-build Deny Enabled
# kv-payments-prod has an open firewall AND a live public endpoint. Close it first.

A production vault whose firewall defaults to Allow and whose public endpoint is still Enabled is the highest-value target in this group. Fix these first.

How Defender for Cloud decides a vault is exposeddeep dive

The Key Vault network recommendations resolve to two related properties on the vault. The first is the network rule set, 'properties.networkAcls': when its 'defaultAction' is Allow, the public endpoint answers from any network rather than only from the IP ranges and virtual-network subnets you list. Set it to Deny, add the sources that need in, and optionally set 'bypass' to AzureServices so trusted first-party services can still reach the vault. The second is 'properties.publicNetworkAccess': when it is Enabled, a public endpoint exists at all; set it to Disabled and the vault answers only over a private endpoint, regardless of any firewall rule. The 'Azure Key Vault should have firewall enabled or public network access disabled' recommendation passes when either of those doors is shut, and 'Azure Key Vaults should use private link' passes when an approved private endpoint connection exists.

It is worth being precise about how these two settings interact, because it is a common source of confusion. 'publicNetworkAccess' takes precedence over the firewall: if it is Disabled, the vault ignores the network ACL rules entirely and is reachable only through private endpoints. If it is Enabled, the public endpoint exists and the 'defaultAction' decides who that endpoint answers. The strongest posture for a vault that does not need any public reachability is private endpoint plus 'publicNetworkAccess' Disabled; for a vault that genuinely needs a scoped public path it is 'defaultAction' Deny with an explicit allow list and 'bypass' set to AzureServices. Note that disabling public access does not remove the vault's public DNS record, which stays resolvable by design; the data-plane connection is what is blocked.

Defender for Cloud evaluates these against the Microsoft Cloud Security Benchmark, where both recommendations sit under control NS-2, on a periodic cycle, so a fix does not flip the recommendation to Healthy instantly. The control-plane change itself is immediate, but the posture catches up on the next assessment. The strongest position pairs the per-vault setting with an Azure Policy backstop: the built-in 'Azure Key Vaults should use private link' definition and the firewall-or-public-access definition can be assigned in audit or deny mode so no new vault can be created on the open internet again. Turning those on is the difference between checking that nothing is exposed today and guaranteeing that nothing can be exposed tomorrow.

What is the impact of leaving a vault on the open internet?

The direct impact is the worst kind of data exposure, because the data in a vault is the credentials for other data. A vault reachable on an open public endpoint is one leaked token, one over-permissive identity or one stolen access policy away from handing an attacker the connection strings, signing keys and certificates it holds. Network access policy is not the only line of defence, but it is the one that decides whether a credential that leaks elsewhere can be used at all: a stolen secret is far less dangerous when the vault that issued it answers only inside your network. The majority of these exposures were accidents, a firewall left at its Allow default or a public endpoint a module never closed.

The second-order impact is blast radius and recovery cost. A compromised vault does not just leak its own contents; it forces rotation of every secret, key and certificate it held, across every service that trusted them, which is a slow and error-prone scramble under incident pressure. Putting vaults behind a private endpoint shrinks the attack surface to the network you already defend, so a leaked credential has to be paired with network access before it is worth anything.

On the compliance side, every modern framework, ISO 27001, SOC 2, HIPAA, PCI DSS and the UK and EU data-protection regimes, expects evidence that key material is held in a hardware-backed store with controlled access, and a vault answering the open internet undercuts that story regardless of how tight the access policies look. A passing set of Key Vault network recommendations across every subscription, backed by private link, is one of the cheapest and most defensible artefacts you can hand an auditor.

How do you put a vault behind a private network safely?

Work the capability as one loop rather than chasing individual findings. The order matters: stand up the private endpoint and confirm services can still reach the vault through it before you close the public door, so you do not lock out a live workload.

1. Inventory every vault by exposure

List the vaults whose firewall default action is Allow, whose public network access is still Enabled, and which have no private endpoint connection. Treat this inventory as the source of truth, not the Defender finding count, because one vault can trigger several recommendations at once.

2. Separate vaults that need a public path from drift

Most exposure is unintended. For each vault, decide whether anything genuinely needs to reach it from outside your virtual networks, such as a hosted CI runner or a SaaS integration on a fixed address range. Those become firewalled exceptions scoped to the smallest allow list possible. Everything else is drift and can move fully private.

3. Stand up the private endpoint, then close the public door

Create a private endpoint with group id 'vault' in the subnet your services use, link the 'privatelink.vaultcore.azure.net' private DNS zone to the virtual network so the vault name resolves to the private IP, and confirm a dependent service can still read a secret. Only then set the firewall default action to Deny, set bypass to AzureServices for trusted first-party callers, and for vaults that need no public path at all set public network access to Disabled. Each change is a single command per vault and takes effect immediately.

4. Ratchet it shut with Azure Policy

Assign the built-in 'Azure Key Vaults should use private link' definition and the firewall-or-public-access definition in audit, then deny, so no new vault can be created on the open internet again. This makes the safe configuration enforced rather than merely encouraged, and turns the next over-exposed vault into a deployment that simply will not provision.

# Put a production vault behind a private endpoint, then close its public door.
VAULT=kv-payments-prod
RG=rg-payments
SUBNET=/subscriptions/<sub>/resourceGroups/rg-net/providers/Microsoft.Network/virtualNetworks/vnet-prod/subnets/snet-data

# 1. Create the private endpoint (group-id 'vault') in the workload subnet.
az network private-endpoint create \
  --name pe-$VAULT --resource-group $RG \
  --vnet-name vnet-prod --subnet snet-data \
  --private-connection-resource-id $(az keyvault show -n $VAULT --query id -o tsv) \
  --group-id vault --connection-name conn-$VAULT

# 2. Link the private DNS zone so the vault name resolves to the private IP.
#    (privatelink.vaultcore.azure.net linked to vnet-prod, A record from the PE)

# 3. Once a dependent service can still read a secret over the PE, close the door.
az keyvault update --name $VAULT --resource-group $RG \
  --default-action Deny --bypass AzureServices \
  --public-network-access Disabled
echo "$VAULT: private endpoint live, firewall Deny, public network access disabled"

# Ratchet it shut: audit every vault for private link across the subscription.
az policy assignment create \
  --name audit-kv-private-link \
  --policy a6abeaec-4d90-4a02-805f-6b26c4d3fbe9 \
  --scope "/subscriptions/00000000-0000-0000-0000-000000000000"

Quick quiz

Question 1 of 5

Defender for Cloud shows Key Vault findings across private link, firewall and public network access on several vaults. What is the most efficient way to think about them?

You can now treat Key Vault network hardening as one capability rather than a scatter of findings: inventory which vaults are reachable too widely, separate the few that genuinely need a public path and firewall them down, move the rest onto a private endpoint and close the public door, and ratchet the estate shut with Azure Policy. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.

Back to the library

Controls this lesson covers

One capability, many Microsoft Defender for Cloud recommendations. This lesson is the shared playbook; each control below keeps its own deep page with the exact check, severity and a copy-and-paste fix.