How to fix Deprecation issue for my VM which is a part of AVD and I have windows1019h2?

Ritesh Prasad Sah 0 Reputation points
2024-07-09T12:44:36.4233333+00:00

Hi,

I have a VM which is a part of Virtual desktop. Now, I am the only assigned user in that VDI. I am getting error as my VM is about to deprecate till 8th Spptember. While checking the SKU in powershell. I found the version was : 18363.2274.220430.

After running the Powershell command, I found the available offer image : $publisher="MicrosoftWindowsDesktop"

$Offer="Windows-10"

$sku="Win10-22h2-pro"

$Version="19045.4529.240607"

While updating the VM, I ran this command:

Stop-AzVM -ResourceGroupName "XXXXX" -Name "XXXXX" -Force

Get-AzVMImageOffer -Location "East US" -PublisherName "MicrosoftWindowsDesktop"

$vm = Get-AzVM -ResourceGroupName "XXXXXXX" -Name "XXXXX"

$vm = Set-AzVMSourceImage -VM $vm -PublisherName "MicrosoftWindowsDesktop" -Offer "Windows-10" -Skus "Win10-22h2-pro" -Version "19045.4529.240607"

$vm | Update-AzVM

Its giving me error as:
PS C:\Users\XXXX> $vm | Update-AzVM

Update-AzVM : Changing property 'imageReference' is not allowed.

ErrorCode: PropertyChangeNotAllowed

ErrorMessage: Changing property 'imageReference' is not allowed.

ErrorTarget: imageReference

StatusCode: 409

ReasonPhrase:

OperationID : 975e71be-2c21-4ace-ae4b-bb14aec2c2e9

At line:1 char:7

  • $vm | Update-AzVM
  •   ~~~~~~~~~~~
    
    • CategoryInfo : CloseError: (:) [Update-AzVM], ComputeCloudException
    • FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.UpdateAzureVMCommand

Please help me with a proper solution to this issue.

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,167 questions
Azure VMware Solution
Azure VMware Solution
An Azure service that runs native VMware workloads on Azure.
340 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,074 questions
Azure Virtual Desktop
Azure Virtual Desktop
A Microsoft desktop and app virtualization service that runs on Azure. Previously known as Windows Virtual Desktop.
1,449 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,317 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 7,206 Reputation points
    2024-07-09T15:06:53.6+00:00

    Hello Ritesh Prasad Sah,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you are experiencing an error while updating the operating system image of an existing Azure Virtual Desktop VM. According to you, the VM is set to deprecate soon, and the you needs to update it to a newer OS version. You have also attempted to change the VM’s OS image using PowerShell commands but received a PropertyChangeNotAllowed error.

    Solution

    From point of the error analysis, the PropertyChangeNotAllowed, error indicates that changing the imageReference property of an existing VM is not allowed. This property specifies the operating system image used to create the VM, and Azure doesn't support changing the OS image of an existing VM directly. To solve the problem of updating the operating system image of an Azure Virtual Desktop VM and addressing the encountered error, follow these best practices detailed steps. Also, kindly use the link provided as main sources of information and for more detail step by steps.

    1. Backup the VM Data by ensure you have a backup of any important data on your current VM (Data and setting). You can use Azure Backup or create snapshots of your disks. https://video2.skills-academy.com/en-us/azure/backup/backup-azure-vms and https://video2.skills-academy.com/en-us/azure/virtual-machines/windows/snapshot-copy-managed-disk
    2. Create a New VM with the Desired Image by using PowerShell to create a new VM with the desired OS image.
         # Define parameters
         $resourceGroupName = "YourResourceGroupName"
         $newVMName = "YourNewVMName"
         $location = "East US"
         $vmSize = "Standard_DS1_v2"  # Choose the appropriate size for your VM
         $publisher = "MicrosoftWindowsDesktop"
         $offer = "Windows-10"
         $sku = "Win10-22h2-pro"
         $version = "19045.4529.240607"
         # Create the VM configuration
         $vmConfig = New-AzVMConfig -VMName $newVMName -VMSize $vmSize
         $vmConfig = Set-AzVMOperatingSystem -VM $vmConfig -Windows -ComputerName $newVMName -Credential (Get-Credential)
         $vmConfig = Set-AzVMSourceImage -VM $vmConfig -PublisherName $publisher -Offer $offer -Skus $sku -Version $version
         # Network settings (assuming you have a virtual network and subnet)
         $networkInterface = Get-AzNetworkInterface -ResourceGroupName $resourceGroupName -Name "YourNetworkInterfaceName"
         $vmConfig = Add-AzVMNetworkInterface -VM $vmConfig -Id $networkInterface.Id
         # Create the new VM
         New -AzVM -ResourceGroupName $resourceGroupName -Location $location -VM $vmConfig
      
      https://video2.skills-academy.com/en-us/azure/virtual-machines/windows/quick-create-powershell
    3. Migrate Data and Settings by transfer your data and configurations from the old VM to the new VM. You have options to use Azure File Share or Azure Blob Storage, Disk Snapshots, or Remote Desktop Protocol (RDP) to connect to both VMs via RDP and manually transfer files. https://video2.skills-academy.com/en-us/azure/storage/files/storage-files-introduction and https://video2.skills-academy.com/en-us/azure/virtual-machines/windows/attach-managed-disk
    4. Update DNS and IP Configurations (Optional), in case of any changes ensure your new VM is correctly configured in terms of DNS settings and IP addresses to match any existing dependencies or configurations. https://video2.skills-academy.com/en-us/azure/virtual-network/virtual-network-ip-addresses-overview-arm and https://video2.skills-academy.com/en-us/azure/dns/dns-zones-records
    5. Delete the Old VM (Optional), once you have confirmed that everything is working correctly on the new VM, you can decommission the old VM using PowerShell. Remove-AzVM -ResourceGroupName "YourResourceGroupName" -Name "YourOldVMName" -Force

    References

    To read more about deprecated images, kindly use the link below and any others by the right side of this page.

    Deprecate or restore a virtual machine offer from Azure Marketplace

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments