Azure IoT Hub

Azure IoT Hub is a managed service that enables reliable and secure bi-directional communication between millions of IoT devices and a cloud solution backend.

Get Started

Key Features

Quick Start

Follow these steps to create an IoT Hub and connect a test device.

az group create --name MyIoTHubRG --location eastus
az iot hub create --resource-group MyIoTHubRG --name MyIoTHub --sku S1
az iot hub device-identity create --hub-name MyIoTHub --device-id test-device
az iot hub device-twin show --hub-name MyIoTHub --device-id test-device

Use the connection string from the last command to configure your device SDK.

Sample Code (Node.js)

const { Client } = require('azure-iot-device');
const { Mqtt } = require('azure-iot-device-mqtt');

const connectionString = 'HostName=MyIoTHub.azure-devices.net;DeviceId=test-device;SharedAccessKey=...';
const client = Client.fromConnectionString(connectionString, Mqtt);

client.open()
    .then(() => client.sendEvent({ temperature: 23.5 }))
    .then(() => console.log('Message sent'))
    .catch(err => console.error('Error: ', err));

Documentation