Azure-PowerShell-Snippets
Azure-PowerShell-Snippets copied to clipboard
Changing property 'osDisk.name' is not allowed
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