connecting to my azure VM portal with Powershell for in place upgrade

Admin 0 Reputation points
2025-02-15T17:43:18.63+00:00

iu ma having trouble with creating in virtual media for my in place upgrade . need some help or guiadance the documentation calls for using powershell to create the attachable disk forthe upgrade

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,035 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Precious Ajuru 160 Reputation points
    2025-02-17T02:43:21.21+00:00

    I can imagine the trouble. Sorry about that. May I ask what error message you're getting? Also, what are the source and target OS versions? In the meantime, see my general note below.

    Considerations before proceeding:

    1. Azure Edition Compatibility

    You cannot perform an in-place upgrade for Windows Server Azure Edition VMs because:

    • Azure Edition Has Exclusive Features – Windows Server Azure Edition includes specialized cloud-optimized features like: Hotpatching, SMB over QUIC, etc..

    Since these features are built into Azure, in-place upgrades are not supported. Instead, Microsoft releases new Azure Edition images, and customers are expected to deploy a new VM and migrate workloads.

    • OS Image Management in Azure – Unlike standard Windows Server editions, Azure Edition VMs are tied to Azure Marketplace images that are meant for fresh deployments, not in-place upgrades.

    So, Microsoft does not support in-place upgrades for Azure Edition. Instead, they recommend:

    Deploying a new VM with the latest Windows Server Azure Edition or migrating your workloads and data (using Azure Migrate, Azure Site Recovery, or manual migration).

    2. Upgrade Path Limitation

    In older versions of Windows Server, direct upgrades were typically limited to moving up to two versions ahead. For example: You could upgrade from Windows Server 2012 R2 to Windows Server 2016 or Windows Server 2019, depending on version support.

    With Windows Server 2025, Microsoft may extend support for direct upgrades from earlier versions, potentially allowing upgrades up to four versions back (e.g., from Windows Server 2012 R2 to Windows Server 2025). However, this has not been officially confirmed.

    So, if your current version is not supported for a direct upgrade, you may need to Perform a staged upgrade through intermediate versions or Deploy a new VM and migrate your workloads.

    Steps to Perform an In-Place Upgrade (If Supported)

    If your VM is not an Azure Edition and meets the upgrade path requirements, follow these steps:

    1. Create Upgrade Media Disk

    Run the following PowerShell script in Azure Cloud Shell, modifying the variables as needed:

    # Define variables

    $resourceGroup = "WindowsServerUpgrades"

    $location = "WestUS2"

    $zone = "" # Specify if using Availability Zones

    $diskName = "WindowsServer2022UpgradeDisk"

    $sku = "server2022Upgrade" # Change to the correct Windows Server version

    # Get latest Windows Server upgrade image

    $publisher = "MicrosoftWindowsServer"

    $offer = "WindowsServerUpgrade"

    $managedDiskSKU = "Standard_LRS"

    $versions = Get-AzVMImage -PublisherName $publisher -Location $location -Offer $offer -Skus $sku | Sort-Object -Descending {[version] $_.Version}

    $latestString = $versions[0].Version

    $image = Get-AzVMImage -Location $location -PublisherName $publisher -Offer $offer -Skus $sku -Version $latestString

    # Create Managed Disk

    $diskConfig = New-AzDiskConfig -SkuName $managedDiskSKU -CreateOption FromImage -Location $location

    Set-AzDiskImageReference -Disk $diskConfig -Id $image.Id -Lun 0

    New-AzDisk -ResourceGroupName $resourceGroup -DiskName $diskName -Disk $diskConfig

    2. Attach the Upgrade Media to the VM

    • Open Azure Portal → Go to Virtual Machines
    • Select your VM → Click Disks → Click Attach existing disk
    • Choose the upgrade disk you created → Click Save 3. Start the In-Place Upgrade
    • RDP into the VM and determine the upgrade media drive letter (E: or F:).
    • Run the following command inside PowerShell:

    .\setup.exe /auto upgrade /dynamicupdate disable /eula accept

    Follow the prompts to complete the upgrade.

    The VM should restart and upgrade automatically.

    Remember, Azure Edition VMs do not support in-place upgrades, if that's your situation, then you may need to deploy a New VM with Windows Server 2025 (Azure Edition) and migrate your applications and data.

    Good luck!

    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.