Automating TLS certificates with Let’s Encrypt and Azure Key Vault is a solved problem. Azure Acmebot makes the deployment very simple.
In corporate environments targeting ISO 27001, KRITIS, or NIS2 compliance, simple is rarely enough. The standard Acmebot deployment relies on public endpoints, and in a hardened environment a Storage Account or Key Vault reachable from the public internet triggers audit findings no matter how strong your authentication is.
Below is the move from a standard Acmebot deployment to a network-isolated, Zero-Trust architecture, managed entirely with Terraform.
Update (November 2026): Upstream Acmebot (the repo now lives at polymind-inc/acmebot) deploys to a Flex Consumption plan on Linux. The Terraform below targets a Windows Function App (
azurerm_windows_function_app) on a Premium or Dedicated App Service plan; the Windows Consumption plan has no VNet integration at all. On Flex Consumption the pattern still holds, but the function app resource isazurerm_function_app_flex_consumptionand the integration subnet must be delegated toMicrosoft.App/environmentsinstead ofMicrosoft.Web/serverFarms.
View the standard deployment source code on GitHub
The Compliance Gap
🇩🇪 Deutsch: This article is also available in German: Acmebot härten für ISO 27001 & NIS2: Zero-Trust-Zertifikate in Azure →.
The default serverless architecture is optimized for ease of access, not isolation. Three components expose a public attack surface out of the box:
- Storage Account: The Function App requires a Storage Account for state and web job management. By default, it accepts traffic from all networks.
- Key Vault: The certificate store operates with a public endpoint unless explicitly restricted.
- Function App: The Acmebot dashboard and its HTTP API are publicly reachable, protected by App Service Authentication but with no network-layer restriction.
Any serious compliance framework requires inverting this model. The target principle: Default-Deny at the network layer, in addition to the identity layer.
Target Architecture
Three controls replace public internet routing with Azure’s internal backbone:
- VNet Integration: The Function App is injected into a dedicated, delegated subnet. All outbound traffic originates from within your Virtual Network.
- Azure Private Link: Storage Account and Key Vault receive private IP addresses inside the VNet via Private Endpoints. Their public endpoints are disabled entirely.
- Private DNS Zones:
privatelink.*zones linked to the VNet make the Function App resolve*.blob.core.windows.netand*.vault.azure.netto private IPs instead of public ones.
These controls lock down outbound traffic and the data plane. The Function App’s own inbound endpoint (the dashboard) needs a separate Private Endpoint or access restrictions on top; the code below doesn’t cover that part.
Step 1: VNet Integration
The Function App needs a dedicated subnet with a delegation to Microsoft.Web/serverFarms.
A /27 is enough for this workload and doesn’t waste address space.
resource "azurerm_subnet" "acmebot_integration" {
name = "snet-acmebot-integration"
resource_group_name = var.existing_vnet_rg
virtual_network_name = var.existing_vnet_name
address_prefixes = ["10.0.1.0/27"]
delegation {
name = "delegation-acmebot"
service_delegation {
name = "Microsoft.Web/serverFarms"
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
service_endpoints = ["Microsoft.Storage", "Microsoft.KeyVault"]
}
resource "azurerm_windows_function_app" "acmebot" {
# ... other configuration ...
virtual_network_subnet_id = azurerm_subnet.acmebot_integration.id
site_config {
vnet_route_all_enabled = true
}
app_settings = {
"WEBSITE_VNET_ROUTE_ALL" = "1"
"WEBSITE_DNS_SERVER" = "168.63.129.16" # Azure internal DNS - required
"WEBSITE_CONTENTOVERVNET" = "1"
}
}
Two details cost hours if you miss them. vnet_route_all_enabled = true forces all outbound
traffic through the VNet; without it, some of the Function’s traffic still takes the public
path and fails without a clear error once Storage is locked down.
WEBSITE_DNS_SERVER = 168.63.129.16 pins name resolution to Azure’s internal resolver, which
answers from the Private DNS Zones linked to the VNet. An integrated app inherits the VNet’s
DNS settings anyway, so this matters most when the VNet points at custom DNS servers that
don’t forward the privatelink zones.
Step 2: Private Endpoints & DNS
This is where most engineers lose time. Private Endpoints alone are not enough. You also
need Private DNS Zones linked to your VNet; otherwise the Function App still resolves the
public IP of the Storage Account and gets blocked by the rules from Step 3. The endpoints
go into their own subnet (acmebot_endpoints), because a subnet delegated to
Microsoft.Web/serverFarms can’t host Private Endpoints.
# One Private Endpoint per Storage subresource
resource "azurerm_private_endpoint" "storage_pe" {
for_each = toset(["blob", "table", "queue", "file"])
name = "pe-acmebot-st-${each.key}"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
subnet_id = azurerm_subnet.acmebot_endpoints.id
private_service_connection {
name = "psc-acmebot-st-${each.key}"
private_connection_resource_id = azurerm_storage_account.acmebot_storage.id
subresource_names = [each.key]
is_manual_connection = false
}
private_dns_zone_group {
name = "default"
private_dns_zone_ids = [var.private_dns_zone_ids[each.key]]
}
}
# Key Vault Private Endpoint
resource "azurerm_private_endpoint" "kv_pe" {
name = "pe-acmebot-kv"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
subnet_id = azurerm_subnet.acmebot_endpoints.id
private_service_connection {
name = "psc-acmebot-kv"
private_connection_resource_id = azurerm_key_vault.acmebot_kv.id
subresource_names = ["vault"]
is_manual_connection = false
}
private_dns_zone_group {
name = "default"
private_dns_zone_ids = [var.private_dns_zone_ids["vault"]]
}
}
The Storage Account needs four separate Private Endpoints, one each for blob, table,
queue, and file. Acmebot’s Functions runtime uses all four subresources. Skip one and
the Function App deploys fine, then fails at runtime with cryptic storage errors.
Step 3: Default-Deny Firewall Rules
With private routing in place, network-layer isolation can be enforced. Both the Storage Account and Key Vault get public network access disabled. The default-deny network rules with a narrow exception for the integration subnet are a second layer, in case someone re-enables public access later.
resource "azurerm_storage_account" "acmebot_storage" {
# ... other configuration ...
public_network_access_enabled = false
allow_nested_items_to_be_public = false
network_rules {
default_action = "Deny"
bypass = ["AzureServices"]
virtual_network_subnet_ids = [azurerm_subnet.acmebot_integration.id]
}
}
resource "azurerm_key_vault" "acmebot_kv" {
# ... other configuration ...
public_network_access_enabled = false
enable_rbac_authorization = true
network_acls {
default_action = "Deny"
bypass = "AzureServices"
virtual_network_subnet_ids = [azurerm_subnet.acmebot_integration.id]
}
}
bypass = "AzureServices" lets trusted Microsoft services through the network rules.
Which platform features depend on it varies by service, so test diagnostic settings and
backups after the change instead of assuming they still work.
At this point, neither resource accepts traffic from the internet. From outside, the public FQDNs still resolve to Azure’s shared frontend, but every request is rejected with a 403 because public network access is disabled, before authentication even comes into play.
The Result
After this change, the Acmebot deployment covers the network-isolation controls auditors check under ISO 27001:2022 Annex A (8.20 network security, 8.22 segregation of networks), NIS2 Article 21, and KRITIS baselines:
- No public access on any data-plane resource
- All inter-service traffic stays on Azure’s private backbone
- Identity-based access (Managed Identity + RBAC) on top of the network controls
- Everything in Terraform: auditable, repeatable, version-controlled
How these controls fit into the full set of Article 21 obligations is covered in implementing NIS2 Article 21 in Azure.
If the network-security side of this (not just the Terraform) is what’s new, Netzwerke: Verstehen, Einrichten, Administrieren* is the reference I’d point at.
I run this same checklist during every hardening pass. Grab the ISO 27001 Auditor Checklist PDF if you want it for your own audits.