Azure VM change OS Disk

To create a new VM, using the existing disk you should be able to do so with the following PowerShell (this is simplified, I haven't added any NICS etc.).

$vm = New-AzureRMVMConfig -VMName $vmName -VMSize $vmSize
$osDiskUri = "https://nameofyourstorageaccount.blob.core.windows.net/vhds/nameofyourvhd.vhd"
$vm = Set-AzureRMVMOSDisk -VM $vm -Name $osDiskName -VhdUri $osDiskUri -CreateOption attach -Windows
New-AzureRMVM -ResourceGroupName $rgName -Location $location -VM $vm 

In case if you need non-power-shell way out of this then following worked for me.

I had accidentally deleted one of the SQL Server VM from my SharePoint 2013 farm using the new Azure Portal. The disk VHD file was still intact on the blob storage of my storage account as usual.

  1. Download CloudXplorer. Launch > Manage Account> Azure Blob Storage Account. Enter storage account name and the key (you'll get it from azure portal). You see all VHD files, etc. Locate the one that matches name of the VM you deleted. Pick the most recent one that you want to restore to. Note down its full name (*.vhd). Then, right click on that and select break lease.

  2. Go back to Azure Portal. Delete the NIC and disassociate the Public Static IP. Create a new VM with exactly same configuration as before. When it is ready, it will provision new NIC and new OS Disk. Stop the VM and go to Disks section in the properties. Note down the full url of the VHD file in use. Go back to CloudXplorer and hit refresh. Search for the new VHD that was created and copy its name. Delete it. Then rename the original one with the name you copied.

  3. Go back to Azure Portal. Associate the public static IP with newly created NIC for the new VM. (In my case internal IP's were preserved because no other VMs were being provisioned at that moment.) Then, start the VM. That's it.

No impact on the SharePoint farm.