How to connect to an Azure VM using the Serial Console

Microsoft Azure provides the capability to connect to any running VM in Azure using the serial console. Both Windows and Linux VMs can be connected using the serial console. The serial console is very useful to troubleshoot any issue related to VM connectivity and the configuration. you can even use the serial console to turn-on / off any Windows roles.

Prerequisites

  • Boot Diagnostics for the VM should be enabled 
  • A user who is using the Serial console should have contributor access to the VM
  • VM should have a password-based user to login to the serial console
  • Server Operating System, Serial console isn’t available for client VMs 

By default serial console is turned on for all the latest Azure VMs, For older Windows Server images (created before February 2018), you can automatically enable the serial console through Azure portal by selecting the VM and select Run Command and select EMS 

How to Enable Serial Console if it’s not enabled

Once Serial console is enabled, you can connect to the serial console and type CMD to create a new CMD channel. 

once CMD channel is created, Channel can be selected by typing ch -si 1 (if you open multiple CMD channel, you will need to select the number based on the channel, for example, channel cmd0002 you will use ch -si 2)

Once you select the channel, you will be prompted to supply the VM login credentials for the authentication, you will only be able to see the cmd prompt once you are successfully authhenticated

Once Logged-in, you can type Powershell to start the PowerShell session

Start the PowerShell session

Once Powershell session is started, you can run PowerShell commands, in this example, I have enabled Bitlocker feature using the PowerShell.

You can now run any windows PowerShell command

Cheers!!