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 for business | Windows Server | Devices and deployment | Set up, install, or upgrade
Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,346 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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.