Azure Files: SMB shares, snapshots, soft delete

An Azure file share is a network drive that lives in the cloud. Windows, Linux and macOS mount it over SMB just like any company file server, so old apps and users carry on working the way they always have.

Most day-to-day work with shares comes down to mounting them, getting a file back after someone overwrites it, and recovering from a delete, and snapshots and soft delete handle those last two.

In the lab you’ll mount a share on win01, take a snapshot, roll back a bad edit, bring a deleted share back, and fix a mount that broke after a key rotation.

TimeYou needCostBy the end you can
About 50 minutesThe storage account from Lesson 21, win01 from Lesson 16, the CLIA few US cents: a 5 GiB share with a few KB in it, and win01 for under an hourMount a share, use snapshots and soft delete, and troubleshoot SMB access

What it is, in one line

An Azure file share is a managed SMB or NFS network share that sits inside a storage account.

In Simple Words

The class shared cupboard

Every teacher has a key to the staff room cupboard and keeps folders in it, and that’s a file share: one place that lots of people open the same way. Every Friday the head teacher takes a photo of each shelf, so if somebody scribbles over a worksheet on Monday you just print Friday’s photo, and those photos are snapshots. If the whole cupboard gets thrown out by mistake, it sits in the store room for a week before the bin lorry comes, and that week is soft delete.

Engineer's View

How Azure Files works

  • Protocols: SMB 3.x on port 445 (Windows, Linux, macOS) for both standard and premium shares, and NFS 4.1 on premium only. Encryption in transit is switched on by default.
  • Tiers: standard shares in a StorageV2 account can be Transaction optimized (the default), Hot or Cool. Premium shares sit on SSD in a FileStorage account and you pay for the provisioned size.
  • Access with a key: mount as user localhost\<account> with an account key. Simple, but the key gives full access to the whole account.
  • Access with identity: join the account to AD DS, Microsoft Entra Domain Services or Microsoft Entra Kerberos, and then share-level RBAC roles (Storage File Data SMB Share Reader, Contributor, Elevated Contributor) and NTFS permissions apply to each user separately.
  • Snapshots: read-only, point-in-time, incremental copies of the whole share, up to 200 per share. Windows shows them under Previous Versions, and Azure Backup for file shares is built on them.
  • Soft delete: holds a deleted share, snapshots included, for 1 to 365 days. It works on the whole share and not on single files, which is what snapshots are for.
  • Network: lots of home and office networks block 445 (Lesson 22), but VMs in the same region can reach it, even from a private subnet. Azure File Sync caches a share on a local Windows server.

How it works, step by step

What happens when win01 opens \\stsaat48213.file.core.windows.net\share-ops:

Azure file share connection steps: DNS, port 445, SMB sign-in, permissions
  1. Windows looks up the storage account’s file endpoint in DNS.
  2. It opens TCP 445 to that address, and from win01 that traffic stays inside the Azure region.
  3. SMB 3 agrees on encryption and signs in, in this case with the account name and key.
  4. Storage checks the storage firewall (Lesson 26) first, then the credentials, then the permissions.
  5. The share shows up as a drive, and file locks behave the same as on a normal file server.

When something breaks, use those steps as your checklist: DNS, port 445, credentials, permissions. Most tickets turn out to be port 445 or a key that changed.

Azure file share protection: snapshots, soft delete and resource locks

Snapshots protect files and soft delete protects the share, but neither one helps if the storage account itself is deleted, and for that you need a resource lock.

Hands-on lab: an Azure file share on win01

Before you run any command, double-check it

Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.

Load your storage account name and key2 (you rotated key1 in Lesson 24):

$st = (Get-Content C:\azure-lab\storage.txt)
$key = az storage account keys list --resource-group rg-saat-data --account-name $st --query "[?keyName=='key2'].value" -o tsv

1Turn on share soft delete and create a share

Run this:

az storage account file-service-properties update --resource-group rg-saat-data --account-name $st --enable-delete-retention true --delete-retention-days 7 -o none
az storage share-rm create --resource-group rg-saat-data --storage-account $st --name share-ops --quota 5 -o none
az storage share-rm show --resource-group rg-saat-data --storage-account $st --name share-ops --query "{name:name, quotaGiB:shareQuota, tier:accessTier}" -o table

You should see this:

Name       QuotaGiB    Tier
---------  ----------  --------------------
share-ops  5           TransactionOptimized

2Mount it on win01 and write a file

Save a helper script that connects as the storage account, writes report.txt if you ask it to, and lists the share:

$f = @'
param([string]$st, [string]$key, [string]$text)
"port 445: " + (Test-NetConnection -ComputerName "$st.file.core.windows.net" -Port 445 -WarningAction SilentlyContinue).TcpTestSucceeded
$cred = New-Object System.Management.Automation.PSCredential("localhost\$st", (ConvertTo-SecureString $key -AsPlainText -Force))
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\$st.file.core.windows.net\share-ops" -Credential $cred -ErrorAction Stop | Out-Null
if ($text) { Set-Content -Path Z:\report.txt -Value $text }
Get-ChildItem Z:\ | ForEach-Object { "{0}  {1} bytes" -f $_.Name, $_.Length }
if (Test-Path Z:\report.txt) { "content: " + (Get-Content Z:\report.txt) }
'@
Set-Content -Path C:\azure-lab\files-share.ps1 -Value $f

Start win01 and run the script (the key is passed in as a parameter rather than stored inside the script):

az vm start --resource-group rg-saat-vms --name win01
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" "text=monthly report v1" --query "value[0].message" -o tsv

You should see something like this:

port 445: True
report.txt  19 bytes
content: monthly report v1

Port 445 works from win01 because the traffic never leaves the region, which isn’t true of most home networks. In a real setup, users would map the drive with their own identity and not the account key.

3Take a snapshot

Run this:

$snap = az storage share snapshot --account-name $st --name share-ops --query snapshot -o tsv
$snap
az storage share-rm list --resource-group rg-saat-data --storage-account $st --include-snapshot --query "[].{name:name, snapshot:snapshotTime}" -o table

You should see something like this:

2026-10-20T16:41:05.0000000Z
Name       Snapshot
---------  -------------------------
share-ops
share-ops  2026-10-20T16:41:05+00:00

4Overwrite the file by mistake, then roll it back

Write the wrong version, and then copy the file back from the snapshot:

az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" "text=monthly report v2 WRONG" --query "value[0].message" -o tsv
az storage file download --account-name $st --share-name share-ops --path report.txt --snapshot $snap --dest C:\azure-lab\report-v1.txt -o none
az storage file upload --account-name $st --share-name share-ops --source C:\azure-lab\report-v1.txt --path report.txt -o none
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" --query "value[0].message" -o tsv

You should see something like this at the end:

port 445: True
report.txt  19 bytes
content: monthly report v1

Windows users can do this themselves by right-clicking the file and going to Properties, then Previous Versions, where every snapshot is listed.

Azure file share lab: mounted on win01, snapshot and rollback
A share mounted on win01, a snapshot, and a file rolled back from that snapshot.

✅ Checkpoint: share-ops is mounted from win01, report.txt is back to v1, and one snapshot exists.

Break It, Then Fix It

Leave win01 running for both of these breaks.

1Break it: delete the share

Try deleting the share the quick way:

az storage share delete --account-name $st --name share-ops

You’ll get an error like this:

The share has snapshots and the operation requires no snapshots.
RequestId:...
Time:...
ErrorCode:ShareHasSnapshots

Azure stops you because deleting the share would take the snapshots with it. Someone in a rush adds the flag that deletes them too, and the share is gone:

az storage share delete --account-name $st --name share-ops --delete-snapshots include
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" --query "value[0].message" -o tsv

The mount will now fail with something like this:

port 445: True
New-PSDrive : The network name cannot be found
...

Fix it: find the soft-deleted share and restore it:

$ver = az storage share-rm list --resource-group rg-saat-data --storage-account $st --include-deleted --query "[?name=='share-ops' && deleted].version" -o tsv
az storage share-rm restore --resource-group rg-saat-data --storage-account $st --name share-ops --deleted-version $ver -o none
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" --query "value[0].message" -o tsv

You should see something like this:

port 445: True
report.txt  19 bytes
content: monthly report v1

The share is back with its files and its snapshot. Without the soft delete you turned on in step 1, there’d be nothing to restore.

2Break it: the mount stopped working after a key rotation

Rotate key2, the way a security team might, and then run the script with the old key:

az storage account keys renew --resource-group rg-saat-data --account-name $st --key secondary -o none
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" --query "value[0].message" -o tsv

You’ll see something like this:

port 445: True
New-PSDrive : The specified network password is not correct
...

Port 445 is fine, so this isn’t the network, it’s the credentials. Every server, script and saved credential that used key2 fails in exactly this way, and that’s the main reason to move shares over to identity-based access.

Fix it: fetch the new key and use that:

$key = az storage account keys list --resource-group rg-saat-data --account-name $st --query "[?keyName=='key2'].value" -o tsv
az vm run-command invoke --resource-group rg-saat-vms --name win01 --command-id RunPowerShellScript --scripts '@C:\azure-lab\files-share.ps1' --parameters "st=$st" "key=$key" --query "value[0].message" -o tsv

You should see something like this:

port 445: True
report.txt  19 bytes
content: monthly report v1

To clean up, delete the share along with its snapshots and stop win01:

az storage share delete --account-name $st --name share-ops --delete-snapshots include -o none
az vm deallocate --resource-group rg-saat-vms --name win01
C:\azure-lab\Find-LabResources.ps1 -Lesson 25

You should see this:

Nothing tagged course=saatvedha-azure is left.
Azure file share errors: ShareHasSnapshots and wrong key after rotation
A share deleted with its snapshots and then restored, and a mount that broke after a key rotation.

✅ Checkpoint: You restored a deleted share and fixed a mount after a key rotation. win01 is deallocated.

The deleted share stays in soft delete for 7 days before it’s removed, and its few KB cost next to nothing.

This happened at work

Monday morning, and the S: drive was empty

An architecture firm moved its project drive to Azure Files and mapped it as S: on 60 laptops over a VPN. Then one Monday morning every user found S: empty or missing, and within minutes the helpdesk queue was full.

It turned out that a security review over the weekend had rotated both storage account keys. Every laptop had its drive mapping saved with key1 in Windows Credential Manager, so all of them failed with “The specified network password is not correct”.

What they changed: they joined the account to their on-premises AD DS, and users now map S: with their own sign-in and share-level RBAC roles, so the keys get rotated every month without anybody noticing. Snapshots run every 4 hours, soft delete is set to 14 days, and the helpdesk runbook now begins with “test port 445, then check credentials”.

Common mistakes and troubleshooting

MistakeWhat you seeWhat to do
Mapping from a network that blocks 445Error 53, network path not foundUse a VPN, a VM in Azure, or Azure File Sync.
Mounting with the account key everywhereMass failure after key rotationSwitch to identity-based access with AD DS or Entra Kerberos.
Mapping a drive in a Run Command or serviceDrive missing for usersMap it per user, because users can’t see SYSTEM mappings.
Soft delete offDeleted share gone for goodTurn on share soft delete (7 to 14 days is typical).
No snapshotsCan’t roll back an overwritten fileSchedule snapshots, or use Azure Backup for file shares.
Deleting a share with its snapshots in a hurryShare and history gone togetherCheck what --delete-snapshots include will remove before you run it.
Treating the share as a databaseLocking problems, slow appsUse a real database; shares are meant for files.

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. What is Azure Files?

Why they ask this: It’s the basic idea.

How you might answer: It’s a managed file share service inside a storage account. Clients mount it over SMB, or NFS on premium shares, the same as a normal network drive.

2. Which port does SMB use, and why does it matter?

Why they ask this: It’s a classic piece of troubleshooting basics.

How you might answer: It’s TCP 445, and plenty of home networks, internet providers and company firewalls block it outbound. So a share that works fine from an Azure VM can still fail from a laptop.

3. What is the difference between a share snapshot and soft delete?

Why they ask this: They want to see you know both protections.

How you might answer: A snapshot is a read-only copy of the whole share at one point in time, and you use it to get files back. Soft delete holds on to a deleted share, snapshots and all, for a set number of days so you can restore the whole share.

2–5 years experience

4. A user overwrote an important file on a share. How do you get it back?

Why they ask this: It’s one of the most common tickets.

How you might answer: If there are snapshots or Azure Backup, the user can go to Previous Versions in Windows, or I can copy the file out of the snapshot with the CLI or the portal. I’d restore it under a new name first so we don’t overwrite anything newer.

5. Mapped drives fail for everyone after a key rotation. What happened and how do you fix it long term?

Why they ask this: They want the root cause plus some design thinking.

How you might answer: The drives were mounted with the account key, so rotating it broke every one of them. In the short term you update the stored credential. Longer term I’d move to identity-based access with AD DS or Entra Kerberos, so users connect with their own accounts and the keys can rotate whenever we like.

6. How do you troubleshoot “network path not found” for an Azure file share?

Why they ask this: They want a method, step by step.

How you might answer: I’d check that DNS resolves the file endpoint, test TCP 445, look at the storage firewall and the private endpoint DNS, and then the credentials and permissions. Microsoft’s troubleshooting guide and the AzFileDiagnostics script help a lot here.

Senior level

7. How would you migrate a large on-premises file server to Azure Files?

Why they ask this: They want a plan that would work in real life.

How you might answer: Either Azure File Sync for a gradual move with a local cache and cloud tiering, or AzCopy or Robocopy for a straight copy. Before that I’d set up identity-based access and NTFS ACLs, plan around port 445, run a pilot, and have snapshots and backup ready before the cutover.

8. Standard or premium file shares: how do you decide?

Why they ask this: They want reasoning about performance and cost.

How you might answer: Standard is fine for general file sharing where latency isn’t critical. Premium is for low latency and high IOPS, like app data or profile containers, or when you need NFS. Since premium is billed on provisioned size, I’d size it from measured usage.

9. How do you protect file shares from ransomware?

Why they ask this: They want to hear defence in layers.

How you might answer: I’d use identity-based access with least privilege and scheduled snapshots, plus Azure Backup with soft delete in a separate vault. On top of that, share soft delete, a lock on the storage account, and private endpoints with the firewall so only the networks we expect can reach it.

Quick quiz

Q1. Which port does SMB use?

  1. 443
  2. 445
  3. 3389
  4. 2049
Show answer

B — SMB uses TCP 445.

Q2. What does a share snapshot protect against?

  1. Deleting the storage account
  2. Overwritten or deleted files
  3. Port 445 blocks
  4. Key rotation
Show answer

B — Snapshots let you copy files back from a point in time.

Q3. What brings back a deleted share?

  1. Lifecycle rules
  2. Share soft delete
  3. RA-GRS
  4. A new SAS
Show answer

B — Soft delete keeps deleted shares for the retention period.

Q4. After a key rotation, mounts fail with “network password is not correct”. Fix?

  1. Open port 445
  2. Use the new key or identity-based access
  3. Delete snapshots
  4. Change the tier
Show answer

B — The stored key is no longer valid.

Q5. Which tier is the default for a standard share?

  1. Hot
  2. Cool
  3. Transaction optimized
  4. Premium
Show answer

C — Standard shares default to Transaction optimized.

Quick recap

You can now look after Azure file shares day to day and recover from the usual mistakes.

  • Azure Files gives SMB (and NFS on premium) shares from a storage account.
  • Port 445 has to be reachable, so test it first.
  • Snapshots bring files back and soft delete brings shares back.
  • Mounts that use the key break when the key rotates, so use identity-based access.
  • Put a lock on the storage account so it can’t be deleted.

Next lesson

Lesson 26: Storage networking: firewall, service endpoints, private endpoints → Next you’ll lock the storage account to your VNet and make it reachable only through a private endpoint.

Further reading: Azure file share

Want to go deeper into Azure file share? See Microsoft’s What is Azure Files? and Azure Files share snapshots. You can also see the full plan for this course on the Azure Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.