I recently had to setup a SharePoint farm on Azure. It’s a great tool in terms of provisioning delays and simplicity of usage. In order to setup my farm I needed ISO files (installation media). The most recommended way to do that according to the documentation is to locally create a vhd file and upload it to azure to then attach it to your machine.
As a fellow developer I thought right away “azure has a great tooling inside Visual Studio, we have a storage explorer, let’s use it”. If you did not know it, it is located in the server explorer window on the left.
Once the vhd has been uploaded, I connected to azure management portal and tried to create a disk (understand something that vm’s can use) from the file to then attach it to vm’s.
But I got an exception after starting this task “the VHD must be stored as a page blob”.
After several research I learnt Azure has two main files storage format:
Page blob : mainly used for vhd’s (CloudPageBlob) https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudpageblob(v=azure.10).aspx
Block Blob : for other files (CloudBlockBlob) https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblockblob(v=azure.10).aspx
We can also make the difference with mime type (the file I want to use as a disk is the first one)
How to make it work
I found the solution reading this blog post. The author explains that we had to use a special tool in order to upload vhd’s to Azure (which is now deprecated), he also explains how to do it via powershell.
The general idea is you need to tell azure “that is a vhd I’m sending you” so it can store the file using the right format and you can use it as a disk later. It’s a pity that we cannot specify that when using Visual Studio’s explorer.
I hope you’ll save time reading me.