Azure-PowerShell-Snippets icon indicating copy to clipboard operation
Azure-PowerShell-Snippets copied to clipboard

Changing property 'osDisk.name' is not allowed

Open juststopping opened this issue 6 years ago • 0 comments

We ran into an issue with the "AzureRM - Move existing VM to new VNET.ps1" script. The issue kept the VM from being recreated, after it was removed.

New-AzureRmVm : Changing property 'osDisk.name' is not allowed. ErrorCode: PropertyChangeNotAllowed ErrorMessage: Changing property 'osDisk.name' is not allowed. StatusCode: 409 ReasonPhrase: Conflict

We had to comment out line 201 to keep the PowerShell script from attempting to rename the OSDisk's name. It does not appear to be supported. When you comment out the line, the OS Disk's name does not change and the VM is created properly.

Original: 201 $vm.StorageProfile.OSDisk.Name = $vmName Updated: 201 #$vm.StorageProfile.OSDisk.Name = $vmName

juststopping avatar Dec 13 '18 15:12 juststopping