November 11, 2025
November 11, 2025

Building a complete IoT solution requires more than just connecting devices to the cloud. You need secure data ingestion, real-time processing, storage, analytics, and visualization. This comprehensive tutorial demonstrates how to use Azure IoT services to create an end-to-end industrial IoT application.
We'll cover data collection from multiple devices, cloud connectivity, real-time analytics, and data visualization using Azure's IoT Suite.
Every end-to-end IoT solution consists of four essential subsystems:
The device layer includes equipment with connectivity capabilities to send and receive messages from the cloud over the internet. Most legacy factory equipment like PLCs and indicators lack these capabilities, so this subsystem typically includes:
The cloud gateway serves three primary roles:
Data Transport: Securely receives data from factory devices and in some cases sends commands back to devices
Device Management: Handles device list management, software upgrades, and configuration updates
Security: Ensures only authorized devices can connect to the IoT solution
Stream processors consume data from the cloud gateway, process it in real-time, store it appropriately, and pass it to business processes that need it. This layer handles analytics, filtering, aggregation, and routing.
The UI layer is where end users visualize and interact with telemetry data. It may also facilitate device management tasks like configuration updates and monitoring device health.
Microsoft Azure provides specific services for each subsystem:
Device Libraries: Software libraries in common languages (C#, Java, Python, C, Node.js) allow you to collect data from equipment and send it to the cloud. Azure also provides Node-RED packages for minimal-code implementations.
Azure IoT Hub: Acts as the cloud gateway, receiving telemetry data using MQTT and AMQP protocols. IoT Hub ensures only authorized devices connect using X.509 certificates or symmetric keys. It simplifies device management through device twins that synchronize physical device status with digital representations in the cloud.
Azure Stream Analytics: Processes IoT data from plant devices in real-time, routing it to storage and visualization systems.
Azure Time Series Insights: Combines efficient storage, visualization, and data exploration tools for time-stamped IoT data.
This tutorial uses several devices to demonstrate a realistic industrial scenario:
Opto 22 PAC Controller: Reads digital input switches for monitoring equipment status
Industrial IoT Gateway: Schneider Electric IoT Core box running Node-RED to collect data from the PAC controller
Raspberry Pi 3B+: Collects temperature and humidity data from a DHT11 sensor
Opto 22 GROOV EPIC Controller: Reads temperature from an analog temperature probe
Resource groups act as folders that organize all resources used in your IoT solution. This makes management and billing tracking easier.
Log into the Azure portal and navigate to Resource Groups. Click Add and provide:
Subscription: Your Azure subscriptionResource Group Name: A descriptive name like "AzureIoTCourse"Region: The data center location closest to your devices (for example, South Africa or West Europe)
Click Review and Create, then Create to provision the resource group.
From your resource group, click Add to see available Azure services. Search for "IoT Hub" or navigate to Internet of Things and select IoT Hub.
Configure the IoT Hub:
Subscription: Your Azure subscriptionResource Group: Select the resource group you just createdRegion: Choose your preferred data center locationIoT Hub Name: A globally unique name like "MyAzureCourseIoTHub"
Click Next to configure pricing and scale. For development and testing, the S1 Standard tier provides sufficient capabilities. Azure offers detailed guidance on selecting the appropriate tier based on message volume and feature requirements.
Click Review and Create, then Create to deploy the IoT Hub. Deployment typically takes a few minutes.
For every physical device connecting to your IoT solution, you must register a digital representation in the cloud. This digital version holds all connection information including:
The digital device acts as the master copy. If a physical device is destroyed or replaced, you can use the same connection information with a new device to restore connectivity. However, deleting the digital version prevents any physical device from connecting, even with valid credentials.
Changes made to the digital twin persist to the physical device when it connects, enabling remote configuration and management.
Navigate to your IoT Hub in the Azure portal. Scroll down to IoT Devices and click it, then click New.
Configure the device registration:
Device ID: A descriptive name like "RaspberryPi_TempHumidity"Authentication Type: Symmetric Key (simpler for development)Auto-generate keys: Enable this to let Azure create secure keysConnect this device to IoT Hub: Enabled
Click Save to create the device registration. Click on the device name to view its details and copy the primary connection string—you'll need this when building the application.
Open Visual Studio 2019 and create a new project. Select C# Universal Windows Platform (UWP) app as the template—this allows deployment to Raspberry Pi devices running Windows 10 IoT Core.
Name your project descriptively, such as "RaspberryPiTempHumidity."
The Azure IoT Device SDK provides libraries for communicating with IoT Hub. Right-click on your project, select Manage NuGet Packages, and search for "Microsoft.Azure.Devices.Client."
Install this package to add IoT Hub connectivity capabilities to your application.
For the DHT11 temperature and humidity sensor, install the appropriate sensor library through NuGet. Search for DHT sensor libraries compatible with Windows IoT Core.
Create code to initialize the sensor and read temperature and humidity values at regular intervals (for example, every 5 seconds).
Use the device connection string you copied earlier to authenticate with IoT Hub. Create a DeviceClient instance using the connection string, then send telemetry messages as JSON objects containing temperature and humidity values along with timestamps.
Deploy the application to your Raspberry Pi using Visual Studio's remote deployment feature. The application runs continuously, reading sensor data and transmitting it to Azure IoT Hub.
Device Explorer is a utility that monitors messages flowing into IoT Hub. Download and install it from the Microsoft GitHub repository.
Open Device Explorer and enter your IoT Hub connection string (found under Shared Access Policies > iothubowner in the Azure portal). Connect to the hub, navigate to the Data tab, select your Raspberry Pi device, and click Monitor.
You should see temperature and humidity messages arriving at regular intervals. This confirms the end-to-end connection from device to cloud works correctly.
Stream Analytics processes incoming data in real-time, applying transformations, aggregations, or machine learning functions before routing data to storage or visualization services.
Before creating the Stream Analytics job, add a consumer group to your IoT Hub. This prevents Stream Analytics from interfering with other services reading from the same hub.
Navigate to your IoT Hub, select Built-in Endpoints, and create a new consumer group named "StreamAnalyticsGroup."
Go to Create a Resource, select Analytics, then Stream Analytics Job. Provide a name like "TemperatureAnomalyDetection" and add it to your resource group.
In your Stream Analytics job, click Inputs and add a stream input. Select IoT Hub as the source and configure:
Input Alias: "IoTHub" (used in queries)Subscription: Your Azure subscriptionIoT Hub: Select your IoT HubConsumer Group: Select the consumer group created earlier
Click Outputs and add a Power BI output. Authorize Stream Analytics to connect to your Power BI account (requires a Power BI account or free trial).
Configure the output:
Output Alias: "PowerBI"Dataset Name: "StreamAnalyticsDataset"Table Name: "TemperatureData"
Click Edit Query to write the processing logic. For anomaly detection on temperature data:
sql
SELECT
time,
temperature,
AnomalyDetection_SpikeAndDip(temperature, 99, 500) as isAnomaly
INTO PowerBI
FROM IoTHub
This query uses Azure's built-in anomaly detection function with:
The function identifies both spikes and dips in temperature readings, outputting a signal that changes from 0 to 1 when anomalies are detected.
Save the query and start the Stream Analytics job.
Log into Power BI and create a new workspace for your IoT dashboards. After the Stream Analytics job runs for a few minutes, the dataset appears in your workspace.
Create a new dashboard and add tiles:
Add a tile with custom streaming data, select your Stream Analytics dataset, and configure:
Add another tile showing the current temperature as a single number card visualization.
Create a line chart with time on the axis and isAnomaly as the value. This displays when the system detects anomalous temperature patterns.
Test the anomaly detection by applying heat to your temperature sensor and watching the anomaly signal jump from 0 to 1 on your dashboard.
Time Series Insights provides powerful storage and visualization capabilities specifically designed for time-stamped IoT data.
Similar to Stream Analytics, create a dedicated consumer group for Time Series Insights in your IoT Hub. Name it "AzureTSIGroup."
Navigate to Create a Resource, select Internet of Things, then Time Series Insights. Configure:
Name: A descriptive name for your TSI environmentResource Group: Your existing resource groupEvent Source: IoT HubIoT Hub: Select your IoT HubAccess Policy: iothubownerConsumer Group: AzureTSIGroup
Create the environment and wait for deployment to complete.
Click "Go to Environment" to open the Time Series Insights explorer. The interface provides several visualization options:
Chart View: Display time series data as line chartsHeat Map: Show data density and patterns over timeTable View: See raw data in tabular formatCSV Export: Download data for external analysis
On the left panel, select which telemetry data points to display (temperature, humidity, etc.). You can select regions of interest and explore events to see precise values at specific timestamps.
Time Series Insights provides advanced data exploration tools including pattern analysis, correlation detection, and anomaly highlighting across long time periods.
Building an end-to-end Azure IoT solution involves multiple services working together. Azure IoT Hub securely receives device data, Stream Analytics processes it in real-time, and Time Series Insights provides long-term storage and visualization.
The key steps include creating an IoT Hub and resource group, registering devices with unique identities, building applications using Azure device SDKs, configuring Stream Analytics for real-time processing, and using visualization tools like Power BI and Time Series Insights for data exploration.
This architecture scales from small pilot projects to enterprise deployments handling millions of devices, providing a complete platform for industrial IoT solutions.