Azure-Samples / web-apps-node-iot-hub-data-visualization

web application for visualization data from IoT Hub
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-live-data-visualization-in-web-apps
MIT License
83 stars 432 forks source link

Invalid Connection string #49

Open elsni opened 3 years ago

elsni commented 3 years ago

I followed exactly the commands. az iot hub show-connection-string --hub-name IoTHubSmartSafety --policy-name service shows

This command has been deprecated and will be removed in a future release. Use 'IoT Extension (azure-iot) connection-string command (az iot hub connection-string show)' instead.
{
  "connectionString": "HostName=IoTHubSmartSafety.azure-devices.net;SharedAccessKeyName=service;SharedAccessKey=<key>"
}

I replaced the actual key string with <key>. The connection string does not seem to be working. npm start

outputs

Using IoT Hub connection string [HostName=IoTHubSmartSafety.azure-devices.net;DeviceId=odroidTemp;SharedAccessKey=<key>]
IoTHubSmartSafetyConsumerGroupOdroid
Using event hub consumer group [IoTHubSmartSafetyConsumerGroupOdroid]
Listening on 3000.
Invalid IotHub connection string.

Node Version: v12.14.1

drwill-ms commented 3 years ago

Hi @elsni, it looks like the connection string printed by the program includes a DeviceId=odroidTemp segment, which would indicate that is a device connection string, not a service connection string. Can you double check it?

elsni commented 3 years ago

I tried two different connection strings - I posted the output with the obviously incorrect device connection string, my bad.

This is the output with the correct connection string:

Using IoT Hub connection string [IoTHubSmartSafety.azure-devices.net;SharedAccessKeyName=service;SharedAccessKey=<key>]
IoTHubSmartSafetyConsumerGroupOdroid
Using event hub consumer group [IoTHubSmartSafetyConsumerGroupOdroid]
Listening on 3000.
Invalid IotHub connection string.
drwill-ms commented 3 years ago

@anthonyvercolano can someone from your team investigate?

YoDaMa commented 3 years ago

@drwill-ms I'll investigate.