google.com, pub-7590763259720133, DIRECT, f08c47fec0942fa0
 

Microsoft Server 2022 Azure VM In-Place Upgrade Automation

Updated: Jan 24

Overview:

This will be a three-part series covering the following topics:

  1. Microsoft Server 2022 Azure VM In-Place Upgrade Automation

  2. Managed Identities - AAD Login for Windows Server Extension & Access Control

  3. Azure Active Directory (AAD) Joined Server Remote Access Guide


Perfrom an in-place upgrade on an Azure VM to Microsoft Server 2022
Microsoft Server 2022 In-Place Upgrade

Turn off any alerting for the server, e.g., Datadog, Newrelic, etc.!


Part 1: Microsoft Server 2022 Azure VM In-Place Upgrade


First, let's make sure your requirements align with what this guide will cover:

  1. You have an Azure Server 2016/2019 VM that you wish to upgrade to Server 2022

  2. You wish to safely perform the in-place upgrade by first taking an OS drive snapshot

  3. You wish to streamline this process as much as possible


 

Prerequisites


To perform an in-place upgrade, we must meet the following requirements on the server:

  1. Copy the Microsoft Server 2022 ISO file to an Azure storage account with a file share and create a shared access signature

  2. The server is running .Net Framework 4.7.2

  3. Enable Scripting - Active scripting for Javascript in Internet Explorer

  4. Copy over our custom in-place upgrade script


 

Copy the Microsoft Server 2022 ISO file to an Azure storage account with a file share and create a shared access signature


You can access Azure storage accounts via Azure Storage Explorer or the Azure Portal.

  1. Make sure your storage account is routable to the VMs that will receive the in-place upgrade.

  2. The storage account needs an active file share directory

  3. Create a new shared access signature (I placed a checkmark for all services/resource types/ and permissions. Set an expiry date/time.



 


The server is running .Net Framework 4.7.2


The Az modules in our script require the server to be running .Net Framework 4.7.2 or greater. Install this on the server prior to running the custom script in step 4. You will likely have to reboot the server after installation.


 

Enable Scripting - Active scripting for Javascript in Internet Explorer


The custom in-place upgrade script will prompt for your Azure Administrator credentials. This prompt will pass through Internet Explorer using Javascript. We must enable Active scripting to allow this window to generate properly.

To allow all websites within the Internet zone to run scripts within Internet Explorer:


1. On the web browser menu, click Tools or the "Tools" icon (which looks like a gear) and select Internet Options.

Step 1 to enable Active scripting for Javascript in IE
Internet Explorer - Internet Options

2. When the "Internet Options" window opens, select the Security tab.


3. On the "Security" tab, ensure the Internet zone is selected, and then click on the "Custom level..." button.

Step 2 to enable Active scripting for Javascript in IE
Internet Explorer - Custom Level

4. In the Security Settings – Internet Zone dialog box, click Enable for Active Scripting in the Scripting section.

Step 3 to enable Active scripting for Javascript in IE
Internet Explorer - Enable Active Scripting

5. When the "Warning!" window opens and asks, "Are you sure you want to change the settings for this zone?" select Yes.


6. Click OK at the bottom of the Internet Options window to close the dialog.




 

Copy over our custom in-place upgrade script


You can download/copy the custom script from GeekByte Github.

The script does the following:

  1. Elevates as Administrator

  2. Switches to TLS 1.2

  3. Installs Az Modules and prerequisites

  4. Asks for user inputs:

  5. Subscription

  6. Resource Group

  7. Location

  8. (Computer name is auto-extracted)

  9. Takes a snapshot of the Operating System (OS) drive and saves it to the same resource group the server resides

  10. Creates a new folder C:\Server2022-InPlaceUpgrade

  11. Installs AzCopy

  12. Downloads Server 2022 locally to the folder created above

  13. Mounts the Server 2022 ISO and begins an in-place upgrade to Server 2022 Datacenter with Desktop Experience

Copy this script anywhere on the server that will receive the in-place upgrade.


 

Install the custom in-place upgrade script

  1. Modify line 203 to include your Azure storage account information

  2. Right-click on the script and run with Powershell

  3. The script will ask for user inputs to identify the server being upgraded

  4. Monitor the installation/reboot and verify the appropriate services and applications are functioning as per normal


 

Clean-Up

Once you verify the server is healthy, and its services are not disrupted, you can begin the cleanup phase.

  1. Disable Scripting - Active scripting for Javascript in Internet Explorer

  2. Delete the C:\Server2022-InPlaceUpgrade folder and it’s contents

  3. (Only perform this once you verify the server is functioning as per normal. You can even delay this step as long as you set a reminder) Navigate to the RG of the upgraded server and delete the snapshot; it will have the server name followed by a timestamp:

The snapshot in Azure of your VM will include a timestamp
Azure VM snapshot for Microsoft Server 2022 in-place upgrade

 

You have successfully executed an in-place upgrade to Server 2022 on your Azure VM. You can now move on to Part 2: Managed Identities - AAD Login for Windows Server Extension & Access Control.


Feel free to comment below with any questions or comments.


If you found this article informative, please support my efforts by donating to my Ethereum ENS address: geekbyte.eth


930 views1 comment