Automated backup solution for Azure Files NFS via snapshots, using Azure Automation Runbooks.
Azure Backup does not natively support NFS protocol file shares (official documentation). This solution fills that gap with automated snapshots and configurable retention.
┌──────────────────────────────────────────────────────┐
│ Resource Group │
│ │
│ ┌────────────────────┐ ┌───────────────────────┐ │
│ │ Automation Account │ │ Storage Account (NFS) │ │
│ │ + Managed Identity│──▶│ File Share (NFS) │ │
│ │ + Runbook │ │ └─ Snapshots │ │
│ │ + Schedule (daily)│ └───────────────────────┘ │
│ └────────────────────┘ │
│ │
│ ┌────────────────────┐ │
│ │ VNet + Subnet │ │
│ │ (Service Endpoint)│ │
│ └────────────────────┘ │
└──────────────────────────────────────────────────────┘
- No shared key access dependency: uses ARM REST API (management plane) with Managed Identity
- Configurable retention: automatic cleanup of old snapshots
- Daily schedule: scheduled execution at 02:00 UTC (configurable)
- Azure Policy compatible: works in subscriptions that block shared key authentication
├── deploy/
│ ├── 01-deploy-infra.ps1 # Base infrastructure deployment
│ ├── 02-deploy-automation.ps1 # Automation Account + Runbook + Schedule
│ ├── 03-test-populate-nfs.sh # Test data (run on Linux VM)
│ └── parameters.json # Configurable parameters
├── runbook/
│ └── Backup-NfsSnapshot.ps1 # Azure Automation Runbook
├── cleanup/
│ └── cleanup.ps1 # Full PoC cleanup
├── .gitignore
└── README.md
Follow this guide to deploy the full PoC end-to-end, create test data, run a snapshot, and verify it works.
- Azure CLI installed and logged in (
az login) - Azure subscription with permission to create resources
- PowerShell 7+ (or Windows PowerShell 5.1)
- The
automationAzure CLI extension will be installed automatically by the scripts
git clone https://github.com/<your-org>/azure-files-nfs-backup.git
cd azure-files-nfs-backupOpen deploy/parameters.json and adjust values if needed:
{
"resourceGroupName": "rg-nfs-backup-poc",
"location": "spaincentral",
"storageAccountPrefix": "stnfspoc",
"fileShareName": "nfsshare01",
"fileShareQuotaGiB": 100,
"automationAccountName": "aa-nfs-backup-poc",
"runbookName": "Backup-NfsSnapshot",
"vmSize": "Standard_D4as_v5",
"retentionDays": 7,
"scheduleName": "Daily-0200-UTC"
}Tip: Change
locationto a region near you. The Storage Account name suffix is generated randomly at deploy time.
.\deploy\01-deploy-infra.ps1 -DeployVMThis creates:
| Resource | Purpose |
|---|---|
| Resource Group | Container for all PoC resources |
| VNet + Subnet | Network with Microsoft.Storage service endpoint |
| Storage Account | Premium FileStorage (NFS-capable) |
| NFS File Share | 100 GiB share with NFSv4.1 protocol |
| Linux VM | Ubuntu 22.04 client with NFS auto-mounted |
The script outputs the Storage Account name and saves it to deploy/.state.json for the next step.
Run this remotely on the VM to create a realistic SAP-like directory structure:
az vm run-command invoke `
--resource-group rg-nfs-backup-poc `
--name vm-nfs-client `
--command-id RunShellScript `
--scripts @deploy/03-test-populate-nfs.shThis creates:
ASCS00/andERS01/directories with log filessapmnt/S4H/profile/with SAP profile configssapmnt/S4H/global/with a cluster config and a 10 MB binary test file
.\deploy\02-deploy-automation.ps1This creates:
| Resource | Purpose |
|---|---|
| Automation Account | Hosts the Runbook and schedule |
| System-Assigned Managed Identity | Authenticates to ARM without secrets |
| RBAC assignment | Storage Account Contributor on the Storage Account |
| Runbook | Backup-NfsSnapshot — published and ready |
| Schedule | Daily-0200-UTC — runs every day at 02:00 UTC |
| Job Schedule link | Connects the schedule to the Runbook with parameters |
Trigger the Runbook manually to verify it works:
# Replace <your-storage> with the actual Storage Account name
az automation runbook start `
--automation-account-name aa-nfs-backup-poc `
--resource-group rg-nfs-backup-poc `
--name Backup-NfsSnapshot `
--parameters StorageAccountName=<your-storage> `
ResourceGroupName=rg-nfs-backup-poc `
FileShareName=nfsshare01 `
RetentionDays=7az storage share-rm list `
--storage-account <your-storage> `
--resource-group rg-nfs-backup-poc `
--include-snapshot `
--query "[].{name:name, snapshotTime:snapshotTime, quota:shareQuota}" `
-o tableExpected output:
Name SnapshotTime Quota
----------- ------------------------ -------
nfsshare01 100
nfsshare01 2026-03-14T15:50:28.0000 100
The row with a SnapshotTime is your snapshot. The one without is the live share.
When done testing:
.\cleanup\cleanup.ps1Or directly:
az group delete --name rg-nfs-backup-poc --yes --no-waitFor existing SAP NFS file shares (ASCS/ERS), you only need the Automation layer — no VM or VNet required.
| Demo | Production |
|---|---|
| Deploys VNet, Storage Account, VM | You already have these |
| Runs both scripts | Run only 02-deploy-automation.ps1 |
| One file share | One schedule + linkage per file share |
- Update
parameters.jsonwith your production Resource Group, Storage Account, and File Share names - Run the automation script:
.\deploy\02-deploy-automation.ps1 -StorageAccountName <your-prod-storage>
- Assign RBAC — the script does this automatically, but if your Managed Identity needs access to multiple Storage Accounts, run:
az role assignment create ` --assignee-object-id <managed-identity-principal-id> ` --assignee-principal-type ServicePrincipal ` --role "Storage Account Contributor" ` --scope <storage-account-resource-id>
- Repeat for each NFS file share: create a new schedule and link it to the Runbook with the appropriate parameters
- The Runbook uses
Invoke-AzRestMethodagainst the ARM REST API (PUTwith$expand=snapshots) instead of data plane cmdlets (New-AzStorageShareSnapshot), because many enterprise subscriptions block shared key authentication via Azure Policy - API version:
2025-06-01 - NFS snapshots are instantaneous and file-system consistent
- Authentication is via System-Assigned Managed Identity — no passwords, keys, or certificates stored anywhere
- Snapshots reside in the same Storage Account — they do not protect against accidental account deletion
- For cross-region protection, consider complementing with Blob Storage copy or migrating to Azure NetApp Files
- Azure Backup does not support NFS file shares (as of March 2026)
MIT