Hey, it’s Jorge. In this mini-post, I want to show you how to enable boot diagnostics on Azure virtual machines. This feature can be activated using the portal or command-line tools but today, I will show you how to enable this debugging feature using PowerShell and Azure CLI.

Enabling boot diagnostics will create a container in the desired storage account with the following name format.

Inside the container, you will find two blob pages, one BMP file from the latest VM screenshot, and a LOG file.


  • This tutorial assumes that you already have a Microsoft Azure account configured.
  • You can use an existing Storage Account, or you can create a new one. If you want to know how to create a Storage Account using PowerShell, check out this¬†link.

Important: The Boot diagnostics feature does not support a premium storage account.

Azure PowerShell Workaround

If you want to know how to install the PowerShell Azure module on your machine, check out this link.

The simplest way to get started is to sign in interactively at the command line.

This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:

Once you set your default subscription, you’re ready to start.

Set the variables

Here, we define the characteristics of our environment and the resource’s properties.

using the following command will store the VM in a variable to pass as a parameter in the next step.

Enable boot diagnostics

To enable Boot diagnostics on your virtual machine, using the Set-AzVMBootDiagnostic cmdlet with the following syntax.

boot diagnostics

and then you must use the Update-AzVM cmdlet to change takes effect.


Get boot diagnostic data

if you want to get boot diagnostic data from your virtual machine. you can use the Get-AzVMBootDiagnosticsData cmdlet to download the screenshot images to a local directory.

Disable boot diagnostics

To disable Boot diagnostics on your virtual machine, follow these steps:


Azure CLI Workaround

In this case, we will use Azure Cloud Shell, a browser-based shell built into Azure Portal. This allows us to use the Azure command-line tools (Azure CLI and Azure PowerShell) directly from a browser. If you want to know more about Azure Cloud Shell, check out this link.

First, we define the characteristics of our environment and store the values in variables.

To enable boot diagnostics with the Azure CLI, you must know the URL of the blob storage service.

Enable boot diagnostics

Once you have all the necessary information, you can enable the boot diagnostic feature with the following command.

Disable boot diagnostics

If you need to disable this functionality to change the storage account or simply want to disable it, use the following command.

Thanks for reading my post. I hope you find it useful.
For more information about other extensions Azure Diagnostics, see this link:https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostics-extension-overview