Part 3: Three Shared-Storage Designs in Two Weeks, and the Brownfield Firewall Bug Hiding Underneath

 

The Storage Architecture Dilemma: Pivoting from ANF to Azure Files NFS


1. Picking Up Where We Left Off

At the end of Part 2, our Control Plane was in good shape. The Ubuntu Deployer ran Terraform and Ansible with no friction, the User-Assigned Managed Identity held only the least-privilege roles it needed, and Azure Bastion tunnels gave operators access without exposing a single public IP. The Deployer VNet (10.x.100.0/25) was peered to the vendor's brownfield workload network.

That gave us a way to reach the SAP virtual machines. It didn't give them anywhere to share files.

In Part 1 we summed up shared storage as Gotcha #3: Azure NetApp Files (ANF) wasn't available, so we set NFS_provider = "AFS" and moved on. That's an accurate summary of where we ended up. It skips over how we got there. Between 29 December 2025 and 14 January 2026 we went through three shared-storage architectures, raised a change request against the vendor's landing-zone code, hit two Ansible mount bugs, and only weeks later found a Terraform bug in SDAF's own storage module that quietly locked our HANA server out of its NFS shares.

This article walks through that sequence and explains the reasoning behind each decision.

The Storage Pivot: ANF to VM-hosted NFS to Azure Files Premium NFS 4.1
The Storage Pivot: ANF to VM-hosted NFS to Azure Files Premium NFS 4.1
Figure 1: The decision timeline (top) and the final Azure Files Premium NFS 4.1 architecture for system D01 (bottom), including the brownfield storage-ACL bug. Also available in high-resolution PNG format.


2. Why SAP Needs Shared POSIX Filesystems

A distributed SAP NetWeaver / S/4HANA system isn't a set of independent servers. Several directories have to be identical and writable across hosts, with POSIX semantics (UID/GID ownership, file locking, symbolic links):

Mount PointPurposeWho Mounts ItConsequence If Missing
/sapmnt/<SID>SAP kernel executables, instance profiles, global configuration (DEFAULT.PFL)ASCS, ERS, PAS, AASInstances can't start; SWPM aborts at the profile phase
/usr/sap/transTransport Management System (TMS) directory: cofiles, data files, logsAll application servers in the transport domainTransports can't be imported or released between DEV → QAS → PRD
/usr/sap/installStaged SAP installation media (SWPM, kernel, HANA, export DVDs)Every host that runs an installerAnsible playbooks 03–07 can't find media
/hana/sharedHANA binaries and trace/config for scale-outHANA nodes (shared only in scale-out / HSR setups)Scale-out nodes can't join the landscape

For SDAF, this is more than documentation. The Ansible role roles-sap-os/2.6-sap-mounts reads three required parameters from sap-parameters.yaml: sap_mnt, sap_trans, and usr_sap_install_mountpoint. It mounts them according to the NFS_provider value (ANF, AFS, or NONE). Without a working NFS provider, the 8-stage installation pipeline (covered in Part 6) stops at stage 02.

NOTE

What does not belong on NFS here: HANA's performance-critical /hana/data and /hana/log volumes. On Azure these go on Premium SSD (with Write Accelerator on M-series) or ANF. Azure Files NFS is not a supported target for HANA data/log. In our single-node DEV system they stayed on striped Premium SSD managed disks, which is the subject of Part 7.


3. The Surprise Roadblock: indonesiacentral Has No ANF

The original blueprint was the standard SAP-on-Azure reference design: Azure NetApp Files for every shared volume. ANF gives sub-millisecond latency, snapshots, cross-zone replication, and first-class SDAF support (NFS_provider = "ANF").

On 29 December 2025, the first attempt to create a NetApp account failed immediately:

text
The provided location 'indonesiacentral' is not available for resource type
'Microsoft.NetApp/netAppAccounts'

This wasn't a quota we could request an increase for. The resource provider wasn't deployed in the region at all. indonesiacentral is one of Azure's newer regions, and service availability arrives there in waves. The error listed the nearest ANF regions:

Nearest ANF RegionApprox. DistanceImplication
southeastasia (Singapore)~900 kmLowest latency option, but cross-region
eastasia (Hong Kong)~3,300 kmUnsuitable
australiaeast (Sydney)~5,700 kmUnsuitable

Why "just use Singapore" was rejected

Mounting /sapmnt across a region boundary would have:

  1. Added WAN round-trip latency to every file operation. That includes sapstartsrv reading profiles, work processes writing to /usr/sap/trans, and SWPM extracting thousands of small files.
  2. Added cross-region data-transfer charges for every byte of media and transport traffic.
  3. Undermined the reason for deploying in indonesiacentral in the first place. That decision was about data residency and latency to Indonesian users.

Why waiting was rejected

There was no published date for ANF in the region. Holding the SAP build for an unknown hardware rollout would have blocked the Ansible pipeline, the BOM media staging (Part 5), and everything downstream. The project needed shared storage this week, not at some unannounced point in the future.


4. Detour #1: The VM-Hosted NFS Server (NFS_provider = NONE)

Our first fallback, decided the same day (STORAGE_DECISION.md), was the cheapest and fastest option we could think of:

  • DEV/QAS: Turn the existing application server (erpdevapp1) into an NFS server using local LVM volumes (/dev/vg_sap/lv_sapmnt, /dev/vg_sap/lv_usrsapinstall).
  • Production (planned): A self-built two-node NFS HA cluster (Pacemaker + DRBD + Azure Standard Load Balancer + Azure Fence Agent) across Availability Zones 1 and 3.

The cost comparison at the time made the custom cluster look attractive:

OptionEst. Monthly CostSetup EffortHARegion
ANF (cross-region, southeastasia)~$3,000~2 hours✅Singapore
Azure Files Premium NFS~$300–350~2 hours✅ (ZRS)indonesiacentral
Custom Pacemaker/DRBD NFS cluster~$4002–3 days + ongoing ops✅indonesiacentral

The DEV exports were simple enough:

text
# /etc/exports on erpdevapp1 (10.x.1.x)
/export/sapmnt 10.x.1.0/24(rw,no_root_squash,sync,no_subtree_check)
/export/saptrans 10.x.1.0/24(rw,no_root_squash,sync,no_subtree_check)
/usr/sap/install *(rw,sync,no_wdelay,no_root_squash)

It ran into problems within 24 hours.

Bug A: Misnamed and missing SDAF parameters

Microsoft's SDAF documentation lists three mandatory NFS parameters. Our first sap-parameters.yaml had one right, one misnamed, and one missing:

yaml
# BEFORE # AFTER
NFS_provider: NONE NFS_provider: NONE
sap_mnt: 10.x.1.x:/export/sapmnt sap_mnt: 10.x.1.x:/export/sapmnt
sap_transport: 10.x.1.x:/export/saptrans sap_trans: 10.x.1.x:/export/saptrans # renamed
usr_sap_install_mountpoint: 10.x.1.x:/usr/sap/install # added

SDAF doesn't validate unknown keys, so sap_transport was silently ignored. Nothing failed at parse time. The playbooks just behaved as if no transport share existed.

Bug B: The NFS server trying to mount itself

With the parameters fixed and defined globally in the Ansible inventory, Playbook 02 failed on the NFS server itself:

text
TASK [roles-sap-os/2.6-sap-mounts : 2.6.0 AFS Mounts - sap_mnt (preparation)] ***
fatal: [erpdevapp1]: FAILED! =>
msg: Error mounting /saptmp: mount.nfs4: Operation not permitted
for 10.x.1.x:/export/sapmnt on /saptmp

The cause is in how the 2.6-sap-mounts role decides each host's role: if sap_mnt is defined, the host is treated as an NFS client. The role doesn't check whether the host is the server, so erpdevapp1 tried to NFS-mount its own export.

The fix was to scope the variables per inventory group instead of globally:

yaml
# inventory: NFS client parameters only on the HANA host group
D01_DB:
hosts:
teldevhana:
vars:
node_tier: hana
sap_mnt: "10.x.1.x:/export/sapmnt"
sap_trans: "10.x.1.x:/export/saptrans"
usr_sap_install_mountpoint: "10.x.1.x:/usr/sap/install"
# D01_SCS / D01_PAS (erpdevapp1): no NFS vars, so the role mounts local LVs instead

That got the DEV pilot moving, but the remaining problems were clear:

  • Single point of failure. Rebooting erpdevapp1 for kernel patches would freeze /sapmnt on every other host (with a hard mount, processes block in D state until the server comes back).
  • Inventory drift risk. Correct behaviour now depended on where variables were declared in the inventory. That's easy to break during a later refactor.
  • The production plan was heavy. A Pacemaker/DRBD cluster is two more VMs to patch, a STONITH configuration to test, and a runbook the SAP Basis team would have to own permanently.

5. Architecture Comparison: ANF vs. Azure Files Premium NFS 4.1

Once the stopgap was running, we stepped back and compared the realistic managed options properly instead of relying on rough cost estimates:

DimensionAzure NetApp Files (Premium tier)Azure Files Premium (NFS 4.1)
Availability in indonesiacentral❌ Not available (Dec 2025)✅ Available
ProtocolNFSv3, NFSv4.1, SMB, dual-protocolNFSv4.1 (no NFSv3 on Premium file shares)
Latency profileSub-millisecondLow single-digit milliseconds
Performance modelPer capacity pool: ~64 MiB/s per provisioned TiB (Premium), ~128 MiB/s per TiB (Ultra)Per share (provisioned v1): baseline IOPS = 3,000 + 1 × GiB; throughput ≈ 100 + 0.04 × GiB + 0.06 × GiB MiB/s; burst to ≥10,000 IOPS
Minimum footprintCapacity pool commitment (TiB-granular)100 GiB per share
BillingProvisioned pool sizeProvisioned share size (not used capacity)
RedundancyLRS within zone; cross-zone/cross-region replication as add-onsPremium_LRS or Premium_ZRS (synchronous, 3 zones)
Supported SAP uses/sapmnt, /usr/sap/trans, /hana/shared, /hana/data, /hana/log/sapmnt, /usr/sap/trans, /usr/sap/install, /hana/shared. Not HANA data/log
Provisioning velocityNetApp account → capacity pool → delegated subnet → volumesStorage account → shares (minutes); no delegated subnet
Network modelDelegated subnet in the VNet (private IP)Public endpoint restricted by VNet service-endpoint rules, or a Private Endpoint
SDAF supportNFS_provider = "ANF"NFS_provider = "AFS"

Plugging in our share sizes makes the performance numbers concrete. A 1,024 GiB install share gets a baseline of about 4,000 IOPS and ~200 MiB/s. That's plenty for extracting SAR archives into /usr/sap/install. A 128 GiB transport share gets about 3,100 IOPS and ~110 MiB/s. TMS traffic in DEV is a small fraction of that.

IMPORTANT

The decision: We didn't need ANF's sub-millisecond latency, because HANA data and log weren't going on NFS. We did need same-region placement, zone redundancy, zero cluster maintenance, and native SDAF support. Azure Files Premium NFS 4.1 provided all four for roughly a tenth of the cross-region ANF estimate, and without the two to three days of build time (plus ongoing ownership) the Pacemaker/DRBD cluster would have needed.


6. Detour #2: Proving AFS by Hand (4 January 2026)

Before changing any SDAF Terraform, we wanted evidence that Azure Files NFS would actually mount from the vendor's subnets. We wrote two Deployer-side helper scripts.

6.1 Discovering the subnets of running VMs (get_subnet_ids_for_nfs.sh)

In a brownfield landing zone, the subnet a VM is actually attached to matters more than what the design document says. The helper resolves it from the NIC:

bash
# get_subnet_ids_for_nfs.sh (excerpt)
for VM_NAME in erpdevapp1 teldevhana; do
VM_ID=$(az vm list --query "[?name=='$VM_NAME'].id | [0]" -o tsv)
NIC_ID=$(az vm show --ids "$VM_ID" --query 'networkProfile.networkInterfaces[0].id' -o tsv)
SUBNET_ID=$(az network nic show --ids "$NIC_ID" --query 'ipConfigurations[0].subnet.id' -o tsv)
echo "$VM_NAME -> $SUBNET_ID"
done

6.2 Creating the Premium FileStorage account (create_azure_files_nfs_manual.sh)

bash
# create_azure_files_nfs_manual.sh (condensed)
SUBSCRIPTION_ID="<your-subscription-id>"
RESOURCE_GROUP="rg-sap-paas-shared"
LOCATION="indonesiacentral"
STORAGE_ACCOUNT_NAME="stsapnfsdev01"
declare -A FILE_SHARES=( ["sapmnt"]="256" ["sap-trans"]="256" ["sap-install-media"]="500" )
# 1. NFS requires the FileStorage kind on the Premium tier. StorageV2 won't do.
az storage account create \
--name "$STORAGE_ACCOUNT_NAME" --resource-group "$RESOURCE_GROUP" --location "$LOCATION" \
--kind FileStorage --sku Premium_ZRS \
--https-only false \
--default-action Allow
# 2. Create NFS-protocol shares
for SHARE in "${!FILE_SHARES[@]}"; do
az storage share-rm create \
--storage-account "$STORAGE_ACCOUNT_NAME" --resource-group "$RESOURCE_GROUP" \
--name "$SHARE" --quota "${FILE_SHARES[$SHARE]}" --enabled-protocols NFS
done
# 3. Lock down to the SAP subnets (this step turns out to be mandatory, see below)
az storage account update --name "$STORAGE_ACCOUNT_NAME" --resource-group "$RESOURCE_GROUP" \
--default-action Deny --bypass AzureServices Logging Metrics
for SUBNET_ID in "${ALLOWED_SUBNET_IDS[@]}"; do
az storage account network-rule add --account-name "$STORAGE_ACCOUNT_NAME" \
--resource-group "$RESOURCE_GROUP" --subnet "$SUBNET_ID"
done

6.3 What the manual run taught us

The first mount attempt failed, and the Azure Portal explained why:

"The storage account is currently not configured for use from a virtual network. The NFS protocol can only be used from a machine inside of a virtual network."

That gave us a checklist of Azure Files NFS requirements that aren't obvious from the CLI defaults:

RequirementSettingWhy
Account kindFileStorage on Premium_LRS / Premium_ZRSNFS shares exist only on Premium FileStorage accounts
Secure transferhttps_traffic_only = falseNFS 4.1 on Azure Files is not wrapped in HTTPS; with secure transfer enforced, mounts are refused
Network default actionDenyNFS uses network identity rather than keys, so Azure insists the account be VNet-restricted
Subnet service endpointMicrosoft.Storage on each client subnetRequired for the VNet rule to match traffic from that subnet
VNet rulesEvery client subnet's ARM IDUnlisted subnets get access denied by server
Shared keyIrrelevant to NFSNFS 4.1 here uses sec=sys (UID/GID), not storage keys

With those settings in place, the test mount from erpdevapp1 succeeded:

bash
sudo mount -t nfs -o noresvport,vers=4,minorversion=1,sec=sys \
stsapnfsdev01.file.core.windows.net:/stsapnfsdev01/sapmnt /mnt/test-nfs
df -h /mnt/test-nfs
# Filesystem Size Used Avail Use% Mounted on
# stsapnfsdev01.file.core.windows.net:/stsapnfsdev01/sapmnt 256G 0 256G 0% /mnt/test-nfs

6.4 Respecting the vendor boundary

The landing zone already contained a shared-services storage account, but the vendor had built it as Standard / StorageV2 with SMB shares. Rather than editing vendor code ourselves (it's an external boundary, per Part 1), we sent the landing-zone team a written change request (TERRAFORM_CHANGES_FOR_AFS_NFS.md) listing what NFS needs:

Vendor Module SettingCurrentRequired for NFS
account_tierStandardPremium
account_kindStorageV2FileStorage (immutable, so this means a new account)
access_tierHot / TransactionOptimizedNot applicable on Premium (null)
blob_propertiesConfiguredMust be conditional (FileStorage has no blob service)
Share protocolSMBNFS
network_rules.default_actionAllowDeny + virtual_network_subnet_ids

WARNING

account_kind can't be changed in place. Converting an existing StorageV2 account to FileStorage forces Terraform to destroy and recreate it, data included. Ask for a new account name so the switch is side-by-side and reversible.

The manual account unblocked the pilot in under an hour. It also showed that managing it by hand, outside Terraform, wasn't something we wanted to keep doing. The next step was to let SDAF own it.


7. The Final State: SDAF-Native Azure Files (NFS_provider = "AFS")

SDAF already supports AFS as a first-class provider. The ownership is split across two layers, which matters when you're debugging:

ShareCreated By (SDAF Layer)Terraform ResourceSize Variable (Default)Mounted At
installWorkload Zone (sap_landscape)azurerm_storage_account.install + azurerm_storage_share.installinstall_volume_size (1024 GiB)/usr/sap/install
transportWorkload Zone (sap_landscape)azurerm_storage_account.transport + azurerm_storage_share.transporttransport_volume_size (128 GiB)/usr/sap/trans
sapmntSAP System (sap_system/common_infrastructure)azurerm_storage_account.sapmnt + azurerm_storage_share.sapmntsapmnt_volume_size/sapmnt/<SID>

The install and transport shares are landscape-wide: every SID in the workload zone shares one transport directory and one media cache. /sapmnt belongs to a single SID, so it's created with the system. All three accounts are FileStorage, Premium, ZRS, with https_traffic_only_enabled = false and enabled_protocol = "NFS".

7.1 Workload Zone configuration

In DEV-IDCE-SAP01-INFRASTRUCTURE.tfvars:

terraform
# ============================================================================
# NFS CONFIGURATION - Azure Files Premium
# ============================================================================
NFS_provider = "AFS" # Azure Files Premium with NFS 4.1
# Optional overrides (SDAF defaults shown)
# install_volume_size = 1024
# transport_volume_size = 128
# ============================================================================
# NETWORK ACCESS: required for AFS NFS
# ============================================================================
use_private_endpoint = false # DEV: service endpoints instead of PEs
use_service_endpoint = true # adds Microsoft.Storage SE to subnets
public_network_access_enabled = true # public endpoint, but...
enable_firewall_for_keyvaults_and_storage = true # ...default_action = Deny + VNet rules

And in the SAP System DEV-IDCE-SAP01-D01.tfvars:

terraform
NFS_provider = "AFS" # Consume install/transport from the Workload Zone, create /sapmnt here

The Workload Zone run on 14 January 2026 created the install and transport accounts and returned their NFS paths as outputs. Those outputs flow automatically into the generated sap-parameters.yaml:

text
install_path = "devidcesap01install<rnd>.file.core.windows.net:/devidcesap01install<rnd>/install"
saptransport_path = "devidcesap01transport<rnd>.file.core.windows.net:/devidcesap01transport<rnd>/transport"

NOTE

A connection to Part 1: that first successful run actually produced names like devunknsap01install…. The UNKN was the region code SDAF fell back to before we patched deploy_utils.sh to map indonesiacentral to IDCE. Storage account names are global and built from that prefix, which is one more reason to fix region codes before creating stateful storage. Renaming a storage account means recreating it.

7.2 What Ansible does with it

In Playbook 02, the 2.6.0-afs-mounts.yaml task file takes over. Our run logs show the sequence on both d01scs00l… (ASCS/PAS) and d01dhdb00l… (HANA):

  1. Temporarily mounts the sapmnt share at /saptmp, creates the per-SID directory tree (/sapmnt/D01, ASCS00, ERS01), then unmounts.
  2. Mounts install at /usr/sap/install on all nodes.
  3. Mounts sapmnt at /sapmnt/D01 on non-HANA nodes (or every node in a single-server layout).
  4. Mounts transport at /usr/sap/trans on scs, ers, pas, and app tiers only.
  5. On HANA nodes, writes an AFS-specific sysctl block to /etc/sysctl.d/ms-az.conf.
ini
# BEGIN HANA AFS optimizations (written by SDAF 2.6.0)
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv4.tcp_max_syn_backlog = 16348
net.ipv4.conf.all.rp_filter = 0
sunrpc.tcp_slot_table_entries = 128
vm.swappiness=10
# END HANA AFS optimizations

sunrpc.tcp_slot_table_entries = 128 is the important one. It raises the number of concurrent in-flight RPC requests per NFS TCP connection, which matters on Azure Files because each connection is limited to a fixed throughput.


8. Mount Parameters on SLES 15 SP5: What SDAF Actually Uses

Generic NFS tuning guides recommend all kinds of options. Here's what SDAF writes to /etc/fstab for AFS, taken from the role and our logs:

text
# /usr/sap/install: large sequential reads/writes during media extraction
devidcesap01install<rnd>.file.core.windows.net:/devidcesap01install<rnd>/install /usr/sap/install nfs4 rw,hard,rsize=1048576,wsize=1048576,noresvport,actimeo=60,vers=4,minorversion=1,sec=sys 0 0
# /usr/sap/trans and /sapmnt/D01
devidcesap01transport<rnd>.file.core.windows.net:/devidcesap01transport<rnd>/transport /usr/sap/trans nfs4 noresvport,vers=4,minorversion=1,sec=sys 0 0
OptionMeaningWhy It Matters on Azure Files
vers=4,minorversion=1NFS 4.1The only NFS version Azure Files Premium supports
sec=sysAUTH_SYS (UID/GID)No Kerberos; access control comes from the network rules plus POSIX permissions. UIDs for <sid>adm / sapsys must match across hosts, which SDAF enforces via sidadm_uid / sapsys_gid
noresvportUse a non-privileged source port on reconnectMicrosoft-recommended for Azure Files. Lets the client re-establish a dropped TCP connection on a new port after a front-end failover, instead of hanging
hardRetry I/O indefinitelyPrevents silent data corruption during transient outages. Processes wait instead of getting EIO
rsize/wsize=10485761 MiB I/O sizeMaximises throughput for SAR/ZIP extraction on /usr/sap/install
actimeo=60Cache attributes for 60 sFewer GETATTR round-trips while walking large media trees
proto=tcpTCP transportImplicit for NFS 4.1; Azure Files uses TCP port 2049 only

TIP

nconnect is an option to evaluate, not a default. Azure Files NFS supports nconnect (multiple TCP connections per mount) on Linux kernels ≥ 5.3, and SLES 15 SP5's 5.14 kernel qualifies. nconnect=4 can raise single-client throughput a lot for parallel workloads such as large SWPM exports. We deliberately kept SDAF's defaults for DEV so our configuration stayed identical to upstream. Benchmark it before adding it to production fstab.


9. The Bug Underneath: Brownfield Subnets Missing from Storage ACLs

For a while, everything worked. Then, at the end of January, the workload zone was redeployed with the storage firewall enabled (enable_firewall_for_keyvaults_and_storage = true, replacing the more permissive setting used in early DEV runs). Shortly afterwards the HANA server could no longer mount /usr/sap/install:

text
mount.nfs4: access denied by server while mounting
devidcesap01install<rnd>.file.core.windows.net:/devidcesap01install<rnd>/install

Inspecting the storage account showed only the Deployer subnet in its VNet rules:

bash
az storage account show --name devidcesap01install<rnd> --resource-group <workload-zone-rg> \
--query "networkRuleSet.virtualNetworkRules[].virtualNetworkResourceId" -o tsv
# .../virtualNetworks/<deployer-vnet>/subnets/DeployerSubnet <-- only this one

9.1 Root cause #1: defined vs. exists

SDAF models every subnet with two booleans in run/sap_landscape/transform.tf:

terraform
subnet_db = {
id = var.db_subnet_arm_id
defined = length(var.db_subnet_arm_id) > 0 ? false : length(var.db_subnet_address_prefix) > 0
exists = length(var.db_subnet_arm_id) > 0
}
Scenariodb_subnet_arm_iddefinedexists
Greenfield (SDAF creates the subnet)—truefalse
Brownfield (our case: ARM ID supplied)Providedfalsetrue

The storage network rules in terraform-units/modules/sap_landscape/storage_accounts.tf only check defined:

terraform
# BEFORE: install, transport, witness and boot-diag accounts all share this pattern
virtual_network_subnet_ids = compact([
var.infrastructure.virtual_networks.sap.subnet_db.defined ? (
var.infrastructure.virtual_networks.sap.subnet_db.exists ? var.infrastructure.virtual_networks.sap.subnet_db.id
: azurerm_subnet.db[0].id
) : null,
# ... same for subnet_app ...
length(local.deployer_subnet_management_id) > 0 ? local.deployer_subnet_management_id : null
])

In a brownfield deployment defined is false, so the expression returns null, compact() removes it, and the subnet SDAF was told to use is silently left out of the firewall. The inner exists check, which was clearly meant for this case, is never reached. In the witness account the inner check also tests .defined twice, which looks like a copy-paste mistake.

The fix is a one-token change in the outer condition:

terraform
# AFTER
(var.infrastructure.virtual_networks.sap.subnet_db.defined ||
var.infrastructure.virtual_networks.sap.subnet_db.exists) ? (
var.infrastructure.virtual_networks.sap.subnet_db.exists ? var.infrastructure.virtual_networks.sap.subnet_db.id
: azurerm_subnet.db[0].id
) : null

9.2 Root cause #2: subnets_to_add_to_firewall_for_keyvaults_and_storage only applies to Key Vaults

In Part 1 we used subnets_to_add_to_firewall_for_keyvaults_and_storage to allow-list vendor subnets. Despite the name, the sap_landscape module only passes that list to the Key Vault network_acls. None of the four storage accounts use it. That explains why Key Vault access worked while NFS access didn't, even though both are configured by the same parameter.

9.3 Root cause #3: lifecycle { ignore_changes } hides the drift

The install account's azurerm_storage_account_network_rules resource also has:

terraform
lifecycle {
ignore_changes = [virtual_network_subnet_ids]
}

This was probably added so that manual allow-list edits survive later terraform apply runs. The side effect is that fixing the module code doesn't repair accounts that already exist. The ACL is only computed correctly when the account is created. It's a one-way door, and it's a preview of the state-drift problems we cover in Part 4.

9.4 Remediation path

OptionActionTrade-off
1. Patch the module (preferred, upstream issue raised)defined || exists in all four accounts; concat subnets_to_add_to_firewall_for_keyvaults_and_storage into storage rulesNeeds a fork until merged; existing accounts still need option 2 once
2. Post-deploy CLI rule (what unblocked us)az storage account network-rule add --subnet <db-subnet-arm-id> per accountSurvives re-applies thanks to ignore_changes; lost if the account is recreated
3. Private Endpointsuse_private_endpoint = trueBypasses service-endpoint ACLs entirely; needs private DNS (privatelink.file.core.windows.net) to resolve in the brownfield VNet
4. Disable firewallenable_firewall_for_keyvaults_and_storage = falseNot viable: NFS requires default_action = Deny anyway

The workaround we scripted:

bash
#!/bin/bash
# Re-add brownfield workload subnets to every SDAF landscape storage account
WZ_RG="<workload-zone-rg>"
SUBNETS=(
"/subscriptions/<your-subscription-id>/resourceGroups/rg-sap-network-dev/providers/Microsoft.Network/virtualNetworks/vnet-sap-workload-dev/subnets/ApplicationSubnet"
"/subscriptions/<your-subscription-id>/resourceGroups/rg-sap-network-dev/providers/Microsoft.Network/virtualNetworks/vnet-sap-workload-dev/subnets/DatabaseSubnet"
)
for SA in $(az storage account list -g "$WZ_RG" --query "[].name" -o tsv); do
for SUBNET in "${SUBNETS[@]}"; do
az storage account network-rule add -g "$WZ_RG" --account-name "$SA" --subnet "$SUBNET" -o none
done
echo "✓ $SA"
done

CAUTION

The same .defined-only pattern may exist in the sap_system (the sapmnt account) and sap_library modules. If you run SDAF in a brownfield VNet, check the networkRuleSet of every storage account SDAF creates, not just the ones that are currently failing.


10. Shared Storage Verification Checklist

Run these checks after the Workload Zone and SAP System deployments, and before starting the Ansible pipeline:

StageCommand / TestAcceptance Criteria
1. Account shapeaz storage account show -n <sa> --query "{kind:kind, sku:sku.name, https:enableHttpsTrafficOnly}"FileStorage, Premium_ZRS, false
2. Sharesaz storage share-rm list --storage-account <sa> -g <rg> --query "[].{n:name,p:enabledProtocols,q:shareQuota}"Protocol NFS, quota ≥ 100 GiB
3. Firewallaz storage account show -n <sa> --query networkRuleSet.defaultActionDeny
4. VNet rules... --query "networkRuleSet.virtualNetworkRules[].virtualNetworkResourceId"App, DB and Deployer subnets all present
5. Service endpointsaz network vnet subnet show ... --query "serviceEndpoints[].service"Includes Microsoft.Storage
6. DNS & portnslookup <sa>.file.core.windows.net && nc -zvw3 <sa>.file.core.windows.net 2049Resolves; TCP 2049 open
7. In-guest mountsansible all -i inventory -m shell -a "df -hT -t nfs4"/usr/sap/install on all; /sapmnt/D01, /usr/sap/trans on app tier
8. Ownershipls -ln /sapmnt/D01 on every hostIdentical numeric UID/GID for d01adm:sapsys

11. Summary & Key Takeaways

ChallengeAnti-PatternWhat We Did
ANF missing in regionMount ANF cross-region, or pause the projectMoved to Azure Files Premium NFS 4.1 in-region
Interim NFS serverDefine NFS vars globally; let the server mount itselfScoped vars per inventory group, then retired the VM-hosted NFS server
Production HABuild and own a Pacemaker/DRBD NFS clusterPremium_ZRS: synchronous 3-zone redundancy as a managed service
Vendor storage accountEdit vendor IaC directly, or convert StorageV2 in placeFormal change request; new FileStorage account side by side
NFS connectivityLeave default_action = Allow and HTTPS-only onDeny + service endpoints + VNet rules; https_traffic_only = false
Brownfield ACL bugAssume subnets_to_add_to_firewall_… covers storagePatched defined || exists; scripted network-rule add; audit every account
Mount tuningCopy options from generic NFS blogsKept SDAF's tested options (noresvport, hard, 1 MiB I/O, actimeo=60); treat nconnect as a benchmarked opt-in

The broader lesson is that in a new cloud region, a reference architecture tells you what to aim for, not what's actually available. The managed service you planned around may not exist yet, and the fallback you choose under pressure (a VM-hosted NFS server) creates its own problems. The final design came from evaluating requirements honestly. We didn't need sub-millisecond NFS, because HANA's hot data stayed on block storage. We did need zone-redundant, same-region, zero-maintenance shared files that SDAF could manage, and the cheaper managed option met all of those needs.

With shared storage working, the Workload Zone had been applied, destroyed, and re-applied several times during these two weeks. Each of those cycles left something behind in Terraform state and in Azure Key Vault's soft-delete bin.


Coming Up in Part 4:

Resolving Terraform State Drift & Key Vault Bugs in SDAF v2: Why redeploying a control plane triggers 409 Conflict errors from soft-deleted, purge-protected Key Vaults, how a keyvault variable-scoping bug broke metadata flow between SDAF modules, and how we reconciled drifted state with surgical terraform state operations and safe blob-lease recovery.

Comments

Popular posts from this blog

Long running process in Linux using PHP

Copying Big Oracle tables Using Apache Spark

Repair Your Windows Store and Metro Apps After Windows Update