When you troubleshoot issues on an Azure virtual machine (VM), you can connect to the VM by using the remote tools such as the serial console for Azure Virtual Machines, Run command, and many more. The Serial Console in the Azure portal provides access to a text-based console for Azure virtual machines (VMs) and virtual machine scale set instances. It is a great tool to troubleshoot Azure IaaS VMs if you lost access to the machine using RDP, SSH, or PowerShell remoting.
The Azure Serial Console works with Windows and Linux virtual machines. For Linux VMs, the serial connection connects to the ttys0 serial port of the VM or virtual machine scale set instance, providing access to it independent of the network or operating system state. For Windows VMs, the serial connection connects to the COM1 serial port of the VM or virtual machine scale set instance, providing access to it independent of the network or operating system state.
To use the serial console, you have the following prerequisites.
The VM or virtual machine scale set instance must have a password-based user. You can create one with the reset password function of the VM access extension.
The VM or virtual machine scale set instance must have boot diagnostics enabled.
To find more information check out Microsoft Docs.
Enable Serial Console functionality for Windows Server
In this blog post, I will quickly show you how you can enable the serial console for a Windows Server, if you want to do it for a Linux VM, check out the following link.
Newer Windows Server images on Azure have Special Administration Console (SAC) enabled by default. SAC is supported on server versions of Windows but isn't available on client versions (for example, Windows 10, Windows 8, or Windows 7).
Enable EMS Run Command
For older Windows Server images (created before February 2018), you can automatically enable the serial console through the Azure portal's run command feature. In the Azure portal, select Run command, then select the command named EnableEMS from the list.
There is also an option to enable EMS manually.
Access the VM using the Azure serial console
To access the serial console, you simply go to the virtual machine in the Azure portal, and under Support + troubleshooting, you can find the serial console.
Azure Serial Console
Now you can follow these steps:
Enter "cmd" to create a new channel for the CMD instance
Type "ch -si 1" to connect to the instance.
Enter your credentials to log in to the VM
Now you can run CMD commands, and if you need PowerShell, you can also just start PowerShell by typing "PowerShell".
Azure Serial Console PowerShell Session
The Azure Serial Console is a great way to troubleshoot network or access configurations for Azure virtual machines. You can learn more about the Azure serial console here:
I hope this blog post was helpful. If you have any questions or comments, feel free to leave a comment.