- A Microsoft Azure Account.
As an admin or user, you may find yourself in a situation whereby 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 will create an Azure file share and map it as a network drive to our on-premise systems 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. Simultaneously, make sure that on your local network, port 445 is accessible because it's over this port that SMB communicates. The next step is to add our first file share on a Windows Machine.
We map a network drive on the Windows Machine 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.
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 that is accessed 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
The first step here is to browse to our storage account, open up the Azure file share. 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 you have already created a mount folder somewhere within the filesystem before you run the command. 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 file share is connected to Azure, and to confirm, we browse our directory and get to the file share.