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
  • Tutorials & Guides
  • Azure
  • Azure IoT Hub & Device Provisioning Service

Understanding telemetry message and properties in Azure IoT

In this article, you will learn about telemetry and how to add user-defined and system message properties.

Written by Mads Mikkelsen

Updated at December 17th, 2024

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

What is a telemetry in Azure IoT? Message properties How to add system properties for content-encoding and content-type to telemetry

Articles in this section:

  • Creating a IoT Hub and device in Azure
  • Getting device Connection String from Azure IoT
  • Connecting PLCs to Azure IoT Hub
  • Monitoring IoT Hub events, messages & metrics
  • How to get started with Azure Device Provisioning Service in IIoT
  • Understanding telemetry message and properties in Azure IoT

What is a telemetry in Azure IoT?

In short a telemetry message from a device to an Azure IoT Hub consists of:

  • Body, the actual data from the IoT device. Parameter name: body
  • System properties, meta data about the message and connection: Parameter name: systemProperties
  • Message properties, custom properties set by the developer of the IoT device. Parameter name: properties

When sending telemetry messages to Azure IoT Hub you send a body which is normally in JSON. An example could be:

{
	"temperature": 23.4
	"humidity": 45
} 

which defines information relevant to process and store in Azure. Additionally a message also contains system properties populated by Azure IoT and message properties which the user can define.

A full message which includes the system properties and the message properties could look as follows:

{
  "body": "{ \"temperature\": 23.4 \"humidity\": 45 }",
  "enqueuedTime": "Tue Dec 17 2024 14:28:20 GMT+0100 (Central European Standard Time)",
"properties": { "alarm_level": "info",
"priority": "low" },
"sequenceNumber": 576603, "systemProperties": { "iothub-message-source": "Telemetry", "iothub-connection-device-id": "DemoSIA", "iothub-connection-auth-method": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\"}", "iothub-connection-auth-generation-id": "637480328383432313", "iothub-enqueuedtime": 1734442100314, "x-opt-sequence-number-epoch": -1 } }

 

Message properties

A message property defines the meta data of the message which an Azure function can use to filter or do other processing with but can be discarded afterwards. Its primarily function is to act as message routing together with routing rules and for processing of the message. 

The message properties are transmitted within the telemetry message in the following example you can see the message parameter which defines the properties:

{
  ....
  "properties": {
    "Facility": "Bottle_plant",
    "Floor": "1"
  },
  ....
}

which defines a location for the given sensor and can be used in Azure for message routing rules or processing of the telemetry message.

 

How to add system properties for content-encoding and content-type to telemetry

Additionally you can also add custom system properties in the telemetry by defining them in the message properties in SIA Connect such as system properties for content-encoding and content-type.

To define the content-encoding and content-type you need to apply the following message property format:

{

       "$.ce": "utf-8",
       "$.ct": "application/json"
 }

together with any additional custom message properties you would like. Where $.ce defines the content-encoding and $.ct defines the content-type.

This would add below properties to the system properties in the telemetry message:

{


  ....
  "systemProperties": {
    ....
    "contentType": "application/json",
    "contentEncoding": "utf-8"
  }
}

 

microsoft iot

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Monitoring IoT Hub events, messages & metrics
  • Connecting PLCs to Azure IoT Hub

0
0
Expand