OnCallReadyStart learning

Azure Lesson 32.34 · Azure IV: Governance, Storage & Backup · 18 min read

Azure Files, identity-based access, and moving data with AzCopy

In plain words

Azure Files is a shared network drive in the cloud, like the S: drive at the office. Computers connect to it over the network, the same way they connect to a file server.

You can take a photo of the whole drive at a moment (a snapshot) to go back to, keep deleted drives in a recycle bin for a while (soft delete), and instead of giving everyone the master key, let people in with their own company login (identity-based access). To carry big piles of files in or out, there is a removal van called AzCopy.

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 FileStorage account 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:

  1. 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.
  2. 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:

SourceForNotes
AD DS (on-premises Active Directory)domain-joined machines, users synced to Entra IDthe account is joined to the domain as a computer object
Microsoft Entra Domain Servicesa managed domain in Azure
Microsoft Entra Kerberoshybrid 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
  • copy copies what you name. sync makes the destination match the source, comparing last-modified times, and with --delete-destination true it deletes extra files on the destination: run it with --dry-run first.
  • Every run is a job with a log in ~/.azcopy. azcopy jobs list, azcopy jobs show <id>, and azcopy 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>' --recursive copies 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.

Why it helps

File shares hold the things that never got rewritten for object storage: department drives, shared config, legacy apps. They come with Windows-style permission questions, port 445 surprises and the temptation to mount with the account key.

Moving data in bulk (AzCopy, Storage Explorer) is an everyday job, and the exam asks about identity sources, share snapshots and soft delete. So does every migration project.

Commands in this lesson

az mkdir azcopy

FAQ

Why can't I mount the share from home?

SMB uses TCP port 445, which many internet providers and corporate networks block outbound. Connect through a VPN or ExpressRoute, use Azure File Sync with a local server, or access it from inside Azure. Test with a TCP connection to port 445 on the account's file endpoint.

Is the share quota space I pay for?

On standard shares the quota is a ceiling, and you pay for what you use. Premium shares are billed by provisioned size, which also sets their performance. Large file shares raise the standard limit from 5 TiB to 100 TiB.

How do share-level and NTFS permissions combine?

Both must allow an action. Share-level permissions are Azure RBAC data roles on the share (or a default share permission for all authenticated users); NTFS ACLs on folders and files are set from a Windows client. Use share roles for who may connect and NTFS for what they may do inside.

What does azcopy sync --delete-destination do?

It makes the destination match the source and deletes files on the destination that are not in the source. Run it with --dry-run first. azcopy copy only copies what you name and never deletes. Every run is a job with a log you can resume.

Do I need Storage Explorer if I have AzCopy?

No, but it is convenient: a desktop GUI for browsing accounts, uploading and downloading, managing SAS and stored access policies, changing tiers and undeleting. It uses AzCopy for transfers and signs in with Entra ID, a key, a SAS or a connection string.

In an interview Mid

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 such as 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. With nobody using the key any more I can restrict key access, and share snapshots plus soft delete protect the data.

Also asked: What is the difference between share snapshots and share soft delete? · Which port does SMB use, and why does that matter? · When would you use AzCopy instead of the az storage commands?

Practise this lesson in the terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.