Part 25 – How to Upgrade Windows 2012/2016/2019 Azure VM

Loading

Windows versions are not yet supported for in-place system upgrades in Azure, so this workaround should hopefully serve the purpose.

There is no console console access to an Azure based IAAS virtual machine so when things go wrong you cannot fix it and we will have to resort to restoring a backup. 

Prerequisites

  • Collect the systeminfo
  • Take a backup of VHDs (OS & data disks), make note of extensions, NIC.
  • Enable boot diagnostic
  • Take Screenshot of Disks from Portal
  • Backup the VM to Azure Backup
  • Disable and remove the disk encryption.
  • Take the snapshot or full backup of the C drive and Other data drives
  • Log in to the server and uninstall System Center Endpoint Protection (SCEP) if installed.
  • A second VM with HyperV installed and configured
  • Download the OS drive C:\ on to a hyperv VM.
  • Download Windows server 2019 bit (Windows Server 2019 Standard and Datacenter) volume licensing edition. (Evaluation wont work)
  • Start the in place upgrade.
  • Mount the VHD back to Azure
  • Swap the old OS disk with the upgraded disk
  • Power on the VM

Windows Server Upgrade Matrix

You can use the following diagram to figure out which Windows Server version you can upgrade to, based on the version you’re currently on:

Available in-place upgrade paths
  • Step 1: The following VM’s are built in Azure and we will be looking to upgrade our rds-01 vm from 2012 to 2016/2019.
Graphical user interface, text

Description automatically generated
  • Step 2: We are going to need a storage account inorder for us to do this job so I’ve created one here.  
Graphical user interface, text, application, email

Description automatically generated
  • Step 3: Enable boot diagnostic on our VM to the storage account we created earlier, so we can see the screenshot of the VM console. Go to the diagnostic settings tab on our VM.
Graphical user interface, application

Description automatically generated
  • Step 4: Enable boot diagnostic on our VM to the storage account we created earlier.
Graphical user interface, text, application, Teams

Description automatically generated
  • Step 5: Login to the server and note the disk and lun id number, disk drive letter etc
Graphical user interface, text, application

Description automatically generated
  • Step 6: Disable the disk encryption
  • Step 7: Remove the disk encryption
  • Step 8: Capture diagnostic data from VM
  • Step 9: Stop the VM
Graphical user interface, text, application, email

Description automatically generated
  • Step 10: Wait until the VM status is fully deallocated
Graphical user interface, text, application, email

Description automatically generated

Attaching the Snapshot VHD disk to a local Hyper-V VM

  • Step 11: Choose the OS disk and take screenshot of disks from portal
Graphical user interface, text, application, email

Description automatically generated
  • Step 12: Choose the OS disk and create snapshot 
  • Step 13:Wait for snapshot operation to complete and click on Go to resource.
Graphical user interface, text, application, Teams

Description automatically generated
  • Step 14: Go to the snapshot disk and export the disk using Snapshot export. Ensure the URL expires TTL Is set to a higher value.
Graphical user interface, text, application

Description automatically generated
  • Step 15: Copy the URL, we will download the VHD disk from this URL.
  • Step 16: Login to our Hyperv server, copy to Google Chrome and download the VHD disk.
Graphical user interface, text, application, email

Description automatically generated
  • Step 17: Once the VHD disk is downloaded to our Hyperv disable the snapshot disk export process
  • Step 18: Rename the file name to servername.vhd
Graphical user interface, text, application, email

Description automatically generated
  • Step 19: On our Hyperv machine, click create VM
Graphical user interface, text, application

Description automatically generated
  • Step 20: Choose Generation 1 option if your IAAS VM version was on Gen 1 if not choose Gen 2
Graphical user interface, text, application, email

Description automatically generated
  • Step 21: Assign the same memory you had on the other VM if possible.
Graphical user interface, text, application, email

Description automatically generated
  • Step 22: Network card is not required for OS disk conversion
Graphical user interface, text, application

Description automatically generated
  • Step 23: Choose the option to use the exisiting virtual disk and point it to the VHD snapshot disk we downloaded from Azure portal
Graphical user interface, text, application, email

Description automatically generated
  • Step 24: Validate all settings and click Finish
Graphical user interface, text, application

Description automatically generated
  • Step 25: Once the VM is created, change the CPU to match what was on the original VM
Graphical user interface, text, application

Description automatically generated
  • Step 26: Mount the latest Windows OS image
Graphical user interface, text, application, email

Description automatically generated
  • Step 27: Start the VM and login as local admin  
Graphical user interface, application

Description automatically generated

  • Step 29: Power off the VM
Graphical user interface, application

Description automatically generated
  • Step 30: Go to Containers and create a new blob container
Graphical user interface, text, application, email

Description automatically generated
  • Step 32: Upload the vhd using storage explorer to the blob container we created.
Graphical user interface, application

Description automatically generated
  • Step 33: VHD disk is now uploaded to the blob container we created. 
Graphical user interface, application, Word

Description automatically generated
  • Step 34: On our Azure portal, we can see the VHD disk uploaded.
Graphical user interface, text, application, email

Description automatically generated
  • Step 35: Copy the url  
Graphical user interface, text, application, email

Description automatically generated
  • Step 36: Create a managed disk  from the url  
Graphical user interface, application

Description automatically generated
  • Step 37: Create a managed disk  from the url  
Graphical user interface, text, application, email

Description automatically generated
  • Step 38: The default size as you create a managed disk is 1024GB so we need to change it. Choose disk size – remember size cant be decreased after and remember to also set OS type as Windows
Graphical user interface, application

Description automatically generated
  • Step 39: Choose disk size to match the original VM OS disk size
Table

Description automatically generated
  • Step 40: Click create managed disk
Graphical user interface, text, application

Description automatically generated
  • Step 41: Our managed disk is ready
Graphical user interface, application

Description automatically generated

Step 42 : Now we can swap the os disk . Go to disk and swap os disk as shown 

Graphical user interface, text, application, email

Description automatically generated
  • Step 43: Swap os disk as shown 
Graphical user interface, text, application

Description automatically generated
  • Step 44: Confirm the action
Graphical user interface, text, application

Description automatically generated
  • Step 45: Disk has been swapped
Graphical user interface, application

Description automatically generated
  • Step 46: Disk has been swapped
Graphical user interface, application, email

Description automatically generated
  • Step 47: Power on the VM
Graphical user interface, text, application

Description automatically generated
  • Step 48: Watch the stats via boot diagnostic screen
Graphical user interface, application, website

Description automatically generated

Step 49: Checking if your upgrade was successful 

We have thus successfully upgraded our OS to latest version.

References

(Visited 209 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.

Leave a Reply