Share via


Cannot attach existing managed disk to VM

Question

Tuesday, April 17, 2018 6:33 AM

Hello,

I have a Windows 2016 Datacenter VM in Azure. Because of a wrong Vnet Assignment I had to delete the VM and recreate it on a new Vnet. I used the OS disk that was existing and pressed the Create VM button after deleting the VM.

However I also had a managed disk that was attached previously and when I try to attach it using the ARM  I get the following message "Failed to update disks for the virtual machine 'Server'. Error: Changing property 'osProfile' is not allowed."

What am I doing wrong? The disk was empty and I tried recreating it but I still get the error message.

Thank you

All replies (10)

Wednesday, April 18, 2018 5:54 PM ✅Answered

What happens when you try to attach it via the Portal? Same process but instead of creating a new disk a drop down of available disks shows up: 


Tuesday, April 17, 2018 7:09 AM

Check this FAQ: Can I change the computer name property when a specialized (not created by using the System Preparation tool or generalized) operating system disk is used to provision a VM?

No. You can't update the computer name property. The new VM inherits it from the parent VM, which was used to create the operating system disk. Refer this document for more details.

 

Refer the following document/discussion thread for more details on this topic:

Create a virtual machine using an existing managed OS disk with PowerShell

Attach Existing managed data disk to existing azure VM

If this answer was helpful, click “Mark as Answer” or Up-Vote. To provide additional feedback on your forum experience, click here


Tuesday, April 17, 2018 1:43 PM

I dont want to change the OS disk. I just to add a new managed disk to the System. Is this not possible?

Do I need do make a new VM again?


Tuesday, April 17, 2018 4:22 PM

If you want to add a new managed disk to the system you can do so simply in the Azure Portal: 


Wednesday, April 18, 2018 5:16 AM

Hello,

yes I did this , trying to add the previously existing disk and also adding a new one and I get the error message that I posted on my first post.


Thursday, April 19, 2018 5:50 AM

This is what I am trying, attaching the disks via the portal. I had an existing disk which I chose, but it failed attaching it. I deleted the disk and tried creating a new one and it gave me the same result.


Thursday, April 19, 2018 8:12 AM

I have retried your suggestion and worked. I really have no clue how, because I tried this during the previous days many times until I posted the question...

Thank you anyway


Thursday, April 19, 2018 5:04 PM

Glad you got it working. Possibly just a transient error. If it reappears feel free t come back to this forum :) 


Wednesday, May 30, 2018 7:33 PM

I am having the same exact issue based on the same exact use case.  I set up a new VM with six data disks but I used the wrong VNET.  I detached all the data disks and then deleted the VM. I recreated the VM using the OS disk and attached the VM to the correct VNET.  When I try to attach the Data Disks to the new VM I get the the error " Failed to update disks for the virtual machine 'XXXXXXXX'. Error: Changing property 'osProfile' is not allowed."

I tried the suggestions above but I am still getting the same error.  any ideas how to fix this?

I tried an alternate test. Instead of trying to add the data disks I tried to edit the Host Caching on the os disk - ie I changed it from Read/Write to None and then I tried to save and received the same error "... Changing property 'osProfile' is not allowed."


Saturday, June 2, 2018 10:25 AM

I have a tried a similar repro and it threw the exact same error message, however after refreshing(F5) the Azure Portal it works for me. You could refresh the Azure Portal or re-login to the Portal, re-try, and then let us know if that makes any difference. 
If the issue persist, could you share the screenshots after concealing any private information?

Also, as a test, you could resize the VM to a higher SKU, attach the data disks, and then switch back to the original VM SKU. Note: The size of the virtual machine controls how many data disks you can attach. For details, see Sizes for virtual machines