Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Home
  • Knowledge base
  • Contact Us
  • Home
  • Connectors
  • Azure IoT

Azure - Troubleshooting

Troubleshooting of Azure IoT Hub instances and items

Written by Mads Mikkelsen

Updated at September 5th, 2023

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Installation & Technical information
    Introduction SIA Connect Standalone SIA Connect ANY-Ware Cellular & WiFi connectivity
  • Configuration in the Web UI
    Getting started with the UI Connectors Instances Items Mapping Data System Network Tools & Add-ons DigiCert IoT Trust Manager
  • Connectors
    Siemens S7 Azure IoT Ethernet/IP Mitsubishi MELSEC OPC-UA Server SQL MQTT Omron Host Link REST API Omron FINS Keyence Beckhoff TwinCAT BACnet Virtual OPC-UA Client MS SQL File M-Bus Modbus
  • Scripting & Variables
    Data formatting
  • Developers
    API documentation Shadow API
  • Tutorials & Guides
    InfluxDB AWS IoT Core - Amazon Web Services Microsoft Power BI KaaIoT Siemens S7 AVEVA Insight SIA Connect Demo Rack Grafana Azure
  • General
+ More

Table of Contents

Table of Contents Troubleshooting in Azure Analyzing telemetry metrics Caution Info Monitor IoT Hub events & messages Info Error messages Instance Caution Sporadic "No network connection" Incorrect JSON response

Articles in this section:

  • Azure - Instance & item setup
  • Azure - Troubleshooting

Table of Contents

Troubleshooting in AzureAnalyzing telemetry metricsMonitor IoT Hub events & messagesError messagesSporadic "No network connection"Incorrect JSON response

This article will describe how to troubleshoot if data is not streaming into Azure IoT Hub from SIA and how to validate the data and connection.


Troubleshooting in Azure

If there are not errors on SIA but you cannot figure out whether or not the data is arriving in Azure we should start troubleshooting in Azure.
Often this is due to Azure is not recognizing the message (e.g. JSON format being wrong) or you might have forgot to set up a job that processes and forwards the data in Azure.

First thing, lets check we are receiving data.


Analyzing telemetry metrics

Caution

Viewing the metrics is not suitable if you have multiple devices as they will also appear on the metric


In Azure IoT Hub you have metrics available for the given hub. This metrics can show you valuable information such as telemetry messages being sent.
Viewing the amount of telemetry messages sent to the IoT Hub is a really basic way of validating it works and cannot give you further information than data is coming in. Please keep in mind if you have multiple devices which are receiving data on the Hub this metrics might not be suitable to use as their telemetry messages will also appear.

  • In Azure Portal go to IoT Hub and select the Hub where your IoT device belongs to
  • In the left menu go to Monitoring ➡ Metrics
  • Add new metric
    • Metric: Telemtry messages sent
    • Aggregation: Sum (you can use any of those available)
  • Select a suitable time range in in the top right of the metric
  • Analyze the metric and validate the data graph


Info

It can take a few minutes before the metrics start to update




Monitor IoT Hub events & messages

Monitoring the events and messages that are streaming into IoT Hub is a great way of debugging the data is coming in but also to validate the format of the message is correct.
To monitor the events and messages you will have to use the built-in Azure Cloud Shell or install Azure CLI tools on your desktop. We recommend for starters to use the built-in Azure Cloud Shell in the portal. 

For further information of Azure CLI on your desktop and the Azure Cloud Shell check these articles:

  • Install the Azure CLI | Microsoft Docs
  • Azure Cloud Shell overview | Microsoft Docs 


Info

Using the Azure Cloud Shell you might need to add storage to your account and install azure-iot extensions


To monitor the events and messages do the following if you are using the Azure Cloud Shell:

  • Click the terminal icon in the portals upper right corner next to your username.
  • When the Cloud Shell is ready use one of the following command to monitor all messages arriving into the IoT Hub
    az iot hub monitor-events --hub-name HubName
    az iot hub monitor-events --login "ConnectionString"
  • Or to monitor for a specific Device, which is very useful if you have many devices and are getting a lot of messages
    az iot hub monitor-events --hub-name HubName --device-id DeviceID
    az iot hub monitor-events --login "ConnectionString" --device-id DeviceID
  • To get a full list of parameters and help use
    az iot hub monitor-events -h
  • HubName and DeviceID can be located in IoT Hub ➡ IoT Devices
    • HubName is your IoT Hub name
    • DeviceID is the ID of the Device
    • ConnectionString is the connection string of your IoT Hub or device. Learn how to find ConnectionString here‍ 



The following video demonstrates how to monitor all the messages received in the IoT Hub.

Your browser does not support HTML5 video.



Error messages

This section will describe most of the common errors and faults encountered using the Azure IoT Hub Connector.


Instance


Caution

If the SharedAccessKey in the Connection String is invalid this is not returning any error. If no data is arriving to the IoT Hub and no errors are present at SIA then double check the Connection String and validate the SharedAccessKey inside it.


Error message Description Solution
No network connection No network connection or no route to the IoT Hub.
  • Validate SIA is online with access to Azure and the internet
    • Validate nameservers in SIA's network configuration or in the router
  • Wrong Connection String identify the correct Connection String and use that
Failed to connect to IoT Hub. Check your connection string in the address field The format of the Connection String is invalid. The expected format is: HostName=HubName.azure-devices.net;DeviceId=DeviceID;SharedAccessKey=Primary/SecondaryKey Copy the Connection String from the IoT Hub device into the address field on the instance and validate the format is correct.
Failed to get handle Azure IoT instances on the same installation cannot have different authentication types. For example, one instance using Symmetric Key (SAS) and another using x509 Certificate.   In case multiple Azure IoT Hub Instances are used on the same installation make sure they use same authentication type. 


Sporadic "No network connection"

  • Symptom:
    • Multiple identical messages are received
    • Logs show multiple lines of "NO_NETWORK_CONNECTION" errors
  • Issue:
    • The network is not fast enough to handle the complete transmission and response of the package.
      This might be further aggravated by using X2 ethernet port which does not have the same bandwidth as X1
  • Solution:
    • Increase the timeout of the instance, this will allow for more time to get a response from the network


Incorrect JSON response

  • Symptom:
    • The returned body message is an array with numbers instead of a proper JSON response with strings
  • Issue:
    • The payload sent to the cloud is not properly formatted (for example, in JSON format)
  • Solution:
    • Make sure strings are properly wrapped in quotes ("), including SIA instance/item parameters (for example: "%DEVICE.NAME%", "%ITEM.VALUE%"), unless the content of the variable itself is wrapped in quotes (making it a valid string needed by the JSON format)
    • Use an online JSON validator (for example: https://jsonlint.com/)
diagnosis azure

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Getting device Connection String from Azure IoT
  • Azure - Instance & item setup

0
0
Expand