Search code examples
azureazure-storageazure-virtual-machinedrive-mapping

Mount Azure Fileshare to Azure VM when VM is created


I'm looking for a solution to mount an Azure Fileshare on to my Azure Virtual Machine (Windows 10) when the virtual machine is created. There is this guide for manually map the Azure Fileshare to an existing (virtual) machine, and that works fine, but I want that to be done when the virtual machine is created.

Basically, once the virtual machine is ready and me or some other user logs in, the Fileshare is available as a mapped drive.

How would that work? Do I need to set a Powershell command that will be executed during the creation of the virtual machine or is this done with an ARM template, and how?


Solution

  • For this requirement, I can give you two solutions. One is to use the cloud-init, which configures the VM at the creation time of the VM. Another is the VM extension, which configures the VM after the creation time of the VM, but when you use it together with the creation, it will configure the VM Immediately after the creation. You can choose one as you want.