Microsoft Azure Storage and Database Part 15 – Azure File Service – Mount File Share On Window Server Using PowerShell
Hope you all are doing good !!! 🙂 .
In our previous article we have go through the Overview of Azure File Service Today in this article we will continue with Azure File Service and see how to mount or use Azure File Share on a windows virtual machine.
Previous Azure series :
- Learn Basics Of Azure Networking In 60 Hours
- Learn Basic Of Azure Active Directory And Azure Identity And Access Management
- Azure DevOps – Learn at one place
If you have missed our previous articles on Azure Storage and Database Series, please check it in following links.
Mount File Share
W can mount the file share on our local machine by using the SMB 3.0 protocol, or we can use tools like Storage Explorer to access files in our file share. From our application, we can use storage client libraries, REST APIs, PowerShell, or Azure CLI to access our files in the Azure file share.
Mount File Share On Windows VM
In this article we will create a file share and mount it on our windows virtual machine. Let’s go through the following steps.
Step 1 – Log-in to Azure portal => Navigate to Storage Account as showing in the following figure.
Step 2 – Select File Shares under Data Storage section and click + File Share to create a new File Share to our storage account.
Step 3 – Provide all required information like Name ,Quota and Tiers and then click Create button to create the File Share as showing in the following figure. Details of different Tires can be found in our previous article.
Step 4 – As showing in the above figure our File Share is ready . Click Upload button to upload files through this Azure portal and browse the file want to upload .
Step 5 – As we can see in the above figure we have 2 files in our File Share. Now we will login to our virtual machine to mount the file share as a drive.
As we can see in the above figure, we have successfully logged in to our virtual machine. If we see in the following figure, before mount Azure file share there are 3 drives ( C, D,E) exist in the VM.
Step 6 – Now lets open the powershell in our virtual Machine (VM) and try to mount the file share using powershell script. Here we needs the trick to get the proper powershell script. We don’t have to worry for this because MS Azure doing this for us.
Step 7 – Let’s go back to azure portal and move to File Share overview page and click Connect as showing in the following figure.
Step 8 – It will open Connect window and if we can see in the following figure, we can see many things in that window.
- We can see there is a tab section where it shows different tabs ( Windows , Linux and macOS).
- There is a Drive Letter dropdown list which showing all alphabet to choose as the selectee Drive of the mounted share File.
- Authenticated method , here we keep the default option “Storage account key” because Active Directory not enabled for this storage account.
- The script, which can be used to mount the Azure file share on our selected OS.
If we select Windows OS as showing in he figure the respected script will be available to copy and same way if we chose for Linux OS, it will show different script same with macOS.
Step 9 – Now copy the script then let’s move to the PowerShell window, which we have opened in our virtual machine. Paste the copied script in PowerShell as showing in the following figure , it will first test the connection then it will mount the file share as showing following figures.
Step 10 – Let’s compare files in both place as in Azure portal file share and mounted drive in VM. As showing in the following figure, files are same in both place.
Step 11 – To test the synchronization, Let’s move a text file into the mounted drive in VM.
Step 12 – After moving the file into the mounted drive, let’s move to Azure portal and refresh the File Share page. As showing in the figure, the new file is visible in the Azure File Share.
Same way we can mount the File Share to other OS using their respected scripts.
I hope this is informative to you. Please let me know if I missed anything important or if my understanding is not up to the mark. Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.
If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles.
Thanks for reading 🙂 .Today