Skip to main content

Configuring Azure Files for Shared Network Storage

Learn to create an Azure Files share and mount it as a network drive accessible from multiple VMs simultaneously via SMB.

Overview and What You Will Learn

In this lab, you will create an Azure Files share, mount it on a Linux VM using the standard SMB protocol, and confirm that a file written from one VM is immediately visible to a second VM mounting the same share - the exact capability Blob Storage does not natively provide.

Why This Matters in Production

An engineering team at Swiggy needs several application servers to all read the same set of configuration files, and keeping those files in sync across separate local disks on each VM is error-prone - one server updates its copy, another doesn't, and the two servers start behaving inconsistently. Azure Files solves this by giving every VM a single shared location to read and write, exactly like a traditional network drive.

Core Principles

Azure Files provides fully managed file shares accessible over the standard SMB or NFS protocol - the same protocols a traditional on-premises network drive already uses, meaning existing applications expecting a mapped drive often need no code changes at all.

◈ DIAGRAM
+------------------------+ +------------------------------+
| VM A | | VM B |
| | | |
| Mounts the same share | <------> | Mounts the same share |
| Writes a config file | | Reads that same config file |
+------------------------+ +------------------------------+
| |
+------------------+-----------------+
|
+------------------------------+
| Azure Files Share |
| (lives inside a Storage |
| Account, not tied to any |
| single VM) |
+------------------------------+

This is the key distinction from Blob Storage or a VM's own Managed Disk - a File Share is designed to be mounted by multiple compute resources simultaneously, while a Managed Disk can only be attached to one VM at a time.

Detailed Step-by-Step Practical Lab

  1. Create a Resource Group and Storage Account:
Bash
az group create --name rg-files-lab-mumbai --location centralindia
az storage account create \
--name stfileslabrahul \
--resource-group rg-files-lab-mumbai \
--location centralindia \
--sku Standard_LRS
  1. Create a file share inside that storage account:
Bash
az storage share create \
--name shared-configs \
--account-name stfileslabrahul \
--quota 10
  1. Retrieve the storage account key needed to mount the share:
Bash
az storage account keys list \
--account-name stfileslabrahul \
--resource-group rg-files-lab-mumbai \
--query "[0].value" --output tsv
  1. On a Linux VM, install the CIFS utilities needed to mount an SMB share, then mount it:
Bash
sudo apt-get update && sudo apt-get install -y cifs-utils
sudo mkdir -p /mnt/shared-configs
sudo mount -t cifs \
//stfileslabrahul.file.core.windows.net/shared-configs \
/mnt/shared-configs \
-o username=stfileslabrahul,password=<storage-key>,serverino
Note

serverino tells the mount to use inode numbers from the server rather than generating them locally - this specific option is required for Azure Files SMB mounts to behave correctly with certain applications that rely on stable inode numbers.

  1. From this first VM, write a test file into the mounted share:
Bash
echo "shared config value" | sudo tee /mnt/shared-configs/app-config.txt
  1. On a second VM, repeat the mount steps (steps 4) pointing at the exact same share, then confirm the file written from the first VM is immediately visible:
Bash
cat /mnt/shared-configs/app-config.txt
## Expected: "shared config value"
  1. Clean up:
Bash
sudo umount /mnt/shared-configs
az group delete --name rg-files-lab-mumbai --yes --no-wait

Production Best Practices & Common Pitfalls

Common Mistake

Trying to achieve multi-VM shared access using Blob Storage, when the actual requirement is a real mountable file share. Blob Storage is not designed to be mounted as a network drive - Azure Files exists specifically for this shared-mount use case.

Tip

For production workloads, avoid mounting with the raw storage account key directly in a mount command visible in shell history or scripts. Use Azure Key Vault to store the key and retrieve it at mount time, or use Azure AD-based authentication for SMB where supported.

  • Azure Files is the right choice specifically for multi-writer, multi-reader scenarios. If only one VM ever needs to read or write the data, a Managed Disk is usually simpler and often cheaper than a File Share.
  • Quota is set at share creation and can be increased later, but plan realistically upfront. Under-provisioning the quota means running out of space unexpectedly; the quota itself does not affect cost until actual usage approaches it.

Quick Reference & Troubleshooting Commands

Command Description
az storage share create Create a new Azure Files share
az storage account keys list Retrieve the storage account key needed to mount
mount -t cifs Mount the share via SMB on a Linux VM
az storage share list --account-name <name> List existing shares on an account

Explore More in Azure Storage Solutions

All 6 Topics

Frequently Asked Questions

Is Configuring Azure Files for Shared Network Storage free to learn on DevOps Network?

Yes - this topic, like everything on DevOps Network, is 100% free with no paywall or sign-up gate.

What does the Configuring Azure Files for Shared Network Storage topic cover?

Learn to create an Azure Files share and mount it as a network drive accessible from multiple VMs simultaneously via SMB.