Issue
I recently discovered that in one of my customers tenants VM insights wasn’t enabled for most machines which affected our monitoring solutions. Easy fix right? You just click on “Enable”, you wait, and it should work.
This time it didn’t for some Virtual Machines.
So when you navigate to your Insights blade, and click on enable you will see “Monitoring data is being collected and routed to Insights. It can take up to 10 minutes to arrive. Please try again in a few minutes.”. Usually this is accurate but in this case, it just didn’t do anything after hours of waiting. I tried it again, same result. VM insights just refused to enable. I kept getting below status without any results
In the Insights Monitoring Coverage it kept showing “Enabling – Waiting for data”
Fix
I discovered that the AzureMonitorWindowsAgent and the DependencyAgentWindows extensions are causing issues. Deleting the extensions from your VM resolved the issues in my case.
- First we remove the AzureMonitorWindowsAgent and DependencyAgentWindows extension. I use Powershell for this but you can also do this in the Azure Portal.
Remove-AzVmExtension -ExtensionName AzureMonitorWindowsAgent -ResourceGroupName "ResourceGroup of your VM" -VmName "Name of your VM" Remove-AzVmExtension -ExtensionName DependencyAgentWindows -ResourceGroupName "ResourceGroup of your VM"-VmName "Name of your VM"
- Second you will have to reinstall the AzureMonitorWindowsAgent Extension
Set-AzVMExtension -ExtensionName "AzureMonitorWindowsAgent" -ExtensionType "AzureMonitorWindowsAgent" -Publisher "Microsoft.Azure.Monitor" -ResourceGroupName "Resourcegroup of your VM" -VmName "Name of your VM" -Location "Location of your VM"-TypeHandlerVersion 1.0
After provisioning is succeeded you can enable VM insights again and the issue should be resolved.
Thank you so much for this solution. It really helped me
The issue caused me a lot of time and finnaly i found your solution !
Thank you so much, (y)
Glad it helped you!