Mount an Azure file share

Before you begin this article, make sure you've read configure directory and file-level permissions over SMB.

The process described in this article verifies that your SMB file share and access permissions are set up correctly and that you can access an Azure file share from a domain-joined VM. Remember that share-level role assignment can take some time to take effect.

Sign in to the client using the credentials of the identity that you granted permissions to.

Applies to

File share type SMB NFS
Standard file shares (GPv2), LRS/ZRS Yes No
Standard file shares (GPv2), GRS/GZRS Yes No
Premium file shares (FileStorage), LRS/ZRS Yes No

Mounting prerequisites

Before you can mount the Azure file share, make sure you've gone through the following prerequisites:

  • If you're mounting the file share from a client that has previously connected to the file share using your storage account key, make sure that you've disconnected the share, removed the persistent credentials of the storage account key, and are currently using AD DS credentials for authentication. For instructions on how to remove cached credentials with storage account key and delete existing SMB connections before initializing new connection with Azure AD or AD credentials, follow the two-step process on the FAQ page.
  • Your client must have line of sight to your AD DS. If your machine or VM is outside of the network managed by your AD DS, you'll need to enable VPN to reach AD DS for authentication.

Mount the file share from a domain-joined VM

Run the PowerShell script below or use the Azure portal to persistently mount the Azure file share and map it to drive Z: on Windows. If Z: is already in use, replace it with an available drive letter. The script will check to see if this storage account is accessible via TCP port 445, which is the port SMB uses. Remember to replace the placeholder values with your own values. For more information, see Use an Azure file share with Windows.

Always mount Azure file shares using, even if you set up a private endpoint for your share. Using CNAME for file share mount isn't supported for identity-based authentication.

$connectTestResult = Test-NetConnection -ComputerName <storage-account-name> -Port 445
if ($connectTestResult.TcpTestSucceeded) {
    cmd.exe /C "cmdkey /add:`"<storage-account-name>`" /user:`"localhost\<storage-account-name>`""
    New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<storage-account-name>\<file-share-name>" -Persist
} else {
    Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."

You can also use the net-use command from a Windows prompt to mount the file share. Remember to replace <YourStorageAccountName> and <FileShareName> with your own values.

net use Z: \\<YourStorageAccountName>\<FileShareName>

If you run into issues mounting with AD DS credentials, refer to Unable to mount Azure Files with AD credentials for guidance.

Mount the file share from a non-domain-joined VM

Non-domain-joined VMs can access Azure file shares if they have line-of-sight to the domain controllers. The user accessing the file share must have an identity and credentials in the AD domain.

To mount a file share from a non-domain-joined VM, the user must either:

  • Provide explicit credentials such as DOMAINNAME\username where DOMAINNAME is the AD domain and username is the identity’s user name, or
  • Use the notation username@domainFQDN, where domainFQDN is the fully qualified domain name.

Using one of these approaches will allow the client to contact the domain controller to request and receive Kerberos tickets.

For example:

net use Z: \\<YourStorageAccountName>\<FileShareName> /user:<DOMAINNAME\username>


net use Z: \\<YourStorageAccountName>\<FileShareName> /user:<username@domainFQDN>

Next steps

If the identity you created in AD DS to represent the storage account is in a domain or OU that enforces password rotation, you might need to update the password of your storage account identity in AD DS.