Use `PATCH` to update VM
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
**Is your feature request related to a problem? Please describe.**
Use `PATCH` to update VM. Command is `az vm disk detach`. It also happens on `az vm update`. Current implementation is `GET` then `PUT`.
Original words in IcM:
We are unable to detach and attach data disk and OS disks on some VMs using azure cli (latest) and Powershell.
This is the command we run:
az vm disk detach --vm-name xtf07831542bkp3 -g AT31542_NEU_APPDEV-APPD_RG --name xtf07831542bkp3_disk2_f70c45872ff84bbdab844d1e8c05c014
(PropertyChangeNotAllowed) Changing property 'customData' is not allowed.
It works via portal.azure.com.
Being unable to perform simple actions as this in script, renders our ability to restore multiple VMs extremely inefficient.
If the customer is using AZ CLI (az vm disk detach) or Powershell (Remove-AzVMDataDisk) to remove a disk from a VM, a policy is preventing the action from succeeding. If he is using the portal to detach the disk, the disk is correctly removed.
Troubleshooting showed that the portal is using a PATCH command that only touches the disk configuration of the VM. AZ CLI and Powershell are using PUT commands resulting in one of the customer's policies triggering because properties are being overwritten with the same value.
A workaround has been provided (use the Update VM, REST API, https://docs.microsoft.com/en-us/rest/api/compute/virtualmachines/update) but the customer feels that our tools gives an inconsistent experience and would like to see Powershell, AZ CLI and the portal give the same result for the same task.
**Describe the solution you'd like**
**Describe alternatives you've considered**
**Additional context**
Contributor guide
Assessment
This issue has not been assessed yet.