Swap Boot Disk in Azure VM
Customer lost login credentials for a Azure VM. Azure provide a way to reset Password for VM using Azure portal or via Azure cli/powershell.
Before you swith disk, make sure you note down current name of the boot disk, so if anything went wrong with new disk, you can swap back.
You can run following commands in Azure Powershell
$VmName = "" $NewOSdiskName = " " $SubscriptionID = " " $ResourceGroupName = " " # this only needed of you are running from your own powershell install. Login-AzureRmAccount Select-AzureRmSubscription -SubscriptionId $SubscriptionID $OSdiskId = (Get-AzureRmDisk -ResourceGroupName $ResourceGroupName -DiskName $NewOSdiskName).Id $VM = Get-AzureRmVM -ResourceGroupName $ResourceGroupName -Name $VmName $VM | Stop-AzureRmVM Set-AzureRmVMOSDisk -VM $VM -Name $NewOSdiskName -ManagedDiskId $OSdiskId $VM | Update-AzureRmVM $VM | Start-AzureRmVM
If you want to revert changes, replace
$NewOSdiskName = ""
With old disk name. Then run the commands again.
https://azure.microsoft.com/en-us/blog/os-disk-swap-managed-disks/
See Azure