Azure Files, identity-based access, and moving data with AzCopy
Azure Files is a managed file share in a storage account that machines mount over SMB (Windows, Linux, macOS) or NFS (Linux, premium only). It replaces the file server under a desk: lift-and-shift apps that expect a drive, shared config for a VM fleet, home directories, AKS volumes that several pods mount at once (Azure I's azurefile-csi). This lesson covers creating and sizing shares, protecting them with snapshots and soft delete, controlling who can open them with identity-based access, and moving data in and out with AzCopy.
Need to know:
- A share lives in an account. Standard shares (in a StorageV2 account) have tiers: transaction optimized (the default), hot and cool. Premium shares live in a
FileStorageaccount on SSDs, are billed by provisioned size, and are the only ones with NFS. - The quota (GiB) is a ceiling, not an allocation, for standard shares: up to 5 TiB, or 100 TiB with large file shares enabled on the account.
- SMB uses port 445. Many home ISPs and some corporate networks block outbound 445, which is why "it mounts from the VM but not from my laptop" is common. Use a VPN, ExpressRoute or Azure File Sync.
- Azure File Sync caches a share on Windows Servers on-premises (cloud tiering), for branch offices.
Shares
$ az group create -n rg-try-files -l westeurope -o none
$ az storage account create -n sttryfiles01 -g rg-try-files -o none
$ az storage share-rm create -g rg-try-files --storage-account sttryfiles01 -n team --quota 100 --access-tier TransactionOptimized -o table
AccessTier EnabledProtocols LastModifiedTime Name ResourceGroup ShareQuota ShareUsageBytes
-------------------- ---------------- ------------------------- ---- ------------- ---------- ---------------
TransactionOptimized SMB 2026-09-22T20:00:04+00:00 team rg-try-files 100 0
$ az storage share-rm update -g rg-try-files --storage-account sttryfiles01 -n team --quota 200 --access-tier Hot --query "{quota:shareQuota, tier:accessTier}"
{
"quota": 200,
"tier": "Hot"
}
$ az storage share-rm list -g rg-try-files --storage-account sttryfiles01 -o table
Name ResourceGroup ShareQuota AccessTier Deleted SnapshotTime
---- ------------- ---------- ---------- ------- ------------
team rg-try-files 200 Hot
share-rm works through Azure Resource Manager (it needs a control-plane role, no keys). The older az storage share group goes to the data plane with keys or SAS. For creating and configuring shares, use share-rm.
Mounting on Linux (the portal's Connect button generates exactly this):
sudo mkdir -p /mnt/team
sudo mount -t cifs //sttryfiles01.file.core.windows.net/team /mnt/team \
-o credentials=/etc/smbcredentials/sttryfiles01.cred,dir_mode=0770,file_mode=0660,serverino,nosharesock,actimeo=30,mfsymlinks
The credentials file holds the account name and key: key-based mounting gives full access to every share in the account. That's what identity-based access replaces.
Snapshots and soft delete
A share snapshot is a read-only, point-in-time copy of the whole share (incremental: you pay for changed data). Users can open older versions of a file from it (on Windows, "Previous versions"). Azure Backup for file shares takes and manages these snapshots for you on a schedule.
$ az storage share-rm snapshot -g rg-try-files --storage-account sttryfiles01 -n team --query "{share:name, snapshot:snapshotTime}"
{
"share": "team",
"snapshot": "2026-09-22T20:00:04.7500000Z"
}
$ az storage share-rm list -g rg-try-files --storage-account sttryfiles01 --include-snapshot --query "[].{name:name, snapshot:snapshotTime}" -o table
Name Snapshot
---- ----------------------------
team
team 2026-09-22T20:00:04.7500000Z
Share soft delete keeps a deleted share (with its snapshots) for 1-365 days. It's an account setting (file service properties), on by default for new accounts in the portal, and the only thing between share-rm delete and a support ticket.
$ az storage account file-service-properties update -n sttryfiles01 -g rg-try-files --enable-delete-retention true --delete-retention-days 14 --query shareDeleteRetentionPolicy
{
"allowPermanentDelete": null,
"days": 14,
"enabled": true
}
$ az storage share-rm delete -g rg-try-files --storage-account sttryfiles01 -n team --include include --yes
$ az storage share-rm list -g rg-try-files --storage-account sttryfiles01 --include-deleted --query "[].{name:name, deleted:deleted}" -o table
Name Deleted
---- -------
team True
$ V=$(az storage share-rm list -g rg-try-files --storage-account sttryfiles01 --include-deleted --query "[?deleted].version" -o tsv)
$ az storage share-rm restore -g rg-try-files --storage-account sttryfiles01 -n team --deleted-version $V --query "{name:name, quota:shareQuota}"
{
"name": "team",
"quota": 200
}
Identity-based access
Instead of everyone mounting with the account key, users and machines authenticate as themselves with Kerberos, and two layers decide what they can do:
- Share-level permissions: Azure RBAC data roles on the share (or the account): Storage File Data SMB Share Reader, ... Contributor, ... Elevated Contributor (can change NTFS permissions). Or a default share-level permission for every authenticated identity.
- Directory and file permissions: normal Windows NTFS ACLs, set from a Windows client.
Both must allow an action. The identity source is one per account:
| Source | For | Notes |
|---|---|---|
| AD DS (on-premises Active Directory) | domain-joined machines, users synced to Entra ID | the account is joined to the domain as a computer object |
| Microsoft Entra Domain Services | a managed domain in Azure | |
| Microsoft Entra Kerberos | hybrid users on Entra-joined or hybrid-joined Windows clients, and cloud-only identities (preview) | no domain controller needed for the share |
$ az storage account update -n sttryfiles01 -g rg-try-files --enable-files-aadkerb true --default-share-permission StorageFileDataSmbShareReader --query azureFilesIdentityBasedAuthentication
{
"activeDirectoryProperties": null,
"defaultSharePermission": "StorageFileDataSmbShareReader",
"directoryServiceOptions": "AADKERB"
}
$ SHARE=$(az storage account show -n sttryfiles01 -g rg-try-files --query id -o tsv)/fileServices/default/fileshares/team
$ az role assignment create --assignee [email protected] --role "Storage File Data SMB Share Contributor" --scope $SHARE -o none
$ az role assignment list --scope $SHARE --query "[].{who:principalName, role:roleDefinitionName}" -o table
Who Role
-------------------------------- ---------------------------------------
[email protected] Storage File Data SMB Share Contributor
Everyone authenticated can now read the share (the default permission), and you can also write. Then disable key-based access where you can, so the key stops being a back door.
AzCopy and Storage Explorer
AzCopy is the command-line tool for bulk data: local files ⇄ blobs or files, and account to account (server-side, without passing through your machine). It authenticates with Entra ID (azcopy login, or a managed identity on a VM with azcopy login --identity) or a SAS on the URL. With Entra ID it also needs a data role:
$ az role assignment create --assignee [email protected] --role "Storage Blob Data Contributor" --scope $(az storage account show -n sttryfiles01 -g rg-try-files --query id -o tsv) -o none
$ az storage container create --account-name sttryfiles01 -n exports --auth-mode login -o none
$ mkdir -p export && echo q1 > export/q1.csv && echo q2 > export/q2.csv
$ azcopy login 2>&1 | tail -1
Login succeeded.
$ azcopy copy export "https://sttryfiles01.blob.core.windows.net/exports" --recursive | grep -E "Number of File Transfers|Final Job Status"
Number of File Transfers: 2
Number of File Transfers Completed: 2
Number of File Transfers Failed: 0
Number of File Transfers Skipped: 0
Final Job Status: Completed
$ azcopy list "https://sttryfiles01.blob.core.windows.net/exports"
INFO: Authenticating to source using Azure AD
INFO: export/q1.csv; Content Length: 3.00 B
INFO: export/q2.csv; Content Length: 3.00 B
copycopies what you name.syncmakes the destination match the source, comparing last-modified times, and with--delete-destination trueit deletes extra files on the destination: run it with--dry-runfirst.- Every run is a job with a log in
~/.azcopy.azcopy jobs list,azcopy jobs show <id>, andazcopy jobs resume <id>restarts the files that failed. - Account to account:
azcopy copy 'https://src.blob.core.windows.net/c?<SAS>' 'https://dst.blob.core.windows.net/c?<SAS>' --recursivecopies server-side. This is how you move data to a Premium account or another region.
Azure Storage Explorer is the desktop app (Windows, macOS, Linux) for the same jobs with a GUI: browse accounts, upload and download, manage SAS and stored access policies, change tiers, undelete. It uses AzCopy under the hood for transfers, and signs in with Entra ID, a key, a SAS or a connection string. The portal has a browser version (Storage browser).
On the exam (AZ-104 2.1.5, 2.2.5, 2.3.1, 2.3.5): share tiers and quotas, premium/NFS, port 445, share snapshots and soft delete, identity sources (AD DS, Entra Domain Services, Entra Kerberos), share-level roles + NTFS permissions, default share permission, AzCopy (login, SAS, copy vs sync, jobs) and Storage Explorer.
In an interview: "How do you let users open an Azure file share without handing out the storage key?" - "Identity-based access: join the account to AD DS or use Microsoft Entra Kerberos, give the team's group a share-level role like Storage File Data SMB Share Contributor, and keep the NTFS ACLs for folder-level control. Users then mount with their own Kerberos identity. Both layers have to allow the action, and with nobody using the key any more I can restrict key access."
What you can now do
- Create, size and tier a share, and know what port 445 means for clients.
- Snapshot a share, turn on share soft delete, and restore a deleted share.
- Set up identity-based access with a default permission and a share-level role.
- Move data with AzCopy (login or SAS, copy or sync, jobs), and know where Storage Explorer fits.