An Azure service that is used to provision Windows and Linux virtual machines.
Welcome to Microsoft Q&A!
@Nelsen Lim I hope you are doing well,
A resource lock on the managed disk prevents the disk from being deleted, but it should not normally prevent you from removing the disk from the VM configuration.
Just take a look:
- Check the disk's Locks blade and identify whether it is a CanNotDelete or ReadOnly lock.
- If you have permission, temporarily remove the lock. A CanNotDelete lock is usually sufficient to protect the disk while allowing configuration changes.
- Stop/deallocate the VM if possible, then detach the data disk from the VM.
- Delete the VM after confirming the disk is detached.
- Recreate the lock on the standalone disk if you want to continue protecting it.
If the VM remains in a Failed provisioning state and Azure does not allow the disk to be detached, don't delete or recreate the disk. First check the VM's Activity Log for the failed operation and the exact error.
Also verify that you have the required permissions to manage both the VM and the resource lock. If the lock is inherited from the resource group or subscription, it must be addressed at that scope.
Reference:
Detach a data disk from an Azure VM
If this answer helped clarify the platform capabilities and save you troubleshooting time, please consider marking it as Accepted. This helps others in the community find similar solutions.