Azure Diagnostics Extension for Windows VMs
The Azure Diagnostics VM extension enables you to collect monitoring data, such as performance counters and event logs, from your Windows VM. You can granularly specify what data you want to collect and where you want the data to go, such as an Azure Storage account or an Azure Event Hub. You can also use this data to build charts in the Azure portal or create metric alerts.
The Azure Diagnostics Extension can be run against Windows 10 Client, Windows Server 2008 R2, 2012, 2012 R2, and 2016.
The Azure Diagnostics Extension requires that the target virtual machine is connected to the internet.
Azure VM extensions can be deployed with Azure Resource Manager templates. The JSON schema detailed in the previous section can be used in an Azure Resource Manager template to run the Azure Diagnostics extension during an Azure Resource Manager template deployment. See Use monitoring and diagnostics with a Windows VM and Azure Resource Manager templates.
Azure CLI deployment
The Azure CLI can be used to deploy the Azure Diagnostics extension to an existing virtual machine. Replace the protected settings and settings properties with valid JSON from the extension schema above.
az vm extension set \ --resource-group myResourceGroup \ --vm-name myVM \ --name IaaSDiagnostics \ --publisher Microsoft.Azure.Diagnostics \ --version 220.127.116.11 --protected-settings protected-settings.json \ --settings public-settings.json
Set-AzVMDiagnosticsExtension command can be used to add the Azure Diagnostics extension to an existing virtual machine. See also Use PowerShell to enable Azure Diagnostics in a virtual machine running Windows.
This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.
$vm_resourcegroup = "myvmresourcegroup" $vm_name = "myvm" $diagnosticsconfig_path = "DiagnosticsPubConfig.xml" Set-AzVMDiagnosticsExtension -ResourceGroupName $vm_resourcegroup ` -VMName $vm_name ` -DiagnosticsConfigurationPath $diagnosticsconfig_path
Troubleshoot and support
Data about the state of extension deployments can be retrieved from the Azure portal, and by using the Azure CLI. To see the deployment state of extensions for a given VM, run the following command using the Azure CLI.
az vm extension list --resource-group myResourceGroup --vm-name myVM -o table
See this article for a more comprehensive troubleshooting guide for the Azure Diagnostics extension.
If you need more help at any point in this article, you can contact the Azure experts on the MSDN Azure and Stack Overflow forums. Alternatively, you can file an Azure support incident. Go to the Azure support site and select Get support. For information about using Azure Support, read the Microsoft Azure support FAQ.