A C99 device SDK for Azure IoT Hub and the Azure IoT Hub Device Provisioning Service (DPS), built for constrained and embedded devices.
Preview (1.0.0-preview). APIs may change before the first stable release. See the changelog.
- Both IoT Hub generations: mqttv3 (MQTT 3.1.1) and mqttv5 (MQTT 5). DPS tells the device which one it was assigned to, and the SDK picks the protocol.
- X.509 authentication: certificates from files, certificates issued by DPS from a CSR, renewal over IoT Hub (mqttv3 only), and private keys held in a PKCS#11 token or TPM.
- Resilient connections: reconnection with backoff, re-provisioning, WebSockets and HTTP proxy support.
- Embedded-friendly API: callbacks run on the thread that calls into the SDK, and the connection and feature clients do no dynamic allocation.
- Pluggable MQTT: Eclipse Paho C by default; az_mqtt (single-threaded, no background
thread) with
AZ_IOT_WITH_AZ_MQTT=ON; or bring your own MQTT client through a small adapter interface.
Device features by IoT Hub generation:
| Feature | mqttv3 | mqttv5 |
|---|---|---|
| Telemetry | Yes | Yes |
| Device twin | Yes | Yes |
| Direct methods | Yes | Yes |
| Cloud-to-device messages | Yes | No |
| File upload | Yes | No |
| Certificate renewal over IoT Hub | Yes | No |
| Software updates | Yes, over DPS | Yes, over DPS |
Build it from source. Add c/ to your CMake project with add_subdirectory() or FetchContent,
or install it and use find_package(azure-iot-sdk). See
Building and installing.
On Linux, with the build tools installed (a C compiler, CMake 3.21+, Ninja, OpenSSL 3 development files), from this directory:
cmake --preset linux-gcc-debug
cmake --build --preset linux-gcc-debug --target az_iot_sample_unified_telemetry
./build/linux-gcc-debug/samples/unified/az_iot_sample_telemetryThe sample needs a DPS enrollment for the device and five environment variables. The telemetry sample explains both.
The samples overview lists every sample, with Windows build steps. Each sample has its own README.
| I want to... | Read |
|---|---|
| Understand how the SDK fits together | Architecture |
| Connect a device: states, provisioning, reconnection, proxies, certificates | Connecting a device |
| Set build options, buffer limits, logging and other settings | Client configuration |
| Collect logs for troubleshooting or support | Logging |
| Use my own MQTT client library | Bring your own MQTT client |
| Know what stays compatible between releases | Struct versioning |
| Install the SDK, consume it from CMake or pkg-config, or harden builds | Building and installing |
| Read the design and engineering notes | docs/eng |
API reference: the public headers in inc/azure/iot; each function is documented in its header.
- CI builds and tests the SDK on Linux (GCC, Clang) and Windows (MSVC), and builds it in strict C99, C11, C17 and C23 modes.
- A Yocto layer (scarthgap) builds the libraries, headers, CMake package and pkg-config files.
- To port to another platform, supply an MQTT adapter (Bring your own MQTT client) and, for software updates, a crypto backend and the platform hooks (ESP32 sample).
To get help, or to post a suggestion or comment, please file a GitHub issue.
See Contributing.
Please do not report security vulnerabilities through public GitHub issues. See SECURITY.md.
Licensed under the MIT license.