Azure Virtual Machine Serial Console for Windows – A practical view

Azure VM Serial Console is a feature of Azure VM that connects to the COM1 serial port of the VM or Virtual Machine Scale Set (VMSS) instance regardless of the Virtual Machine’s network or Operating System state. Serial Console is mostly helpful in troubleshooting scenarios with Azure VM like network connectivity and operating system crash or unresponsive Azure VM. You can compare Azure VM Serial Console with Hyper-V or Vmware VM console where you can perform many troubleshooting actions when VM is either inaccessible due to any network or guest OS issues.

Note: Serial Console feature is enabled in all the recent Azure Marketplace images, however if you are using image created before February 2018 then you would require to enable this feature manually.

Azure VM Serial Console use cases:

  1. Troubleshooting Azure VM network connectivity and guest OS issues like boot failure via Azure portal, Serial console has made troubleshooting VM guest OS level issues very easy.
  2. Run interactive CMD or PowerShell cmdlet via Serial Console.
  3. Sending NMI (non-maskable interrupt) to Azure VM, this is helpful in the scenarios where Azure Windows VM is unresponsive or frozen and we need to generate dump to analyze it for troubleshooting purpose.

    Prerequisites for Azure VM Serial Console:

    1. VM Boot diagnostics must be enabled.

    2. VM Serial Console feature is only available for ARM (Azure Resource Manager) based deployment.
    3. User account that uses serial console must have the VM Contributor role for the VM and the boot diagnostics storage account.

    Let’s explore further practically….I have a Azure VM running Windows Server 2019 in my lab.

    If you go to Serial Console option of a Windows VM in Azure, this is how it will look like.

    If you run “help” on this prompt it will show us what all we can perform on this command channel.

    If you run “CMD” on SAC channel to enter to Windows native CMD channel, you would need to enter “ch -si 1” to switch to CMD channel.

    Then enter your Windows credentials to authenticate. Now you can run any native Windows CMD to perform administrative task or troubleshooting.

    You can also switch to PowerShell console from CMD easily.

    For some reason, if you would like to modify BCD to enable Windows boot loader prompts to display in the serial console, then you can do it via CMD or PowerShell console here.

    Now if you reboot the Azure Windows VM and monitor Serial Console, you would see it would ask if you want to go to Advanced Boot Option by pressing F8.

    This is great capability of Azure Serial Console that really saves huge amount of time in troubleshooting Windows OS issues with Azure VM.

    I pressed F8 and could see Advanced Boot Options, I chose “Safe Mode” just for the fun.

    And from Boot Diagnostics options I can verify that machine is running into Safe Mode at the moment.

    You can also manually initiate CRASH of the Windows guest OS of Azure VM by running “crashdump” cmd.

    Sending NMI (non-maskable interrupt) to Azure Windows VM:

    We can use Serial Console to send NMI, this helps in scenarios where Windows machine is completely frozen and not responding, once you send NMI then it create dump of the Windows OS (if configured already) and would restart the VM. Azure Windows VMs are configured for “Active Memory Dump” by default.

    Now click on “Send NMI“.

    This will generate guest OS dump and reboot the Virtual Machine.

    Please refer following Microsoft documentation to understand Windows dump files.

    Windows Active Memory Dump:

    Overview of memory dump file options for Windows:

Leave a Reply

Your email address will not be published. Required fields are marked *