-
Notifications
You must be signed in to change notification settings - Fork 3.4k
az serial-console connect prints raw Python bytes #33164
Copy link
Copy link
Open
Azure/azure-cli-extensions
#9772Labels
Auto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamOutputUpgradeaz upgradeaz upgradeact-platform-engineering-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAuto-ResolveAuto resolve by botAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamOutputUpgradeaz upgradeaz upgradeact-platform-engineering-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
Description
az serial-console connectprints raw Pythonbytesrepr strings (e.g.b'\r\r\n',b'login: ') instead of decoded text when running in WSL or any environment wherewebsocket-clientdelivers binary WebSocket frames.Steps to Reproduce
az serial-console connect --name <vm> --resource-group <rg>from WSLRoot Cause
In
custom.py, theon_messagecallback passesmessagedirectly toPC.print(). Whenwebsocket-clientreceives a binary WebSocket frame, it delivers abytesobject.PC.print()calls Python'sprint()on it, which renders asb'...'repr instead of actual text.Fix
Decode
bytestostrbefore printing:Environment
az serial-consoleextension version: 1.0.0b3websocket-clientversion: 1.3.1Related command
az serial-console connect --name --resource-group
Errors
Output looks like:
Started \x1b[0;1;39mazsecmond.service\x1b[0m - Azure security monitoring daemon.\r\n[\x1b[0;1;31mFAILED\x1b[0m] Failed to start \x1b[0;1;39mazsecmond.service\x1b[0m - Azure security monitoring daemon.\r\nSee 'systemctl status azsecmond.service' for details.\r\n
Issue script & Debug output
n/a
Expected behavior
Properly formatted output like:
[ OK ] Stopped systemd-tmpfiles-setup-dev…ic Device Nodes in /dev gracefully.
[ OK ] Stopped kmod-static-nodes.service …Create List of Static Device Nodes.
[ OK ] Stopped systemd-vconsole-setup.service - Virtual Console Setup.
[ OK ] Finished initrd-udevadm-cleanup-db.service - Cleanup udev Database.
[ OK ] Reached target initrd-switch-root.target - Switch Root.
Environment Summary
$ az --version
azure-cli 2.84.0 *
core 2.84.0 *
telemetry 1.1.0
Extensions:
azure-devops 1.0.2
serial-console 1.0.0b3
Dependencies:
msal 1.35.0b1
azure-mgmt-resource 24.0.0
Python location '/usr/sbin/python3.12'
Config directory '/var/azure'
Extensions directory '/var/azure/cliextensions'
Python (Linux) 3.12.12 (main, Jan 16 2026, 00:00:00) [GCC 15.2.1 20251211 (Red Hat 15.2.1-5)]
Legal docs and information: aka.ms/AzureCliLegal
You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
Additional context
No response