Latest posts by Travis Roberts (see all)
- Azure Redeploy: If RDP or application access to an Azure VM fails - Mon, Sep 9 2019
- Azure Bastion overview and configuration - Thu, Jul 25 2019
- Azure and web automation with VisualCron - Wed, Jul 17 2019
Virtual Machines in Azure are bound to an Azure host server at the time of creation. Unlike most popular on-premises hypervisors, there is no live migration tool that does a non-disruptive VM move to a new host. The VM will only move to a new host if the host it resides on fails or if the VM is moved with the Redeploy tool. This article outlines what the Redeploy tool is, as well as how and when to use it.
The Microsoft documentation states that Redeploy moves the VM to a new host. More specifically, redeploy starts by capturing the state of the VM. Next, the VM is shut down and removed from the host. The virtual disks are left in place. The VM is recreated on a different host with the same settings and virtual disks. Once finished, the VM is restarted.
Troubleshooting with Redeploy ^
Redeploy is used to troubleshoot issues with VMs, in particular it may resolve issues with remote connectivity such as RDP. Problems that Redeploy may address are not limited to connectivity issues, however. Although not common, underlying host issues could impact a VM in multiple ways. For example, I have seen an underlying host issue cause random reboots on a virtual appliance that Redeploy resolved.
From the perspective of the VM, nothing has changed after it has been Redeployed. It has the same settings as before and the same OS and data disks. At the virtual machine level, the redeploy is nothing more than a reboot. This is important because if the problem is with the OS, a redeploy won’t fix the issue. The problem will move to the new host with the VM.
At what point is Redeploy appropriate to use? If you can’t access the VM, Redeploy is a good first step. Odd issues that are not identifiable with normal troubleshooting steps could be a symptom of an underlying host issue. Redeploy the VM early in the troubleshooting process to rule out host issues as the problem.
Redeploy a VM in the Portal ^
The Redeploy process is straight forward. The most important thing to keep in mind is that Redeploy will shut down the VM and it will be unavailable until the VM is reprovisioned on the new host.
Start by verifying the VM is in a running state.
Find and click on the Redeploy option next to an icon of a hammer under Support + Troubleshooting.
This will take you to the Redeploy page. The only option is the redeploy button at the bottom of the screen. Clicking Redeploy will take the VM offline and start the Redeploy process.
It takes just a few minutes to complete. Once finished, the VM is running on a new host. The Activity Logs will show that the Redeploy ran and if it was successful.
Redeploy a VM by Command Line ^
PowerShell is an option for those who prefer command line, or need to add Redeploy to an automation task. Redeploy is part of the Set-AzVM or Set-AzureRMVM command, depending on the Azure PowerShell module in use. The input required for the command includes the VM name and the Resource Group:
Set-AzVM -ResourceGroup “ResourceGroup” -Name “VMName” -Redeploy
The complete command and output are illustrated below. Notice the Status indicates success as well as the start and end time. Any errors would also display in the output should a problem occur.
For many organizations, the journey to the cloud starts with migrating servers from on-premises data centers to Azure. Understanding the tools available to manage servers in azure will help resolve issues faster if they should occur. Redeploy is one tool in the Azure toolbox to help address issues and get servers up and running faster in the event of an underlying host issue.