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.
+------------------------+ +------------------------------+| 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
- Create a Resource Group and Storage Account:
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- Create a file share inside that storage account:
az storage share create \ --name shared-configs \ --account-name stfileslabrahul \ --quota 10- Retrieve the storage account key needed to mount the share:
az storage account keys list \ --account-name stfileslabrahul \ --resource-group rg-files-lab-mumbai \ --query "[0].value" --output tsv- On a Linux VM, install the CIFS utilities needed to mount an SMB share, then mount it:
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>,serverinoNote
serverinotells 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.
- From this first VM, write a test file into the mounted share:
echo "shared config value" | sudo tee /mnt/shared-configs/app-config.txt- 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:
cat /mnt/shared-configs/app-config.txt## Expected: "shared config value"- Clean up:
sudo umount /mnt/shared-configsaz group delete --name rg-files-lab-mumbai --yes --no-waitProduction Best Practices & Common Pitfalls
Common MistakeTrying 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.
TipFor 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 |