How to Mount an Azure File Share with Windows 10/11

Prerequisites

Ensure port 445 is open: The SMB protocol requires TCP port 445 to be open. Connections will fail if port 445 is blocked. You can check if your firewall or ISP is blocking port 445 by using the Test-NetConnection cmdlet. See Port 445 is blocked.

Using an Azure file share with Windows

To use an Azure file share with Windows, you must either mount it, which means assigning it a drive letter or mount point path, or access it via its UNC path.

This article uses the storage account key to access the file share. A storage account key is an administrator key for a storage account, including administrator permissions to all files and folders within the file share you’re accessing, and for all file shares and other storage resources (blobs, queues, tables, etc.) contained within your storage account. If this isn’t sufficient for your workload, you can use Azure File Sync or identity-based authentication over SMB. Shared access signature (SAS) tokens aren’t currently supported for mounting Azure file shares.

A common pattern for lifting and shifting line-of-business (LOB) applications that expect an SMB file share to Azure is to use an Azure file share as an alternative for running a dedicated Windows file server in an Azure VM. One important consideration for successfully migrating an LOB application to use an Azure file share is that many applications run under the context of a dedicated service account with limited system permissions rather than the VM’s administrative account. Therefore, you must ensure that you mount/save the credentials for the Azure file share from the context of the service account rather than your administrative account.

Mount the Azure file share

The Azure portal provides a PowerShell script that you can use to mount your file share directly to a host using the storage account key. Unless you’re mounting the file share using identity-based authentication, we recommend using this provided script.

To get this script:

  1. Sign in to the Azure portal.
  2. Navigate to the storage account that contains the file share you’d like to mount.
  3. Select File shares.
  4. Select the file share you’d like to mount.
  5. Select Connect.Screenshot of the connect icon for your file share.
  6. Select the drive letter to mount the share to.
  7. Copy the provided script.Screenshot of connect blade, copy button on script is highlighted.
  8. Paste the script into a shell on the host you’d like to mount the file share to, and run it.

You have now mounted your Azure file share.

Mount the Azure file share with File Explorer

 Note

Note that the following instructions are shown on Windows 10 and may differ slightly on older releases.

  1. Open File Explorer by opening it from the Start Menu, or by pressing the Win+E shortcut.
  2. Navigate to This PC on the left-hand side of the window. This will change the menus available in the ribbon. Under the Computer menu, select Map network drive.Screenshot of the Map network drive drop-down menu.
  3. Select the drive letter and enter the UNC path to your Azure file share. The UNC path format is \\<storageAccountName>.file.core.windows.net\<fileShareName>. For example: \\anexampleaccountname.file.core.windows.net\file-share-name. Check the Connect using different credentials checkbox. Select Finish.Screenshot of the Map Network Drive dialog.
  4. Select More choices > Use a different account. Under Email address, use the storage account name, and use a storage account key as the password. Select OK.Screenshot of the network credential dialog selecting use a different account.
  5. Use Azure file share as desired.Screenshot showing that the Azure file share is now mounted.
  6. When you’re ready to dismount the Azure file share, right-click on the entry for the share under the Network locations in File Explorer and select Disconnect.

Access an Azure file share via its UNC path

You don’t need to mount the Azure file share to a drive letter to use it. You can directly access your Azure file share using the UNC path by entering the following into File Explorer. Be sure to replace storageaccountname with your storage account name and myfileshare with your file share name:

\\storageaccountname.file.core.windows.net\myfileshare

You’ll be asked to sign in with your network credentials. Sign in with the Azure subscription under which you’ve created the storage account and file share. If you don’t get prompted for credentials, you can add the credentials using the following command:

cmdkey /add:StorageAccountName.file.core.windows.net /user:localhost\StorageAccountName /pass:StorageAccountKey

For Azure Government Cloud, change the servername to:

\\storageaccountname.file.core.usgovcloudapi.net\myfileshare

Ref: Mount Azure file share on Windows | Microsoft Learn