How to fix "Changing property 'osProfile' is not allowed" error when scaling VM with PowerShell

Mohammed Haseeb K P 0 Reputation points
2024-05-14T14:57:00.57+00:00

I am attempting to scale one of my VMs using PowerShell, but I keep encountering the following error: "Changing property 'osProfile' is not allowed."

Here are the current specifications for my VM:

  • Operating system: Linux (CentOS 7.9.2009)
  • Size: Standard DS2 v2 (2 vCPUs, 7 GiB memory)
  • Location: East US

I also tried using the Azure CLI, but the issue remained. The script worked for another VM with the same operating system (Linux CentOS 7.9.2009). Attached is an image of the error message:

image

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

1 answer

Sort by: Most helpful
  1. deherman-MSFT 34,041 Reputation points Microsoft Employee
    2024-05-21T15:18:23.9566667+00:00

    @Mohammed Haseeb K P

    It is possible that your VM is using a specialized image which could be leading to the issue.

    1.    Create a snapshot of the OS Disk of problematic VM.

    2.    Create a managed disk from that snapshot.

    1.   Swap the disk with current OS Disk, it will remove that metadata info of the disk.
    2.     Try to resize command again.

    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts.

    If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community.

    Thank you for helping to improve Microsoft Q&A!

    User's image

    0 comments No comments