Mount an Azure File share and access the share in Windows

Azure File storage is Microsoft's easy to use cloud file system. Azure File shares can be mounted in Windows and Windows Server. This article shows three different ways to mount an Azure File share on Windows: with the File Explorer UI, via PowerShell, and via the Command Prompt.

In order to mount an Azure File share outside of the Azure region it is hosted in, such as on-premises or in a different Azure region, the OS must support SMB 3.0.

Azure File share can be mounted on Windows machine either on-premises or in Azure VM depending on OS version. Below table illustrates the

Windows Version SMB Version Mountable On Azure VM Mountable On-Premise
Windows 7 SMB 2.1 Yes No
Windows Server 2008 R2 SMB 2.1 Yes No
Windows 8 SMB 3.0 Yes Yes
Windows Server 2012 SMB 3.0 Yes Yes
Windows Server 2012 R2 SMB 3.0 Yes Yes
Windows 10 SMB 3.0 Yes Yes
Note

We always recommend taking the most recent KB for your version of Windows.

Prerequisites for Mounting Azure File Share with Windows

  • Storage Account Name: To mount an Azure File share, you will need the name of the storage account.

  • Storage Account Key: To mount an Azure File share, you will need the primary (or secondary) storage key. SAS keys are not currently supported for mounting.

  • Ensure port 445 is open: Azure File storage uses SMB protocol. SMB communicates over TCP port 445 - check to see if your firewall is not blocking TCP ports 445 from client machine.

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: This can be done by opening from the Start Menu, or by pressing Win+E shortcut.

  2. Navigate to the "This PC" item 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".

    A screenshot of the "Map network drive" drop down menu

  3. Copy the UNC path from the "Connect" pane in the Azure portal: A detailed description of how to find this information can be found here.

    The UNC path from the Azure File storage Connect pane

  4. Select the Drive letter and enter the UNC path.

    A screenshot of the "Map Network Drive" dialog

  5. Use the Storage Account Name prepended with Azure\ as the username and a Storage Account Key as the password.

    A screenshot of the network credential dialog

  6. Use Azure File share as desired.

    Azure File share is now mounted

  7. When you are ready to dismount (or disconnect) the Azure File share, you can do so by right clicking on the entry for the share under the "Network locations" in File Explorer and selecting "Disconnect".

Mount the Azure File share with PowerShell

  1. Use the following command to mount the Azure File share: Remember to replace <storage-account-name>, <share-name>, <storage-account-key>, <desired-drive-letter> with the proper information.

    $acctKey = ConvertTo-SecureString -String "<storage-account-key>" -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential -ArgumentList "Azure\<storage-account-name>", $acctKey
    New-PSDrive -Name <desired-drive-letter> -PSProvider FileSystem -Root "\\<storage-account-name>.file.core.windows.net\<share-name>" -Credential $credential
    
  2. Use the Azure File share as desired.

  3. When you are finished, dismount the Azure File share using the following command.

    Remove-PSDrive -Name <desired-drive-letter>
    
Note

You may use the -Persist parameter on New-PSDrive to make the Azure File share visible to the rest of the OS while mounted.

Mount the Azure File share with Command Prompt

  1. Use the following command to mount the Azure File share: Remember to replace <storage-account-name>, <share-name>, <storage-account-key>, <desired-drive-letter> with the proper information.

    net use <desired-drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name> <storage-account-key> /user:Azure\<storage-account-name>
    
  2. Use the Azure File share as desired.

  3. When you are finished, dismount the Azure File share using the following command.

    net use <desired-drive-letter>: /delete
    
Note

You can configure the Azure File share to automatically reconnect on reboot by persisting the credentials in Windows. The following command will persist the credentials:

cmdkey /add:<storage-account-name>.file.core.windows.net /user:AZURE\<storage-account-name> /pass:<storage-account-key>

Next steps

See these links for more information about Azure File storage.

Conceptual articles and videos

Tooling support for Azure File storage

Blog posts

Reference