title: Connecting to Azure Event Huba using Kafka CLI tools
body: <p>I'm trying to connect to Azure Event Hubs using the Kafka CLI tools. I can connect and interact with the server successfully from a .NET app using the relevant Azure and Confluent nuget packages, but I'm running into problems using the Kafka CLI tools (I've tried this in Docker, Windows and WSL2).</p>
  <pre><code>security.protocol=SASL_SSL
  sasl.mechanism=PLAIN
  sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=&quot;$ConnectionString&quot; password=&quot;Endpoint=sb://my-namespace.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessPolicy;SharedAccessKey=my-access-key=;EntityPath=my-topic&quot;;
  bootstrap.servers=my-namespace.servicebus.windows.net
  default.api.timeout=120000
  request.timeout.ms=60000
  </code></pre>
  <p>All other configuration options are default, except for the log levels (KAFKA_OPTS env var) and I added our company firewall's certificate to the Java keystore.</p>
  <p>Command line (Linux):</p>
  <pre><code>./kafka-topics.sh --list --bootstrap-server my-namespace.servicebus.windows.net:9093 --command-config ./consumer.config
  </code></pre>
  <p>Command line (Windows):</p>
  <pre><code>.\kafka-topics.bat  --list --bootstrap-server my-namespace.servicebus.windows.net:9093 --command-config ./consumer.config
  </code></pre>
  <p>Here are the relevant logs:</p>
  <pre><code>[13:17:23,518] DEBUG [AdminClient clientId=adminclient-1] Initiating connection to node my-namespace.servicebus.windows.net:9093 (id: -1 rack: null) using address my-namespace.servicebus.windows.net/102.133.250.65 (org.apache.kafka.clients.NetworkClient)
  [13:17:23,547] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to SEND_APIVERSIONS_REQUEST (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:23,549] DEBUG [AdminClient clientId=adminclient-1] Creating SaslClient: client=null;service=kafka;serviceHostname=my-namespace.servicebus.windows.net;mechs=[PLAIN] (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:23,559] DEBUG [AdminClient clientId=adminclient-1] Created socket with SO_RCVBUF = 65536, SO_SNDBUF = 131072, SO_TIMEOUT = 0 to node -1 (org.apache.kafka.common.network.Selector)
  [13:17:23,848] DEBUG [AdminClient clientId=adminclient-1] Completed connection to node -1. Fetching API versions. (org.apache.kafka.clients.NetworkClient)
  [13:17:23,935] DEBUG [SslTransportLayer channelId=-1 key=sun.nio.ch.SelectionKeyImpl@4374ad31] SSL handshake completed successfully with peerHost 'my-namespace.servicebus.windows.net' peerPort 9093 peerPrincipal 'CN=servicebus.windows.net, O=Microsoft Corporation, L=Redmond, ST=WA, C=US' cipherSuite 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384' (org.apache.kafka.common.network.SslTransportLayer)
  [13:17:24,006] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to RECEIVE_APIVERSIONS_RESPONSE (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,051] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to SEND_HANDSHAKE_REQUEST (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,052] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to RECEIVE_HANDSHAKE_RESPONSE (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,072] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to INITIAL (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,075] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to INTERMEDIATE (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,095] DEBUG [AdminClient clientId=adminclient-1] Set SASL client state to COMPLETE (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,095] DEBUG [AdminClient clientId=adminclient-1] Finished authentication with no session expiration and no session re-authentication (org.apache.kafka.common.security.authenticator.SaslClientAuthenticator)
  [13:17:24,096] DEBUG [AdminClient clientId=adminclient-1] Successfully authenticated with my-namespace.servicebus.windows.net/[removed] (org.apache.kafka.common.network.Selector)
  [13:17:24,096] DEBUG [AdminClient clientId=adminclient-1] Initiating API versions fetch from node -1. (org.apache.kafka.clients.NetworkClient)
  [13:17:24,097] DEBUG [AdminClient clientId=adminclient-1] Sending API_VERSIONS request with header RequestHeader(apiKey=API_VERSIONS, apiVersion=3, clientId=adminclient-1, correlationId=0) and timeout 3600000 to node -1: ApiVersionsRequestData(clientSoftwareName='apache-kafka-java', clientSoftwareVersion='3.2.1') (org.apache.kafka.clients.NetworkClient)
  [13:17:24,120] DEBUG [AdminClient clientId=adminclient-1] Received API_VERSIONS response from node -1 for request with header RequestHeader(apiKey=API_VERSIONS, apiVersion=3, clientId=adminclient-1, correlationId=0): ApiVersionsResponseData(errorCode=35, apiKeys=[], throttleTimeMs=0, supportedFeatures=[], finalizedFeaturesEpoch=-1, finalizedFeatures=[]) (org.apache.kafka.clients.NetworkClient)
  [13:17:24,121] DEBUG [AdminClient clientId=adminclient-1] Initiating API versions fetch from node -1. (org.apache.kafka.clients.NetworkClient)
  [13:17:24,121] DEBUG [AdminClient clientId=adminclient-1] Sending API_VERSIONS request with header RequestHeader(apiKey=API_VERSIONS, apiVersion=0, clientId=adminclient-1, correlationId=1) and timeout 3600000 to node -1: ApiVersionsRequestData(clientSoftwareName='apache-kafka-java', clientSoftwareVersion='3.2.1') (org.apache.kafka.clients.NetworkClient)
  [13:18:23,511] INFO [AdminClient clientId=adminclient-1] Disconnecting from -1 and revoking 1 node assignment(s) because the node is taking too long to become ready. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,511] INFO [AdminClient clientId=adminclient-1] Client requested disconnect from node -1 (org.apache.kafka.clients.NetworkClient)
  [13:18:23,512] DEBUG [AdminClient clientId=adminclient-1] Cancelled in-flight API_VERSIONS request with correlation id 1 due to node -1 being disconnected (elapsed time since creation: 59392ms, elapsed time since send: 59392ms, request timeout: 3600000ms): ApiVersionsRequestData(clientSoftwareName='apache-kafka-java', clientSoftwareVersion='3.2.1') (org.apache.kafka.clients.NetworkClient)
  [13:18:23,513] DEBUG [AdminClient clientId=adminclient-1] Call(callName=fetchMetadata, deadlineMs=1661858303511, tries=1, nextAllowedTryMs=1661858303613) timed out at 1661858303513 after 1 attempt(s) (org.apache.kafka.clients.admin.KafkaAdminClient)
  java.lang.Exception: TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
      at org.apache.kafka.clients.admin.KafkaAdminClient$Call.handleTimeoutFailure(KafkaAdminClient.java:843)
      at org.apache.kafka.clients.admin.KafkaAdminClient$Call.fail(KafkaAdminClient.java:812)
      at org.apache.kafka.clients.admin.KafkaAdminClient$TimeoutProcessor.handleTimeouts(KafkaAdminClient.java:942)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.timeoutPendingCalls(KafkaAdminClient.java:1021)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.processRequests(KafkaAdminClient.java:1375)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1339)
      at java.lang.Thread.run(Thread.java:748)
  [13:18:23,516] INFO [AdminClient clientId=adminclient-1] Metadata update failed (org.apache.kafka.clients.admin.internals.AdminMetadataManager)
  org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
  [13:18:23,516] DEBUG [AdminClient clientId=adminclient-1] Timed out 1 pending calls. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,516] DEBUG [AdminClient clientId=adminclient-1] Requesting metadata update. (org.apache.kafka.clients.admin.internals.AdminMetadataManager)
  [13:18:23,519] DEBUG [AdminClient clientId=adminclient-1] Call(callName=listTopics, deadlineMs=1661858303515, tries=1, nextAllowedTryMs=1661858303619) timed out at 1661858303519 after 1 attempt(s) (org.apache.kafka.clients.admin.KafkaAdminClient)
  java.lang.Exception: TimeoutException: Timed out waiting for a node assignment. Call: listTopics
      at org.apache.kafka.clients.admin.KafkaAdminClient$Call.handleTimeoutFailure(KafkaAdminClient.java:843)
      at org.apache.kafka.clients.admin.KafkaAdminClient$Call.fail(KafkaAdminClient.java:812)
      at org.apache.kafka.clients.admin.KafkaAdminClient$TimeoutProcessor.handleTimeouts(KafkaAdminClient.java:942)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.timeoutPendingCalls(KafkaAdminClient.java:1021)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.processRequests(KafkaAdminClient.java:1375)
      at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1339)
      at java.lang.Thread.run(Thread.java:748)
  [13:18:23,520] DEBUG [AdminClient clientId=adminclient-1] Timed out 1 pending calls. (org.apache.kafka.clients.admin.KafkaAdminClient)
  Error while executing topic command : Timed out waiting for a node assignment. Call: listTopics
  [13:18:23,522] ERROR org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics
   (kafka.admin.TopicCommand$)
  [13:18:23,522] DEBUG [AdminClient clientId=adminclient-1] Initiating close operation. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,524] DEBUG [AdminClient clientId=adminclient-1] Waiting for the I/O thread to exit. Hard shutdown in 31535999998 ms. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,524] INFO App info kafka.admin.client for adminclient-1 unregistered (org.apache.kafka.common.utils.AppInfoParser)
  [13:18:23,524] INFO [AdminClient clientId=adminclient-1] Metadata update failed (org.apache.kafka.clients.admin.internals.AdminMetadataManager)
  org.apache.kafka.common.errors.TimeoutException: The AdminClient thread has exited. Call: fetchMetadata
  [13:18:23,524] INFO [AdminClient clientId=adminclient-1] Timed out 1 remaining operation(s) during close. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,531] INFO Metrics scheduler closed (org.apache.kafka.common.metrics.Metrics)
  [13:18:23,531] INFO Closing reporter org.apache.kafka.common.metrics.JmxReporter (org.apache.kafka.common.metrics.Metrics)
  [13:18:23,531] INFO Metrics reporters closed (org.apache.kafka.common.metrics.Metrics)
  [13:18:23,531] DEBUG [AdminClient clientId=adminclient-1] Exiting AdminClientRunnable thread. (org.apache.kafka.clients.admin.KafkaAdminClient)
  [13:18:23,531] DEBUG [AdminClient clientId=adminclient-1] Kafka admin client closed. (org.apache.kafka.clients.admin.KafkaAdminClient)
  </code></pre>
  <p>The logs indicate that the <code>API_VERSIONS</code> request returns an Error Code of 35 (which means <a href="https://kafka.apache.org/20/protocol.html#protocol_compatibility" rel="nofollow noreferrer">Unsupported Version</a>?), but I'm not sure if this is the cause of the issue of simply another symptom of the underlying problem.</p>
  <p>Anyone have any idea about what the problem could be?</p>