While I was changing diagnostics storage settings in Azure, I started getting error messages for some of my VMs while de-allocating them or powering them up and down.

Failed to start virtual machine ‘vm-name’. Error: Handler ‘Microsoft.Azure.Security.Monitoring’ has reported failure for VM Extension ‘Monitoring’ with terminal error code ‘1007’ and error message: ‘Install failed for plugin (name: Microsoft.Azure.Security.Monitoring, version 3.1.0.0) with exception Command C:PackagesPluginsMicrosoft.Azure.Security.Monitoring3.1.0.0AsmExtension.exe of Microsoft.Azure.Security.Monitoring has exited with Exit code: 5’

I solved this error by doing the following:

  1. Select the VM in Azure > Diagnostics Settings > Uncheck Diagnostics infrastructure logs > Save
  2. Within the same VM Menu > Select Extensions > Monitoring > Uninstall
  3. De-allocate the VM
  4. Start up the VM (You should no longer have the error)
  5. Go back into the Diagnostics Settings of the VM > Re-check Diagnostics infrastructure logs > Save
  6. De-allocate/start to test again to make sure you no longer have the error