Getting Started with Azure File Storage

Welcome to the guide for Azure File Storage! This document will walk you through the basics of creating, configuring, and using Azure Files for your cloud and hybrid storage needs.

Introduction to Azure Files

Azure Files provides a fully managed cloud file share that is accessible via the industry-standard Server Message Block (SMB) protocol and Network File System (NFS) protocol. This allows you to "lift and shift" legacy applications that rely on file shares to Azure. You can also mount Azure File shares concurrently from all of your cloud or on-premises applications.

What is Azure Files?

Azure Files is a cloud-based file storage service that offers:

Key Features

Getting Started with Azure Files

To begin using Azure Files, you'll need an Azure subscription and an Azure Storage Account. Follow these steps to set up your first file share.

Step 1: Create an Azure Storage Account

A storage account is a container for all your Azure Storage data objects, including blobs, file shares, queues, and tables. You can create a storage account using the Azure portal, Azure CLI, or Azure PowerShell.

Note: When creating a storage account, choose the FileStorage account kind for premium file shares or StorageV2 (general purpose v2) for standard file shares.

Using Azure Portal:

  1. Sign in to the Azure portal.
  2. Search for "Storage accounts" and select it.
  3. Click "+ Create".
  4. Fill in the required details: Subscription, Resource group, Storage account name (globally unique), Region, and Performance tier (Standard or Premium).
  5. Under the "Advanced" tab, ensure "Enable hierarchical namespace" is set to disabled for Azure Files.
  6. Review and create the storage account.

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 are stored in those directories.

Using Azure Portal:

  1. Navigate to your newly created storage account in the Azure portal.
  2. In the left-hand menu, under "Data storage", select "File shares".
  3. Click "+ File share".
  4. Enter a name for your file share (e.g., myshare).
  5. Set the Quota (maximum 5 TiB for standard, 100 TiB for premium).
  6. Select the Tier (Transaction optimized, Hot, Cool for standard; Premium for premium file shares).
  7. Click "Create".

Step 3: Mount the File Share

Mounting a file share allows your client machines to access it as if it were a local drive or directory. The mounting process varies slightly depending on the operating system.

Tip: Ensure your client machine can connect to Azure via the internet. For private network access, consider using Azure Private Link or a VPN connection.

Accessing from Windows

You can mount an Azure File share on Windows using Server Message Block (SMB). You'll need the storage account name and the access key.

  1. Navigate to your file share in the Azure portal.
  2. Click "Connect".
  3. Select "Windows" and choose the drive letter you want to use.
  4. Copy the generated script.

Alternatively, you can use the following PowerShell command:

New-PSDrive -Name  -PSProvider FileSystem -Root "\\.file.core.windows.net\" -Persist -Scope Global

You will be prompted for credentials. Use the storage account name as the username and the storage account key as the password.

Accessing from Linux

Mounting on Linux also uses SMB or NFS. For SMB, you'll need to install the cifs-utils package.

Using SMB:

  1. Install cifs-utils:
    sudo apt-get update && sudo apt-get install cifs-utils
    (For Debian/Ubuntu) or
    sudo yum install cifs-utils
    (For RHEL/CentOS/Fedora).
  2. Create a mount point:
    sudo mkdir /mnt/myshare
  3. Mount the share:
    sudo mount -t cifs \\\\.file.core.windows.net\\ /mnt/myshare -o vers=3.0,username=,password=,dir_mode=0777,file_mode=0777,serverino

For persistent mounts, edit /etc/fstab.

Accessing from macOS

Mounting on macOS is similar to Linux, using SMB.

  1. Open Finder.
  2. Go to "Go" -> "Connect to Server...".
  3. Enter the server address:
    smb://.file.core.windows.net/
  4. Click "Connect".
  5. You will be prompted for credentials. Enter the storage account name and its access key.

Best Practices

Next Steps

Now that you've successfully set up and mounted your Azure File share, you can explore more advanced features: