azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

401 Error on a Container App in certain Resource Group

Open janderson-bh opened this issue 2 months ago • 5 comments

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name az containerapp exec Extension Name: containerapp. Version: 0.3.42.

Errors:

The command failed with an unexpected error. Here is the traceback:
Handshake status 401 Unauthorized
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "C:\Users\andejoh06\.azure\cliextensions\containerapp\azext_containerapp\custom.py", line 3403, in containerapp_ssh
    conn = WebSocketConnection(cmd=cmd, resource_group_name=resource_group_name, name=name, revision=revision,
  File "C:\Users\andejoh06\.azure\cliextensions\containerapp\azext_containerapp\_ssh_utils.py", line 62, in __init__
    self._socket.connect(self._url, header=[f"Authorization: Bearer {self._token}"])
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\websocket/_core.py", line 253, in connect
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\websocket/_handshake.py", line 57, in handshake
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\websocket/_handshake.py", line 148, in _get_resp_headers
websocket._exceptions.WebSocketBadStatusException: Handshake status 401 Unauthorized

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az containerapp exec -n {} -g {} --container {} --command {}

Expected Behavior

Environment Summary

Windows-10-10.0.26100-SP0
Python 3.10.10
Installer: MSI

azure-cli 2.48.1 *

Extensions:
containerapp 0.3.42

Dependencies:
msal 1.20.0
azure-mgmt-resource 22.0.0

Additional Context

janderson-bh avatar Nov 06 '25 02:11 janderson-bh

Thank you for opening this issue, we will look into it.

yonzhan avatar Nov 06 '25 02:11 yonzhan

Getting the same issue. @yonzhan Can you please provide an update on this?

HarringtonTom avatar Nov 06 '25 17:11 HarringtonTom

For some further information. I created another full Resource Group including Container App with the same Terraform code, different names and a different Region, this one works fine. I deleted the troublesome Resource Group, recreated it and the error persisted.

janderson-bh avatar Nov 06 '25 23:11 janderson-bh

Mine has randomly started working again this morning.

HarringtonTom avatar Nov 07 '25 09:11 HarringtonTom

It is also working for ne too, Without any change on my end.

janderson-bh avatar Nov 10 '25 03:11 janderson-bh