Introduction to Azure File Storage

Azure Files offers fully managed cloud file shares that are accessible via the industry-standard Server Message Block (SMB) protocol and Network File System (NFS) protocol. This means you can "lift and shift" legacy applications that rely on file shares to Azure. Azure Files can be mounted concurrently by the cloud or on-premises deployments of Windows, Linux, and macOS.

What is Azure Files?

Azure Files provides a fully managed file share that you can access from anywhere. It's built on top of Azure Storage and integrates seamlessly with other Azure services. Unlike Blob Storage, which is object storage, Azure Files provides a hierarchical namespace and supports file locking, making it suitable for traditional file share workloads.

With Azure Files, you get:

Key Features

Common Use Cases

Lift and Shift Applications

Migrate traditional file-share-dependent applications to the cloud without significant re-architecture. Examples include shared configuration files, application executables, and shared user data.

Development and Testing

Provide shared storage for development tools, build artifacts, and test environments across multiple virtual machines.

Getting Started

To start using Azure File Storage, you need an Azure subscription. You can create a storage account, and then create a file share within that account.

1. Create a Storage Account

A storage account is a container for Azure Storage services. You can create one using the Azure portal, Azure CLI, or PowerShell.

# Example using Azure CLI
az storage account create --name mystorageaccount --resource-group myresourcegroup --location eastus --sku Standard_LRS --kind StorageV2
            

2. Create a File Share

Once you have a storage account, you can create a file share. You can specify a quota for the share.

# Example using Azure CLI
az storage share create --name myfileshare --account-name mystorageaccount --quota 1024 --output none
            

3. Mount the File Share

You can mount the file share to your client machines using SMB or NFS. The Azure portal provides connection strings and commands for mounting.

Example (Windows PowerShell):

$connectionString = "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=YOUR_ACCOUNT_KEY;EndpointSuffix=core.windows.net"
$shareName = "myfileshare"
$mountedPath = "Z:\"

# Install the SMB module if not already present
if (-not (Get-Module -ListAvailable -Name SmbShare)) {
    Install-Module -Name SmbShare -Force
}

# Mount the share
New-SmbMapping -LocalPath $mountedPath -RemotePath "\\mystorageaccount.file.core.windows.net\$shareName" -Credential (Get-Credential)
            

Example (Linux):

sudo apt-get update
sudo apt-get install cifs-utils

# Create a mount point
sudo mkdir /mnt/mymount

# Mount the share (using account key for simplicity, consider Azure AD for production)
sudo mount -t cifs //mystorageaccount.file.core.windows.net/myfileshare /mnt/mymount -o vers=3.0,username=mystorageaccount,password='YOUR_ACCOUNT_KEY',dir_mode=0777,file_mode=0777,serverino
            

For production environments, it is highly recommended to use Azure AD integration for authentication instead of account keys.

Azure File Storage provides a flexible and scalable solution for all your file storage needs in the cloud. Explore the documentation further to learn about performance tuning, security configurations, and integration with Azure File Sync.