az-serial-console
Connect to virtual machine serial console
TLDR
Connect to a serial console
Terminate the connection
SYNOPSIS
az serial-console connect [--name VM_NAME] [--resource-group RG_NAME] [--subscription SUB_ID] [--connection-type {serial-port,ssh}] [--secure-memory] [--allow-guest-access]
PARAMETERS
--name, -n
Name of the target virtual machine
--resource-group, -g
Name of the resource group containing the VM
--subscription
Subscription ID or name
--connection-type
Connection mode: serial-port (default) or ssh
--secure-memory
Enable secure memory for the session (default: false)
--allow-guest-access
Permit guest OS access to console (policy-dependent)
--output, -o
Output format (json, table, etc.)
--query
JMESPath query string for output filtering
--verbose
Increase output verbosity
DESCRIPTION
The az serial-console command, part of the Azure Command-Line Interface (CLI), enables direct access to the serial console of Azure Virtual Machines (VMs). This is essential for troubleshooting scenarios where standard remote access methods like SSH or RDP fail due to network issues, boot failures, or misconfigurations.
It provides a text-based interface to the VM's boot loader, kernel output, and GRUB menu, allowing tasks such as password resets, GRUB edits, file system repairs, and kernel parameter changes. Supported on both Linux and Windows VMs, it mimics a physical serial port connection.
Key subcommand is connect, which opens an interactive session. Requires Azure CLI v2.30+ with the serial-console preview extension enabled in some versions. Ensure the VM has serial console enabled (via Azure portal under Serial console > Enable) and subscription policies permit access. Connections use WebSockets over HTTPS for security.
CAVEATS
Requires az login and serial console enabled on VM/subscription. Not available in all Azure regions. Interactive only; no scripting support. Disconnect with ~. May require VM reboot for changes. Preview feature in older CLI versions.
PREREQUISITES
Install Azure CLI (≥2.30), run az login. Enable via az vm serialconsole enable or portal.
DISCONNECT
Press Enter then ~. (tilde dot) to exit session.
LINUX USAGE
Access GRUB with e key; edit kernel params. Use Ctrl+D to boot.
HISTORY
Introduced in Azure CLI 2.9.0 (2020) as preview extension; stabilized in 2.30+ (2022). Enhanced with SSH support and secure memory in 2023 updates for better Windows compatibility.


