Cannot delete stopped VM - "Cannot modify extensions in the VM when the VM is not running."
See original GitHub issueDescribe the bug Cannot delete a disabled/stopped VM.
Steps to reproduce
- Create VM
- Disable VM
- Delete VM
Get the error: .VirtualMachineExtensionsClient#Delete: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="OperationNotAllowed" Message="Cannot modify extensions in the VM when the VM is not running.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Error: Cannot modify extensions in the VM when the VM is not ...
The azurerm_virtual_machine_extension resources are not deleted because the machines have been shutdown, and marked as "deallocate" and " ...
Read more >Troubleshooting Azure Windows VM extension failures
Troubleshooting extension failures · Verify that the VM Agent is running and Ready · Check for your specific extension troubleshooting guide · View ......
Read more >Terraform azurerm_virtual_machine_extension error ...
I have the template working such that when I do RDP to the VM, after creation, that when I run "WinRM quickconfig" I...
Read more >Can't Boot Ubuntu Virtual Machine on Azure - Server Fault
Once the VM is started delete the extension via the Azure website in the Extensions menu. Then click the uninstall. The uninstall can...
Read more >7.13. VBoxManage controlvm
You cannot modify this setting while recording is enabled. Only use this option only if you are an advanced user. For information about...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems to be a “known issue” on azurerm provider: https://github.com/hashicorp/terraform-provider-azurerm/issues/6098
That seems like a plan to me - we would only add this step in the
delete
action where we’re going to clean up the VM anyway!We could consider listing the terraform state and running through a grep for
.azurerm_virtual_machine_extension.
and then running theterraform state rm
for any matches. That way we won’t have to remember to update it if we rename the resource or add new extensions.