Sergey Galushko - Fotolia


Understand Azure VM boot diagnostics

Enable Azure VM boot diagnostics with Azure Portal or PowerShell to capture logs that can help you troubleshoot boot failures and obtain screenshots to see the VM's current state.

There are several tools you can use to troubleshoot and get to the root cause of VM issues in on-premises Hyper-V hosts. When it comes to troubleshooting issues for VMs deployed in a cloud environment, such as Microsoft Azure public cloud, you need to rely on the troubleshooting mechanisms provided by the cloud vendor. For example, you might not be able to see the boot output of an Azure VM, as the VM is operating in a cloud. If any of the Azure VMs fail to boot, you might want to see what's going on during the boot process that's causing the failure. Similarly, you might want to capture screenshots to see the current state of the Azure VM.

Microsoft added support for the VM boot diagnostics extension, which enables debugging to troubleshoot VM boot-related issues and also help in capturing screenshots of the current state of the VM. There are two features provided as part of the VM boot diagnostics extension: console output and screenshots. Both features are available for Windows, as well as Linux Azure VMs.

By default, Azure VM boot diagnostics isn't enabled for VMs. There are two ways to enable the VM boot diagnostics extension: Azure Portal and PowerShell. You might want to use the PowerShell method if you need to enable the diagnostics extension for multiple VMs.

Enable boot diagnostics for Azure VMs using Azure Portal

To enable diagnostics extension using Azure Portal and when creating a new Azure VM, follow the steps outlined below:

  1. When creating a new Azure VM, select Azure Resource Manager from the deployment model. Note that the Azure classic model won't have the VM boot diagnostics option. VM boot diagnostics can only be enabled for an existing VM deployed using the Resource Manager model.
  2. After entering the VM's basic settings, enable Diagnostics in the Monitoring section as shown below:
    Enable Azure VM boot diagnostics
    Enable VM boot diagnostics for a new Azure VM.

  3. Once Diagnostics is enabled, Azure will capture boot logging data and provide screenshots.

Enable boot diagnostics for Azure VMs using PowerShell

Microsoft also provides necessary PowerShell support to manage Azure resources, including enabling VM boot diagnostics for Azure VMs. To enable or disable VM boot diagnostics using PowerShell, use the Set-AzureRMVMBootDiagnostics PowerShell cmdlet. Execute the PowerShell commands below to enable VM boot diagnostics for a VM:

$ThisVM = Get-AzureRMVM –ResourceGroupName "ResourceGroup1" –Name "SQLVM"

Set-AzureRMVMBootDiagnostics –VM $ThisVM –Enable –ResourceGroupName "ResourceGroup1" –StorageAccountName "StorageAccountName"

If you need to enable diagnostics for all Azure VMs, here is the PowerShell script that can help:

$TheseVMs = Get-AzureRMVM *

ForEach ($ThisVMNow in $TheseVMs)


Set-AzureRMVMBootDiagnostics –VM $ThisVMNow –Enable


Check and download boot diagnostics data for Azure VMs

Once the Diagnostics extension is enabled, Azure will capture boot logs and provide screenshots. From Azure Portal, navigate to the VM for which you want to see the console output, click on All Settings, and then click on Boot Diagnostics. Clicking on Boot Diagnostics will show the current console output of the VM. From here, you can download the log file to the local machine.

To download diagnostics log files to your local machine using PowerShell, execute the Get-AzureRMVMBootDiagnosticsData PowerShell cmdlet as shown below:

Get-AzureRMVMBootDiagnosticsData –ResourceGroupName "RSGroup1" –Name "SQLVM" –Windows –LocalPath "C:\VMBootData\SQLVM"

Note that when using the PowerShell cmdlet to download diagnostics log files, you need to specify the type of VM you're running the command against. If the target Azure VM is running Linux, you need to specify -Linux, and if it's a Windows VM, you need to specify -Windows.

There are a few other things you need to know about the VM boot diagnostics feature. For example, VM boot diagnostics is only available to Azure VMs deployed in Resource Manager. In other words, the Azure classic model doesn't support the VM boot diagnostics extension. Also, it might take up to 10 minutes before screenshots are available for viewing.

Next Steps

Use Azure to set up performance load tests

Better manage your Azure costs

Take advantage of Azure Container Service

Dig Deeper on Cloud computing architecture