question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot delete stopped VM - "Cannot modify extensions in the VM when the VM is not running."

See original GitHub issue

Describe the bug Cannot delete a disabled/stopped VM.

Steps to reproduce

  1. Create VM
  2. Disable VM
  3. 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:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stuartleekscommented, Jun 28, 2022

Seems to be a “known issue” on azurerm provider: https://github.com/hashicorp/terraform-provider-azurerm/issues/6098

0reactions
stuartleekscommented, Jun 30, 2022

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 the terraform 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found