Mount an Azure Files share on macOS
This guide explains how to mount an Azure Files share on a macOS client using the Server Message Block (SMB) protocol. Azure Files offers fully managed file shares in the cloud that are accessible via the industry-standard Server Message Block (SMB) protocol.
Prerequisites
- An Azure Storage account with a file share. If you don't have one, you can create it using the Azure portal or Azure CLI.
- The storage account name and its access key. You can find these in the Storage account's "Access keys" section in the Azure portal.
- A macOS client with a supported version of macOS.
Steps to Mount
1. Obtain Storage Account Name and Key
Navigate to your storage account in the Azure portal. In the left-hand menu, select Access keys. Copy the storage account name and one of the keys. You'll need these for authentication.
2. Mount the Share using Finder
macOS provides a straightforward way to connect to SMB shares:
- Open Finder.
- From the menu bar, select Go > Connect to Server... (or press
Cmd + K). - In the "Server Address" field, enter the SMB connection string in the following format:
Replacesmb://YOUR_STORAGE_ACCOUNT_NAME.file.core.windows.net/YOUR_FILE_SHARE_NAMEYOUR_STORAGE_ACCOUNT_NAMEwith your storage account name andYOUR_FILE_SHARE_NAMEwith the name of your file share. - Click Connect.
- You will be prompted for credentials. Choose Registered User.
- Enter the following:
- Name:
YOUR_STORAGE_ACCOUNT_NAME - Password: Your storage account access key.
- Name:
- Click Connect.
Your Azure Files share should now be mounted and accessible in Finder under "Locations" or as a mounted volume.
3. Mount the Share using the Terminal (Optional)
For command-line users, you can mount the share using the mount command:
First, create a mount point directory:
mkdir ~/AzureShare
Then, use the mount command:
mount -t cifs //YOUR_STORAGE_ACCOUNT_NAME.file.core.windows.net/YOUR_FILE_SHARE_NAME ~/AzureShare -o vers=3.0,username='YOUR_STORAGE_ACCOUNT_NAME',password='YOUR_STORAGE_ACCOUNT_ACCESS_KEY',sec=ntlmssp
Replace the placeholders with your actual storage account name, file share name, and access key.
To unmount the share, use:
umount ~/AzureShare
Troubleshooting
- Connection timed out: Ensure that your firewall is not blocking SMB traffic (ports 445 and 139).
- Authentication failed: Double-check your storage account name and access key. Ensure you are using the correct format for the username and password.
- Share not found: Verify that the file share name is spelled correctly and exists within your storage account.
Security Considerations
- Always use SMB 3.0 or later for encrypted connections.
- Consider using Azure AD authentication for enhanced security when possible.
- Store your access keys securely and avoid hardcoding them in scripts or applications.
For more advanced configurations or specific requirements, refer to the official Azure documentation on Azure Files integration with macOS.