Azure Files Quickstart

Deploy and access SMB shares for your cloud applications

This guide will walk you through the essential steps to get started with Azure Files, a fully managed cloud file share service that is accessible via the industry-standard Server Message Block (SMB) protocol.

Overview

Azure Files offers several benefits, including:

Prerequisites

Step 1: Create an Azure Storage Account

1

Using the Azure Portal:

Navigate to the Azure portal, click "Create a resource", search for "Storage account", and follow the prompts. Ensure you select a Standard_LRS or Standard_GRS replication option for Azure Files.

2

Using Azure CLI:

Open your Azure Cloud Shell or a local terminal with Azure CLI installed and run the following commands:

az group create --name myResourceGroup --location eastus
az storage account create --name mystorageaccountname --resource-group myResourceGroup --location eastus --sku Standard_LRS --kind StorageV2

Replace mystorageaccountname with a unique name for your storage account.

Step 2: Create an Azure File Share

1

Using the Azure Portal:

In your storage account's overview page, select "File shares" under "Data storage" and click "+ File share". Enter a name for your share (e.g., myshare) and set a quota.

2

Using Azure CLI:

Use the following command, replacing placeholders as needed:

az storage share create --name myshare --account-name mystorageaccountname --quota 1024 --output table

Step 3: Mount the Azure File Share

You can mount your Azure File share using SMB on various operating systems. Here's how to mount it on Windows and Linux.

Mounting on Windows

1

Get Storage Account Key:

You'll need your storage account name and a storage account key. You can find these in the Azure portal under your storage account's "Access keys" section.

2

Mount using File Explorer:

Open File Explorer, right-click "This PC", and select "Map network drive...".

  • Folder: Enter \\mystorageaccountname.file.core.windows.net\myshare
  • Drive: Choose an available drive letter.
  • Check "Connect using different credentials".

When prompted for credentials, enter:

  • Username: mystorageaccountname
  • Password: Your storage account key.

Mounting on Linux (Ubuntu Example)

1

Install cifs-utils:

sudo apt update && sudo apt install cifs-utils
2

Create a mount point:

sudo mkdir /mnt/azure
3

Mount the share:

You can mount temporarily or add to /etc/fstab for persistent mounting. For temporary mounting:

sudo mount -t cifs //mystorageaccountname.file.core.windows.net/myshare /mnt/azure -o vers=3.0,username=mystorageaccountname,password=YOUR_STORAGE_ACCOUNT_KEY,dir_mode=0777,file_mode=0777,serverino

Replace YOUR_STORAGE_ACCOUNT_KEY with your actual storage account key. For better security, consider using a credentials file with /etc/fstab.

Security Note: Avoid hardcoding storage account keys directly in scripts or configuration files. Consider using Azure Key Vault for managing secrets or managed identities for secure access.

Next Steps

For more detailed information, please refer to the official Azure Files documentation.