Azure File Storage Quickstart
This guide will walk you through the essential steps to get started with Azure File Storage, a fully managed cloud file share service that is accessible via the industry-standard Server Message Block (SMB) protocol.
Step 1: Create an Azure Storage Account
Before you can create a file share, you need a storage account. If you don't have one, you can create it through the Azure portal, Azure CLI, or Azure PowerShell.
Using Azure Portal:
- Sign in to the Azure portal.
- Navigate to "Storage accounts" and click "Create".
- Fill in the required details: Subscription, Resource group, Storage account name (globally unique), Region, and Performance tier.
- Under the "Advanced" tab, ensure "File shares" is enabled.
- Review and create the storage account.
Using Azure CLI:
az storage account create \
--name mystorageaccount <your_unique_storage_account_name> \
--resource-group myresourcegroup \
--location eastus \
--sku Standard_LRS > /dev/null
Step 2: Create a File Share
Once your storage account is created, you can create a file share within it. File shares are organized into directories and files.
Using Azure Portal:
- Go to your storage account in the Azure portal.
- Under "Data storage", select "File shares".
- Click "+ File share".
- Enter a name for your file share (e.g.,
myshare) and specify a quota. - Click "Create".
Using Azure CLI:
az storage share create \
--name myshare \
--account-name mystorageaccount \
--quota 1024 > /dev/null
Step 3: Mount the File Share
To access your file share, you need to mount it to your client machine. The mounting process varies depending on your operating system.
Mounting on Windows:
You can use the net use command. You'll need your storage account name and one of its access keys.
- Get your storage account key from the Azure portal (under "Access keys").
- Open Command Prompt or PowerShell as administrator.
- Run the following command, replacing placeholders:
net use Z: \\mystorageaccount.file.core.windows.net\myshare /user:AZURE\
Note: Replace Z: with your desired drive letter.
Mounting on Linux:
You can use the mount command with the CIFS protocol.
- Install the CIFS common utilities if you haven't already:
sudo apt-get update && sudo apt-get install cifs-utils(Debian/Ubuntu) orsudo yum install cifs-utils(RHEL/CentOS). - Create a mount point directory:
sudo mkdir /mnt/myshare - Mount the share:
sudo mount -t cifs //mystorageaccount.file.core.windows.net/myshare /mnt/myshare -o vers=3.0,username=,password=,dir_mode=0777,file_mode=0777,serverino
Note: For persistent mounts, consider adding an entry to /etc/fstab.
Mounting on macOS:
You can use Finder's "Connect to Server" option or the mount command.
Finder:
- Open Finder.
- Go to "Go" > "Connect to Server...".
- Enter:
smb://mystorageaccount.file.core.windows.net/myshare - Click "Connect" and authenticate with your storage account name and key.
Step 4: Upload and Download Files
Once mounted, you can interact with your file share like any other local directory.
Upload: Copy files into the mounted drive/directory.
Download: Copy files from the mounted drive/directory to your local machine.
Next Steps
Congratulations! You've successfully set up and accessed an Azure File Share. Here are some ideas for what to do next:
- Explore Azure Blob Storage for object storage.
- Learn about monitoring your storage usage and performance.
- Integrate File Storage with Azure Compute Gallery.
- Secure your file shares using network security options.