How to preserve the drive letter for protected virtual machines that are failed over or migrated to Azure

Hi Readers,

If you already worked with Microsoft Azure Site Recovery or migrated VMs from on premise to Azure, you noticed that the D: Drive has been automatically assigned to a Temporary Storage disk. The temporary disk is very useful for data which, you guessed it, is temporary in nature. A great example of this type of data for Windows is the pagefile

But now, what happens if the VM you plan to migrate to Microsoft Azure is already using the D drive to store Data, Applications, …. The answer is simple as problematic, your data drive will not be mounted, and instead you will have this Temporary Storage drive mounted. Of course, you can change manually change the drive letter assigned to this Temporary Storage and re-assigned the letter D: to your data disk. Problem solved, but this is still a manual action that you have to do each time that you are moving/failover/migrate your VMs to Azure.

To avoid this, Microsoft published the KB3031135: How to preserve the drive letter for protected virtual machines that are failed over or migrated to Azure

By setting the SAN policy to “OnlineAll,” you can make sure that the drive letter is maintained when the virtual machine starts to run in Azure.

To view the current SAN policy from the guest system, follow these steps:

  • On the VM (not on the host server), open an elevated Command Prompt window.
  • Type diskpart.
  • Type SAN.

If the drive letter of the guest operating system is not maintained, this command returns either “Offline All” or “Offline Shared.”
To make sure that all disks are brought online and are both readable and writeable, set the SAN policy to OnlineAll. To do this, run the following command at the DISKPART prompt:


In the case of Azure Site Recovery, wait for the Copy Frequency (Recovery Point Objective) value to be configured to make sure that the changes are replicated to Azure. Then, run a test failover to verify whether the drive letters are preserved.
As you could see, I did a fail over of my VM to Azure, my data disk kept his D: and the Azure Temporary Storage disk has been automatically assigned to the next available letter E:

Now if you are a PowerShell Master/Geek/Guru/Lover…like my colleague Stijn Callebaut, below the PowerShell way to do it J

Set-StorageSetting –NewDiskPolicy OnlineAll

I hope this will help you to use Azure as your Recovery Datacenter.


About Christopher Keyaert

Christopher Keyaert is a Consultant, focused on helping partners to leverage the System Center and Microsoft Azure cloud platform. He is also a Microsoft Most Valuable Professional (MVP) for Cloud and Data Center Management and a Microsoft Certified Trainer (MCT).
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *