What is Azure Files and how to use it ?

Sanjay Sachdev
6 min readSep 28, 2020
Azure Files

What is Azure Files ?

Azure Files offers fully managed network file storage in the cloud that is accessible via the industry standard Server Message Block (SMB) protocol. Azure file shares can be mounted concurrently on cloud or on-premises deployments of Windows, Linux, and macOS. Additionally, Azure file shares can be cached on Windows Servers with Azure File Sync for fast access near where the data is being used. Because Azure Files is fully managed, deploying it in production scenarios is much easier than deploying and managing a file server or NAS device. It is part of an Azure Storage Account that can be created within an Azure Subscription.

Key benefits

· Shared access. Azure file shares support the industry standard SMB protocol, meaning that you can seamlessly replace your on-premises network file shares with Azure file shares without worrying about application compatibility. Being able to share a file system across multiple machines, applications/instances is a significant advantage with Azure Files for applications that need shareability.

· Fully managed. Azure file shares can be created without the need to manage hardware or an OS. This means you don’t have to deal with patching the server OS with critical security upgrades or replacing faulty hard disks.

· Scripting and tooling. PowerShell cmdlets and Azure CLI can be used to create, mount, and manage Azure file shares as part of the administration of Azure applications. You can create and manage Azure file shares using Azure portal and Azure Storage Explorer.

· Resiliency. Azure Files has been built from the ground up to be always available. Replacing on-premises file shares with Azure Files means you no longer have to wake up to deal with local power outages or network issues.

· Security. Azure Files supports identity-based authentication and access control with Azure Active Directory (Azure AD) (Preview). Azure AD authentication over SMB for Azure Files leverages Azure Active Directory Domain Services to enable domain-joined VMs to access shares, directories, and files using Azure AD credentials.

· Cost. No minimum; pay as you go.

Cost of storage : $0.06 per GiB on Locally Redundant Storage (LRS) Redundancy.

Put, Create Container Operations (per 10,000): $0.015 with LRS Redundancy.

List Operations (per 10,000): $0.015 with LRS Redundancy.

All other operations except Delete, which is free (per 10,000): $0.0015.

Geo-Replication Data Transfer (per GiB): $0.02 with Globally Redundant Storage (GRS) Redundancy.

· Performance.

Maximum request rate per storage account: 20,000 requests per second.

Maximum IOPS per share: 1,000 IOPS on Standard file shares

Target throughput for a single file share: Up to 60 MiB/sec

Creating an Azure File Share from Azure Portal :

1.> Sign into Azure Portal.

2.> Go to the Storage Account section and select the storage account from the list of Storage Accounts on the left, inside which you want to create Azure File Share. You will need a resource group to create the storage account in. You will need a resource group to create the storage account in. You can also select the account kind and replication strategy that you require while creating the storage account.

3.> Select Files from the storage account pane.

Files within an Azure Storage Account

4.> Click on + File Share on the top right.

Add a new file share

5.> Provide Name and Quota for the new file share. The Quota’s current maximum value is 5 TiB:

6.> View your new file share:

Newly added file share

7.> Click on the new Azure File that we just created and we will be redirected to a screen where we can view the files and directories inside the share and we can also upload a File:

Upload a file to the file share

8.> Browse into your file share and manage your directories and files:

Manage files and directories within a file share

Create a file share through PowerShell

1.> To prepare to use PowerShell with Azure, please download and install the Azure PowerShell cmdlets.

2.> Assuming that you already have storage account created, let first create a context for your storage account and the key: The context encapsulates the storage account name and account key. Please insert the storage account name and the key in the below instruction and execute it in a PowerShell window :

$storageContext = New-AzStorageContext <storage-account-name> <storage-account-key>

3.> Create a new File share by executing the below instruction :

$share = New-AzStorageShare logs -Context $storageContext

That is it, a new azure file share should now get created within the storage account of your choice.

How to mount an Azure file share in Windows

1. The easiest way to establish a persistent connection to an Azure File Share is to save your storage account credentials into windows using the “CmdKey” command line utility. The following is an example command line for persisting your storage account credentials into your Windows VM:

C:\>cmdkey /add:<your-storage-account-name>.file.core.windows.net /user:AZURE\<your-storage-account-name> /pass:<your-storage-account-key-which-ends-in==>

2. CmdKey will also allow you to list the credentials it stored:

C:\>cmdkey /list

Currently stored credentials:

Target: Domain:target=filedemo.file.core.windows.net
Type: Domain Password
User: AZURE\filedemo

3. Once the credentials have been persisted, you no longer have to supply them when connecting to your share. Instead you can connect without specifying any credentials:

C:\>net use * \\filedemo.file.core.windows.net\demo1

Drive Z: is now connected to \\filedemo.file.core.windows.net\demo1.

The command completed successfully.

Mount Azure file share with File Explorer

1.> Open File Explorer. This can be done by opening from the Start Menu, or by pressing Win+E shortcut.

2.>Navigate to the This PC item on the left-hand side of the window. This will change the menus available in the ribbon. Under the Computer menu, select Map network drive.

3.>Copy the UNC path from the Connect pane in the Azure portal.

Connect to an Azure File Share

4.>Select the drive letter and enter the UNC path.

Map Network Drive

5.>Use the storage account name prepended with AZURE\ as the username and a storage account key as the password.

Enter credentials

6.>Use Azure file share as desired.

Network Locations

Additional source to get more information on Azure Files:

Azure Storage Account Overview:

--

--

Sanjay Sachdev

Software Engineer, Cloud Architect, Machine Learning Enthusiast