How to use boot diagnostics to troubleshoot virtual machines in Azure

There can be many reasons that a virtual machine enters a non-bootable state. To address issues with your virtual machines created using Resource Manager deployment model you can use the following debugging features: Console Output and Screenshot support for Azure virtual machines.

For Linux virtual machines, you can view the output of your console log from the Portal. For both Windows and Linux virtual machines, Azure enables you to see a screenshot of the VM from the hypervisor. Both features are supported for Azure virtual machines in all regions. Note, screenshots, and output can take up to 10 minutes to appear in your storage account.

You can select the Boot diagnostics option to view the log and the screenshot.

Resource Manager

Common boot errors

Enable diagnostics on a virtual machine created using the Azure Portal

The following procedure is for a virtual machine created using the Resource Manager deployment model.

On the Management tab, in Monitoring section, make sure that Boot diagnostics is turned on. From the Diagnostics storage account drop-down list, select a storage account in which to place the diagnostic files.

Create VM

Note

The Boot diagnostics feature does not support premium storage account. If you use the premium storage account for Boot diagnostics, you might receive the StorageAccountTypeNotSupported error when you start the VM.

Deploying from an Azure Resource Manager template

If you are deploying from an Azure Resource Manager template, navigate to your virtual machine resource and append the diagnostics profile section. Set the API version header to "2015-06-15" or later. The latest version is "2018-10-01".

{
  "apiVersion": "2018-10-01",
  "type": "Microsoft.Compute/virtualMachines",
  … 

The diagnostics profile enables you to select the storage account where you want to put these logs.

    "diagnosticsProfile": {
    "bootDiagnostics": {
    "enabled": true,
    "storageUri": "[concat('https://', parameters('newStorageAccountName'), '.blob.core.windows.net')]"
    }
    }
    }
}

For more information on deploying resources using templates, see Quickstart: Create and deploy Azure Resource Manager templates by using the Azure portal.

Enable boot diagnostics on existing virtual machine

To enable Boot diagnostics on an existing virtual machine, follow these steps:

  1. Sign in to the Azure portal, and then select the virtual machine.
  2. In the Support + troubleshooting section, select Boot diagnostics, then select the Settings tab.
  3. In Boot diagnostics settings, change the status to On, and from the Storage account drop-down list select a storage account.
  4. Save the change.

    Update Existing VM

You must restart the virtual machine for the change to take effect.

Enable boot diagnostics using the Azure CLI

You can use the Azure CLI to enable boot diagnostics on an existing Azure virtual machine. For more information, see az vm boot-diagnostics.