Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to monitor by IoT hub with az iot hub monitor-events #81

Open
venkin84 opened this issue Jul 14, 2019 · 8 comments
Open

Not able to monitor by IoT hub with az iot hub monitor-events #81

venkin84 opened this issue Jul 14, 2019 · 8 comments

Comments

@venkin84
Copy link

venkin84 commented Jul 14, 2019

I am not able to monitor my IoT hub with the Azure CLI command...
az iot hub monitor-events -n "IoT hub name" --login "Connect String"

When I try to do the same I get the following error...
Starting event monitor, use ctrl-c to stop...
Failed to open Message Receiver. Please confirm credentials and target URI.
The command failed with an unexpected error. Here is the traceback:

Failed to open Message Receiver. Please confirm credentials and target URI.
Traceback (most recent call last):
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\knack\knack\cli.py", line 206, in invoke
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 575, in execute
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 633, in _run_jobs_serially
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init_.py", line 626, in run_job
File "C:\Users\VSSADM1\AppData\Local\Temp\pip-install-76yvurxi\six\six.py", line 693, in reraise
File "C:\Users\VSSADM
1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init
.py", line 603, in run_job
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core\commands_init
.py", line 305, in call
File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-76yvurxi\azure-cli-core\azure\cli\core_init_.py", line 470, in default_command_handler
File "C:\Users\e452034.azure\cliextensions\azure-cli-iot-ext\azext_iot\operations\hub.py", line 1332, in iot_hub_monitor_events
devices=device_ids)
File "C:\Users\e452034.azure\cliextensions\azure-cli-iot-ext\azext_iot\operations\events3_events.py", line 66, in executor
raise RuntimeError(error)
RuntimeError: Failed to open Message Receiver. Please confirm credentials and target URI.`

Note: I have also tried to monitor my IoT hub via iothub-explorer and Service bus explorer. But I am also not able to monitor with them as well.
I am able to do other things though hence there seems to be no issue with the connection string I am using.

@digimaun
Copy link
Member

Hey @venkin84 , sorry for the extremely delayed response. Is this still an issue with the latest extension?

@digimaun
Copy link
Member

Closing issue due to lack of activity. Please try with the latest IoT extension version and we can reopen/revisit if its still a problem.

@andrewholler
Copy link

This is still an issue

@vilit1
Copy link
Contributor

vilit1 commented Dec 6, 2024

re-opening issue. @andrewholler can you post the debug output with the latest IoT CLI extension version? Also please include the az version output.

@vilit1 vilit1 reopened this Dec 6, 2024
@andrewholler
Copy link

andrewholler commented Dec 9, 2024

@vilit1 here are the version and debug logs as requested. I actually seem to have narrowed down the issue. I am testing from a network-restricted IoT Hub and VPN from on-prem environment. After reviewing the logs I suspected I might be dealing with a FW issue since this command only seems to use AMQP connections. I disconnected from the VPN, I disabled my proxy environment variables, and opened the IoT Hub to "All networks". I re-ran the monitor-events command and started successfully reading the IoT Hub. I sent some messages to the IoT Hub from node.js generated code from the IOT Hub VS Code extension and saw them come through my monitor-events command in the CLI. The issue I suspect, was a firewall issue attempting to egress my company firewall on port 5671.

I don't know the specifics and if IoT Hub supports monitoring incoming messages with HTTPS, but if it did, it would be a useful to specify which protocol is used for the monitor-events command. In that case, traffic could egress through my company proxy instead of requiring a firewall rule.

PS C:\Users\user1> az -v
azure-cli                         2.67.0

core                              2.67.0
telemetry                          1.1.0

Extensions:
azure-iot                         0.25.0
nsp                                0.3.0
vm-repair                          1.0.7

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\user1\.azure\cliextensions'

Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct  1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

PS C:\Users\user1> az iot hub monitor-events --hub-name testrbaciothub --login 'HostName=testrbaciothub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=***' --debug
cli.knack.cli: Command arguments: ['iot', 'hub', 'monitor-events', '--hub-name', 'testrbaciothub', '--login', 'HostName=testrbaciothub.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=***', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x000002931454F2E0>, <function OutputProducer.on_global_arguments at 0x00000293148EC040>, <function CLIQuery.on_global_arguments at 0x0000029314911440>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'iot': ['azure.cli.command_modules.iot', 'azext_iot']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name                  Load Time    Groups  Commands
cli.azure.cli.core: iot                       0.506        19        82
cli.azure.cli.core: Total (1)                 0.506        19        82
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name                  Load Time    Groups  Commands  Directory
cli.azure.cli.core: azure-iot                 0.018        97       325  C:\Users\user1\.azure\cliextensions\azure-iot
cli.azure.cli.core: Total (1)                 0.018        97       325
cli.azure.cli.core: Loaded 111 groups, 407 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : iot hub monitor-events
cli.azure.cli.core: Command table: iot hub monitor-events
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x0000029316FC5C60>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\user1\.azure\commands\2024-12-09.08-36-10.iot_hub_monitor-events.22240.log'.
az_command_data_logger: command args: iot hub monitor-events --hub-name {} --login {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x0000029316FFF2E0>]
cli.azure.cli.core: Current cloud config:
AzureCloud
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x00000293179456C0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x0000029317945800>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x00000293179458A0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000293148EC0E0>, <function CLIQuery.handle_query_parameter at 0x00000293149114E0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x0000029317945760>]
az_command_data_logger: extension name: azure-iot
az_command_data_logger: extension version: 0.25.0
asyncio: Using proactor: IocpProactor
uamqp.c_uamqp: Creating SASL Mechanism
uamqp: Initializing platform.
uamqp.connection: Connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1' state changed from <ConnectionState.START: 0> to <ConnectionState.START: 0>
uamqp.c_uamqp: Wrapping value type: <AMQPType.CompositeType: 23>
uamqp.c_uamqp: Wrapping value type: <AMQPType.CompositeType: 23>
uamqp.receiver: Message receiver b'receiver-link-13fe32ac-c984-41e5-81be-6d1dac939697' state changed from <MessageReceiverState.Idle: 1> to <MessageReceiverState.Opening: 2> on connection: b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1'
uamqp.c_uamqp: b'Failure: connect failure 10060.' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\deps\\azure-c-shared-utility\\adapters\\socketio_win32.c':b'connect_socket':193)
uamqp.c_uamqp: b'connect_socket failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\deps\\azure-c-shared-utility\\adapters\\socketio_win32.c':b'initiate_socket_connection':231)
uamqp.c_uamqp: b'initiate_socket_connection failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\deps\\azure-c-shared-utility\\adapters\\socketio_win32.c':b'socketio_open':481)
uamqp.c_uamqp: b'invalid tls_io_instance->tlsio_state = TLSIO_STATE_NOT_OPEN (1)' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\deps\\azure-c-shared-utility\\adapters\\tlsio_schannel.c':b'tlsio_schannel_close':1321)
uamqp.connection: Connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1' state changed from <ConnectionState.START: 0> to <ConnectionState.END: 13>
uamqp.connection: Connection with ID b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1' unexpectedly in an error state. Closing: False, Error: None
uamqp.c_uamqp: b'xio_open failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\deps\\azure-c-shared-utility\\adapters\\tlsio_schannel.c':b'tlsio_schannel_open':1291)
uamqp.c_uamqp: b'xio_open failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\src\\saslclientio.c':b'saslclientio_open_async':1097)
uamqp.c_uamqp: b'Opening the underlying IO failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\src\\connection.c':b'connection_open':1345)
uamqp.connection: Connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1' state changed from <ConnectionState.END: 13> to <ConnectionState.END: 13>
uamqp.c_uamqp: b'Begin session failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\src\\link.c':b'link_attach':1322)
uamqp.c_uamqp: b'Link attach failed' (b'D:\\a\\_work\\1\\s\\src\\vendor\\azure-uamqp-c\\src\\message_receiver.c':b'messagereceiver_open':430)
uamqp.receiver: Receiver link failed to open - expecting to receive DETACH frame.
uamqp.c_uamqp: Destroying cMessageReceiver
uamqp.c_uamqp: Destroying cLink
uamqp.async_ops.client_async: Closing non-CBS session.
uamqp.c_uamqp: Destroying cSession
uamqp.async_ops.client_async: Closing exclusive connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1'.
uamqp.async_ops.connection_async: Unlocked connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1' to close.
uamqp.async_ops.connection_async: Shutting down connection b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1'.
uamqp.c_uamqp: Destroying Connection
uamqp.c_uamqp: Destroying XIO
uamqp.c_uamqp: Destroying XIO
uamqp.c_uamqp: Destroying SASLMechanism
uamqp.async_ops.connection_async: Connection shutdown complete b'028b983f-5eb4-44ca-b2f1-aeda5beb69d1'.
uamqp: Deinitializing platform.
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 130, in open_async
    self._receiver.open(self)
  File ".\\src/message_receiver.pyx", line 52, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/message_receiver.pyx", line 54, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/base.pyx", line 31, in uamqp.c_uamqp.StructBase._value_error
ValueError: Operation failed.

During handling of the above exception, another exception occurred:

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 666, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 733, 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 703, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, 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\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2675, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2796, in _iot_hub_monitor_events
    target = hub_target_builder.EventTargetBuilder().build_iot_hub_target(target)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 39, in build_iot_hub_target
    return self.eventLoop.run_until_complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncio\base_events.py", line 687, in run_until_complete
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 77, in _build_iot_hub_target_async
    _, update = await self._evaluate_redirect(endpoint)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 61, in _evaluate_redirect
    await receive_client.receive_message_batch_async(max_batch_size=1)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 947, in receive_message_batch_async
    receiving = await self.do_work_async()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 374, in do_work_async
    if not await self.client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 358, in client_ready_async
    if not await self._client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 824, in _client_ready_async
    await asyncio.shield(self.message_handler.open_async(), **self._internal_kwargs)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 132, in open_async
    raise errors.AMQPConnectionError(
uamqp.errors.AMQPConnectionError: Failed to open Message Receiver. Please confirm credentials and target URI.

cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
cli.azure.cli.core.azclierror: Failed to open Message Receiver. Please confirm credentials and target URI.
Traceback (most recent call last):
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 130, in open_async
    self._receiver.open(self)
  File ".\\src/message_receiver.pyx", line 52, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/message_receiver.pyx", line 54, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/base.pyx", line 31, in uamqp.c_uamqp.StructBase._value_error
ValueError: Operation failed.

During handling of the above exception, another exception occurred:

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 666, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 733, 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 703, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, 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\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2675, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2796, in _iot_hub_monitor_events
    target = hub_target_builder.EventTargetBuilder().build_iot_hub_target(target)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 39, in build_iot_hub_target
    return self.eventLoop.run_until_complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncio\base_events.py", line 687, in run_until_complete
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 77, in _build_iot_hub_target_async
    _, update = await self._evaluate_redirect(endpoint)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 61, in _evaluate_redirect
    await receive_client.receive_message_batch_async(max_batch_size=1)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 947, in receive_message_batch_async
    receiving = await self.do_work_async()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 374, in do_work_async
    if not await self.client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 358, in client_ready_async
    if not await self._client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 824, in _client_ready_async
    await asyncio.shield(self.message_handler.open_async(), **self._internal_kwargs)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 132, in open_async
    raise errors.AMQPConnectionError(
uamqp.errors.AMQPConnectionError: Failed to open Message Receiver. Please confirm credentials and target URI.
az_command_data_logger: Failed to open Message Receiver. Please confirm credentials and target URI.
Traceback (most recent call last):
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 130, in open_async
    self._receiver.open(self)
  File ".\\src/message_receiver.pyx", line 52, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/message_receiver.pyx", line 54, in uamqp.c_uamqp.cMessageReceiver.open
  File ".\\src/base.pyx", line 31, in uamqp.c_uamqp.StructBase._value_error
ValueError: Operation failed.

During handling of the above exception, another exception occurred:

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 666, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 733, 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 703, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 336, 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\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2675, in iot_hub_monitor_events
    _iot_hub_monitor_events(
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\operations\hub.py", line 2796, in _iot_hub_monitor_events
    target = hub_target_builder.EventTargetBuilder().build_iot_hub_target(target)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 39, in build_iot_hub_target
    return self.eventLoop.run_until_complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "asyncio\base_events.py", line 687, in run_until_complete
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 77, in _build_iot_hub_target_async
    _, update = await self._evaluate_redirect(endpoint)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\azext_iot\monitor\builders\hub_target_builder.py", line 61, in _evaluate_redirect
    await receive_client.receive_message_batch_async(max_batch_size=1)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 947, in receive_message_batch_async
    receiving = await self.do_work_async()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 374, in do_work_async
    if not await self.client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 358, in client_ready_async
    if not await self._client_ready_async():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\client_async.py", line 824, in _client_ready_async
    await asyncio.shield(self.message_handler.open_async(), **self._internal_kwargs)
  File "C:\Users\user1\.azure\cliextensions\azure-iot\uamqp\async_ops\receiver_async.py", line 132, in open_async
    raise errors.AMQPConnectionError(
uamqp.errors.AMQPConnectionError: Failed to open Message Receiver. Please confirm credentials and target URI.
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x0000029316FC5EE0>]
az_command_data_logger: exit code: 1
cli.__main__: Command ran in 28.331 seconds (init: 0.275, invoke: 28.057)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 7841 in cache file under C:\Users\user1\.azure\telemetry\20241209083638440
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\user1\.azure C:\Users\user1\.azure\telemetry\20241209083638440"
telemetry.process: Return from creating process 25168
telemetry.main: Finish creating telemetry upload process.
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:

@vilit1
Copy link
Contributor

vilit1 commented Dec 10, 2024

@andrewholler
Copy link

We use uamqp in the CLI (https://github.com/Azure/azure-iot-cli-extension/blob/dev/azext_iot/monitor/telemetry.py#L102).

This is the only supported protocol for reading messages from the hub as of now: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin

AMQP over WebSockets on port 443 would work just as well for the purposes of acceptable proxy traffic. Any traffic over 443 would work with most proxies. If we were able to toggle which protocol to use, that would be useful.

@vilit1
Copy link
Contributor

vilit1 commented Dec 13, 2024

I have added this feature request to the backlog but it is pending prioritization. For now, please use the workaround you found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants