Hello, @Esther Carnerero !
What should I do if my virtual machine is stuck in the "deallocating" state?
The general recommendation is to allow the deallocation action to time out which should take about 90 minutes. After a couple hours you should see an error message that explains why the VM was unable to deallocate and often retrying the operation will succeed at this point.
Note that while in the deallocating state, you are not billed for compute costs (although some Azure resources, such as Disks and Networking will continue to incur charges).
What else can I do?
There are a variety of other approaches that people have taken although success may be situational depending on the issue that caused the VM to get stuck in the deallocating state.
- az vm update: Running this command from the CLI attempts to update the properties of the VM and may end the stuck process.
- Redeploy the VM: Redeploying a VM may clear whatever process was causing the VM to be stuck.
- Resize the disk: Similar to redeploying, this may force the hung process to stop.
- Boot diagnostics: You can see a screenshot of your VM boot which may give you insight to what is causing the problem (Support + troubleshooting > Boot diagnostics in your VM resource).
- Run command: Run command allows you to run PowerShell scripts in your VM which may help.
Additional Resources: