How to mount an Azure Files share in Windows
This guide provides step-by-step instructions on how to mount an Azure Files share to a Windows client, allowing you to access your cloud-based file storage as if it were a local drive.
Prerequisites
- An Azure subscription.
- An Azure Storage account with an Azure Files share.
- Windows client (Windows 10, Windows Server 2016, or later).
- Appropriate network connectivity to Azure.
Step 1: Obtain Storage Account Key and Share Name
You'll need the storage account name and one of its access keys to authenticate. You'll also need the name of the Azure Files share you wish to mount.
- Navigate to your Azure Storage account in the Azure portal.
- In the left-hand menu, under "Security + networking", select "Access keys".
- Copy one of the keys (e.g., "key1") and the Storage account name.
- Navigate to your Azure Files share. The share name is typically the name you provided when creating it.
Step 2: Mount the Azure Files Share using File Explorer
This is the simplest method for interactive mounting.
- Open File Explorer on your Windows machine.
- Right-click on "This PC" (or "Computer") in the left-hand navigation pane.
- Select "Map network drive...".
- In the "Map Network Drive" dialog box, choose an available drive letter.
- In the "Folder" field, enter the path to your Azure Files share using the following format:
Replace\\YOUR_STORAGE_ACCOUNT_NAME.file.core.windows.net\YOUR_SHARE_NAMEYOUR_STORAGE_ACCOUNT_NAMEandYOUR_SHARE_NAMEwith your actual values. - Check "Connect using different credentials".
- Click "Finish".
- In the "Windows Security" dialog box, enter the credentials:
- Username:
YOUR_STORAGE_ACCOUNT_NAME - Password: Paste the Storage Account Key you copied earlier.
- Username:
- Click "OK".
If successful, the Azure Files share will appear as a mapped network drive in File Explorer.
Step 3: Mount the Azure Files Share using PowerShell
For scripting and automation, PowerShell is a powerful tool.
Replace the placeholders with your actual storage account name, share name, and storage account key.
$storageAccountName = "YOUR_STORAGE_ACCOUNT_NAME"
$shareName = "YOUR_SHARE_NAME"
$storageAccountKey = "YOUR_STORAGE_ACCOUNT_KEY"
$driveLetter = "Z:" # Or any available drive letter
$connectionUrl = "\`\`$storageAccountName.file.core.windows.net\`\`$shareName"
# Use New-PSDrive to map the network drive
New-PSDrive -Name $driveLetter.Trim(':') -PSProvider FileSystem -Root "\\$connectionUrl" -Persist -Scope Global -Credential (New-Object System.Management.Automation.PSCredential($storageAccountName, (ConvertTo-SecureString $storageAccountKey -AsPlainText -Force)))
Write-Host "Azure Files share '$shareName' mounted to '$driveLetter'."
Step 4: Mount the Azure Files Share using Command Prompt
The net use command can also be used for mounting.
Replace the placeholders with your actual storage account name, share name, and storage account key.
net use Z: \\YOUR_STORAGE_ACCOUNT_NAME.file.core.windows.net\YOUR_SHARE_NAME /user:YOUR_STORAGE_ACCOUNT_NAME YOUR_STORAGE_ACCOUNT_KEY /persistent:yes
Important Notes:
Ensure your Windows client has SMB 3.0 or later enabled for optimal performance and security.
If you encounter connectivity issues, verify your network firewall rules and ensure that port 445 (SMB) is open.
For domain-joined machines, consider using Azure AD DS for Kerberos authentication, which provides a more seamless experience.
Troubleshooting
- "Network path not found" error: Double-check the storage account name, share name, and ensure you are using the correct format for the path. Verify network connectivity.
- "Access is denied" error: Ensure you are using the correct storage account key and that the key has not expired or been revoked.
- Performance issues: Ensure you are using SMB 3.0 or later. For high-performance workloads, consider using Azure NetApp Files.