A step-by-step guide to getting started with Azure File Storage, covering creation, connection, and basic operations.
Before you begin, ensure you have the following:
Azure File Storage is organized into shares. A file share is the root container for your files. You can create a share using the Azure portal, Azure CLI, PowerShell, or client libraries.
Navigate to your storage account in the Azure portal.
In the left-hand menu, under "Data storage," select "File shares."
Click the "+ File share" button.
Enter a unique name for your file share (e.g., myshare), set the tier (Transaction optimized, Hot, Cool), and optionally a quota. Click "Create."
az storage share create \
--name myshare \
--account-name mystorageaccount \
--quota 1024 \
--output table
Replace myshare with your desired share name and mystorageaccount with your storage account name.
Once a file share is created, you can mount it to your on-premises or cloud-based machines. The method of mounting depends on your operating system.
You can use the net use command to mount a share. You'll need your storage account name and one of its access keys.
net use Z: \\mystorageaccount.file.core.windows.net\myshare /user:Azure\mystorageaccount YOUR_STORAGE_ACCOUNT_KEY
Replace Z: with your desired drive letter, mystorageaccount with your storage account name, myshare with your share name, and YOUR_STORAGE_ACCOUNT_KEY with your actual storage account key.
Use the mount command with the CIFS/SMB protocol.
cifs-utils package installed (e.g., sudo apt-get install cifs-utils on Debian/Ubuntu).
sudo mkdir /mnt/myshare
sudo mount -t cifs //mystorageaccount.file.core.windows.net/myshare /mnt/myshare -o vers=3.0,username=mystorageaccount,password=YOUR_STORAGE_ACCOUNT_KEY,dir_mode=0777,file_mode=0777,serverino
Replace placeholders as described for Windows. The dir_mode and file_mode can be adjusted based on your security requirements.
Use Finder's "Connect to Server" option or the mount_smbfs command.
From Finder: Go > Connect to Server... and enter smb://mystorageaccount.file.core.windows.net/myshare.
mkdir ~/mnt/myshare
mount_smbfs //mystorageaccount:YOUR_STORAGE_ACCOUNT_KEY@mystorageaccount.file.core.windows.net/myshare ~/mnt/myshare
Once the share is mounted, you can interact with it like any other local directory.
Simply copy the file into the mounted directory.
# Example on Windows
copy C:\path\to\your\local\file.txt Z:\
# Example on Linux/macOS
cp /path/to/your/local/file.txt /mnt/myshare/
Copy the file from the mounted directory to your local system.
# Example on Windows
copy Z:\remote_file.txt C:\path\to\save\
# Example on Linux/macOS
cp /mnt/myshare/remote_file.txt /path/to/save/
Congratulations! You've successfully created and mounted an Azure File share. Here are some resources for further exploration: