I am trying to get the connection string of 'Event Hub-compatible endpoint' present in the iot hub using Azure CLI. Is there any command to get the connection string information?
1 Answers
3
votes
Yes, you can get the eventhub-compatible connection string of an IoT Hub with the following command:
az iot hub connection-string show -n <IoT Hub name> --default-eventhub
Do note that this reference is part of the azure-iot extension for Azure CLI and requires version 2.0.70 or higher.
As elaborated by @Stefan below:
One thing to note is that by default this command returns the connection string for the iothubowner
policy. Use the --policy-name
parameter to specify the shared access policy explicitly, for example:
az iot hub connection-string show -n <IoT Hub name> --default-eventhub --policy-name service
EventHubConnectionStringIsInvalid
to the title to help find this question and its accepted answer. – emi