Prerequisites:

  • A Microsoft Azure Account.

As an admin or user, you may find yourself in a situation where by you need to extend file sharing capabilities to a storage space somewhere in the cloud and this is where Azure file shares come in handy. In this step-by-step tutorial, we are going to create an Azure file share and map it as a network drive to our on-premise systems which will be running both Windows and Linux.

The first step is to create the file share in Azure by browsing to our target Azure storage account, And then we create a File Share as shown below:

Azure file shares support SMB 3.0 Protocol which means faster file access, encryption of data in transit and other benefits. At the same time make sure that on your local network port 445 is accessible because it's over this port that SMB communicates. Next step is to add our first file share on a Windows Machine.

On the Windows Machine we map a network drive and insert the URL of our file share using the syntax  as shown. Make sure to change the name to your storage account name and the file share to your file share name.

\\techtalkrg2diag.file.core.windows.net\publicfiles

So the trick here is that the Username is AZURE\ [your-storage-account-name] and the password is the access key to your storage account which can be got from the access keys section of your storage account in the portal. After that, you should be able to see the Azure file share as shown below.

Mount an Azure file share in Linux

First step here is to browse to our storage account, open up the Azure file share. From there we then click on connect as shown in the screenshot below and copy the respective Linux script that matches our file share.

When that is done, we then head over to our on-premises Linux VM, copy and run the script below with root privileges. Before you do that you should make sure that you have the "cifs"  and "nfs-common" packages installed. On newer releases of most Linux distributions, these are usually installed by default.

Also make sure that before you run the command, you have already created a mount folder somewhere within the filesystem. For example I created a folder called "fileshare" within my home directory "/home/billy/fileshare". This is the only portion of the script that you will need to change.

Finally our fileshare is connected to Azure and to confirm, we browse our directory and get to the fileshare.