azurecloudvirtual-machinepackerhotswap

Is it possible to change the image running on a virtual machine in Azure without recreating it


Our development environment has a bunch of virtual machines running different versions of our software. I want to be able to replace the Managed Image that is running on a VM, without having to destroy and recreate it.

The images are created using packer, which provisions them with the correct software and dependencies.

Example of Current Workflow:

Machine A is running on Managed Image v2.5, which runs software with a dependency on Tomcat 10. To fix a bug in v2.2, which depends on Tomcat 9 and thus cannot run on the same VM without changing the dependencies, I have to:

  1. Destroy the VM
  2. Recreate it using the same arguments (name, size, etc) but based on Managed Image v2.2
  3. Attach the network interface and disks
  4. Restart it

If feel like there should be an easier solution to this, where it is possible to hot-swap the images, without recreating the full virtual machines. I've looked into swapping the OS disk, but I couldn't figure out a solution that would work with Managed Images instead of VHD's.


Solution

  • As per official article, its not Supported.

    Microsoft does not support an upgrade of the operating system of a Microsoft Azure virtual machine. Instead, you should create a new Azure virtual machine that is running the supported version of the operating system that is required and then migrate the workload.

    Official article : https://support.microsoft.com/en-us/help/2721672/microsoft-server-software-support-for-microsoft-azure-virtual-machines

    Instead you can use windows server migration tool that would assist you in roles and feature's migration Install, use, and remove Windows Server migration tools

    Similar issue discussed at Can you do in-place updating/upgrading of Azure VM Operating System?