In-place OS upgrade for Windows Server 2016 to 2022 on Azure VMs

Amit 1 Reputation point
2024-02-21T15:46:23.4733333+00:00

I need assistance with an in-place OS upgrade from Windows Server 2016 to 2022 on Azure VMs following this URL: https://learn.microsoft.com/en-us/azure/virtual-machines/windows-in-place-upgrade. When running the PowerShell script, I encounter this error message: "Set-AzDiskImageReference: Cannot bind argument to parameter 'Disk' because it is null." Please help me resolve this issue.

Also, I have attached a screenshot of the error message for reference.

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,470 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
4,770 questions
Windows Server Setup
Windows Server Setup
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
241 questions
Windows Server Migration
Windows Server Migration
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Migration: The process of making existing applications and data work on a different computer or operating system.
408 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 48,581 Reputation points
    2024-02-21T16:03:05.5533333+00:00

    That means that your $diskConfig variable doesn't have a value. You need to step through this script to figure out where the failure is occurring. Stepping back from the command that failed it is creating a managed disk on the step before. It appears that the call is failing. It could be bad parameters or something related to your account. You'll need to verify each of your variables. Note that the script is hard coding some values so you may need to adjust them for your subscription (e.g. resource group).

    Out of the box PS will display errors and continue on anyway. If you want to stop the script when an error occurs then add the following to the top of the script $ErrorActionPreference = "Stop". This will make it easier to track down the error in larger scripts.

    0 comments No comments