0
votes

I'm trying to add a route to an Azure IoT Hub, using Azure CLI, but without success.

az iot hub update --name $IotHubName `
                  --resource-group $ResourceGroupName `
                  --add properties.routing.endpoints.eventHubs '{\"connectionString\": \"Endpoint=sb://xyz-eh-ns.servicebus.windows.net/;SharedAccessKeyName=iothub_send;SharedAccessKey=(removed);EntityPath=iothub-telemetry\", \"name\": \"telemetry-eventhub-endpoint\", \"additionalProperties\": { \"id\": \"1be28790-5281-4de8-992c-022271e8147e\" }, \"subscriptionId\": \"(removed)\", \"resourceGroup\": \"xyz-rg\"}'

The response is "Parameter 'RoutingEventHubProperties.connection_string' can not be None.". I've tried changing the connection string to just random characters, but then I get the error that the connection string is invalid.

What am I doing wrong?

1

1 Answers

1
votes

Your "--add" parameter value format not right.

Based on this document, it has this format:

--add properties.routing.endpoints.eventHubs connectionString=YOUR EVNET HUB ENTITY CONNECTION STRING name=YOUR EVENT HUB ENTITY NAME subscriptionId=YOUR SUBCRIPTION ID resourceGroup=YOUR RESOURCE GROUP NAME

For your case it will like this:

--add properties.routing.endpoints.eventHubs connectionString=Endpoint=sb://xyz-eh-ns.servicebus.windows.net/;SharedAccessKeyName=iothub_send;SharedAccessKey=(removed);EntityPath=iothub-telemetry name=telemetry-eventhub-endpoint subscriptionId=(removed) resourceGroup=xyz-rg

If the operation executes successfully, you will see "Finished .." log and the added route endpoints information:

enter image description here

enter image description here