Getting Started with Microsoft Azure IoT Hub

  1. Home
  2. Microsoft Azure
  3. Getting Started with Microsoft Azure IoT Hub
Getting Started with Microsoft Azure IoT Hub

By connecting millions of devices and providing a potential revenue IoT (Internet of things) is setting the level high in the technology market. As a result, Microsoft came up with the service for turning your vision into reality using secure and scalable solutions that is Azure IoT hub. From providing a security-enhanced communication channel for sending and receiving data from IoT devices or getting compatibility with Azure IoT Edge and Azure Stack for building hybrid IoT applications, Azure IoT hub is used everywhere.

However, to learn more about this, in this blog we will be covering everything related to the Azure IoT hub including the steps to get started with it. But, before that let’s take a look at Azure IoT (Internet of things).

What is Azure IoT?

Azure Internet of Things (IoT) is a suite of cloud services and technologies designed to help organizations build, deploy, and manage IoT solutions. It includes a range of tools and services that enable customers to connect, monitor, and control devices, process and analyze data from those devices, and integrate with other Azure services to build intelligent applications and services.

Azure IoT includes a number of key components, including:

  • Azure IoT Hub: A cloud-based messaging hub that enables bi-directional communication between IoT devices and cloud services.
  • Azure IoT Edge: A solution that extends cloud intelligence and analytics to edge devices, enabling customers to run advanced analytics and machine learning models on IoT data locally, without requiring a connection to the cloud.
  • Azure IoT Central: A fully managed IoT application platform that provides pre-built templates, dashboards, and analytics tools to help customers quickly and easily build and deploy IoT solutions.
  • Azure Stream Analytics: A real-time data processing engine that allows customers to extract insights from IoT data in real-time, using a range of data sources and analytics tools.
  • Azure Time Series Insights: A service that enables customers to explore and analyze time-series data from IoT devices, and gain insights into historical and real-time data trends.
  • Azure IoT Security: A suite of security services and technologies that help customers secure their IoT solutions, including device authentication, access control, and threat detection.

Azure IoT provides a comprehensive set of tools and services that enable customers to build and manage secure, scalable, and intelligent IoT solutions, helping organizations to improve operational efficiency, increase productivity, and create new business opportunities.

Benefits of Azure IoT

Azure IoT provides the industry’s largest portfolio of services and capabilities.

Azure iot
  • Scalability: Azure IoT provides a scalable platform for connecting and managing IoT devices. You can easily connect and manage millions of devices, and scale your solution up or down as needed.
  • Security: Azure IoT provides a range of security features, including device authentication, access control, and threat detection, to help protect your IoT solution against security threats.
  • Integration: Azure IoT integrates with a wide range of other Azure services, including data analytics, machine learning, and storage services, enabling you to build intelligent, data-driven IoT solutions.
  • Flexibility: Azure IoT supports a range of protocols and programming languages, making it easy to integrate with a wide range of devices and systems.
  • Real-time insights: Azure IoT provides real-time insights into your IoT data, enabling you to quickly identify trends and anomalies, and take action in real-time.
  • Cost-effective: Azure IoT offers a range of pricing options, including pay-as-you-go and reserved capacity, to help you optimize costs and scale as your IoT needs grow.
  • Rapid development: Azure IoT provides a range of pre-built templates and tools that make it easy to quickly build and deploy IoT solutions, enabling you to get your solution to market faster.

What is Azure IoT Hub?

Azure IoT Hub is a cloud-based platform for managing and processing data from Internet of Things (IoT) devices. It provides a secure and scalable way to connect, monitor, and manage IoT devices and data in the cloud.

Azure IoT Hub enables bi-directional communication between IoT devices and cloud applications, allowing devices to send data to the cloud and receive commands and updates from the cloud. It supports a variety of protocols and languages, including MQTT, HTTPS, and AMQP, making it easy to integrate with a wide range of devices and systems.

With Azure IoT Hub, you can easily provision and manage IoT devices at scale, monitor device health and performance, and implement custom logic and processing for incoming device data. You can also integrate with other Azure services, such as Azure Stream Analytics and Azure Machine Learning, to enable advanced analytics and machine learning on your IoT data.

Let’s check some more points to learn more about Azure IoT Hub.

  • Firstly, this is used for building IoT solutions with reliable and secure communications between millions of IoT devices and a cloud-hosted solution backend. 
  • Secondly, it supports communications both from the device to the cloud and from the cloud to the device. And, there are multiple messaging patterns in this like device-to-cloud telemetry, file upload from devices, and request-reply methods for controlling devices from the cloud. 
  • Thirdly, IoT Hub monitoring helps in maintaining the health of your solution by tracking events like 
    • device creation
    • Then, device failures
    • device connections
  • Next, it provides the ability to build scalable, full-featured IoT solutions like
    • Firstly, managing industrial equipment used in manufacturing
    • Secondly, tracking valuable assets in healthcare
    • Then, monitoring office building usage.
  • Lastly, it helps in extending your solution from the cloud to the edge with per-device authentication, built-in device management, and scaled provisioning.
Is Microsoft Azure IoT Hub worth it?

Whether or not Microsoft Azure IoT Hub is worth it for your organization depends on your specific needs and requirements for an IoT platform. Here are some factors to consider:

  • Scalability: Azure IoT Hub provides a scalable platform for connecting and managing IoT devices, making it a good choice for organizations that need to manage large numbers of devices.
  • Security: Azure IoT Hub includes built-in security features such as device authentication and access control, which can help protect your IoT solution from security threats.
  • Integration: Azure IoT Hub integrates with a wide range of other Azure services, making it easy to build intelligent, data-driven IoT solutions.
  • Customization: Azure IoT Hub allows for custom logic and processing of incoming device data, which can be useful for organizations with specific requirements for data processing.
  • Pricing: Azure IoT Hub offers a range of pricing options, including pay-as-you-go and reserved capacity, which can help organizations optimize costs and scale as their IoT needs grow.

If your organization requires a scalable and secure platform for managing IoT devices and data, and if you need a platform that integrates well with other Azure services, then Azure IoT Hub could be a good choice. However, if your organization has different requirements, it may be worth considering other IoT platforms as well. It’s always a good idea to evaluate multiple platforms and compare their features and costs before making a decision.

Microsoft Azure IoT Hub

What are the Microsoft Azure IoT Hub features?

1. Scaling your solution
  • IoT Hub helps in scaling millions of simultaneously connected devices and events per second for supporting your IoT workloads. 
2. Securing your communications
  • IoT Hub provides a secure communication channel for your devices for sending data.
  • Secondly, per-device authentication enables each device to connect securely to IoT Hub and for each device to be managed securely.
  • Thirdly, this gives you full control over device access and connections at the per-device level.
  • Lastly, it automatically provisions devices to the right IoT hub when the device first boots up.
3. Routing device data

It provides built-in message routing functionality to get flexibility setting up automatic rules-based message fan-out:

  • Firstly, using message routing for controlling where your hub sends device telemetry.
  • Secondly, there is no additional cost for routing messages to multiple endpoints.
  • Lastly, no-code routing rules take the place of custom message dispatcher code.
4. Integrating with other services

This provides you the option to can integrate IoT Hub with other Azure services to build complete, end-to-end solutions. For example, use:

  • Firstly, Azure Event Grid for enabling your business to react quickly to critical events in a reliable, scalable, and secure manner.
  • Secondly, Azure Logic Apps for automating business processes.
  • Then, Azure Machine Learning for adding machine learning and AI models to your solution.
  • Lastly, Azure Stream Analytics for running real-time analytic computations on the data streaming from your devices.
5. Configuring and controlling your devices

Using an array of built-in functionality you can manage your devices connected to IoT Hub. For this:

  • Firstly, storing, synchronizing, and querying device metadata and state information for all your devices.
  • Secondly, setting device state either per-device or based on common characteristics of devices.
  • Lastly, automatically responding to a device-reported state change with message routing integration.
6. Connect your devices

For building applications running on your devices and interacting with IoT Hub using the Azure IoT device SDK libraries. Supported languages include:

  • C
  • Embedded C
  • C#
  • Java
  • Python
  • Node.js.

Further, there are protocols that IoT Hub and the device SDKs supports for connecting devices:

  • HTTPS
  • AMQP
  • AMQP over WebSockets
  • MQTT
  • MQTT over WebSockets
7. Establishing bidirectional communication with billions of IoT devices
  • Using device-to-cloud telemetry data for understanding the state of your devices and defining message routes to other Azure services without writing any code. However, in cloud-to-device messages, send commands and notifications to your connected devices and track message delivery with acknowledgment receipts.
8. Building and running hybrid IoT apps across datacenters
  • Azure Stack Hub refers to an extension of Azure used for providing a path for running apps in an on-premises environment and delivering Azure services in your datacenters. However, with Azure IoT Hub available on Azure Stack Hub, customers and partners will be able to build hybrid IoT apps running partially or entirely on-premises giving them the flexibility they need.
Azure Professional
What makes Azure IoT Hub secure?
  • Firstly, it decreases the risk by using Azure Defender for IoT, with security posture management and threat monitoring and remediation.
  • Secondly, increases connection security by connecting IoT devices to IoT Hub via virtual networks.
  • Lastly, it helps in protecting your business assets with our stringent security standards and the largest portfolio of compliance certifications in the industry.

Above we have learned and Azure IoT hub and features that make it unique. Now, it’s time to get started with creating an IoT hub. This section will help you get familiar with creating and managing the IoT hub.

Creating an IoT hub: Azure portal

Now, we will create an IoT hub:

1. Create an IoT hub
  • Firstly, sign in to the Azure portal.
  • Secondly, select the + Create a resource button. Then, in the search marketplace field, enter IoT Hub.
  • Thirdly, from the search results select IoT Hub and then select Create.
  • Now, complete the fields on the Basics tab:
    • Firstly, Subscription. select the subscription for use in the hub.
    • Secondly, Resource Group. Select a resource group. However, for creating a new one, select Create new and fill in the name you want to use. 
    • Thirdly, Region. Select the region for hub location.
    • Lastly, IoT Hub Name. Enter a unique name.
Create a hub in the Azure portal.
Source: Microsoft
  • After that, select Next: Networking to continue creating your hub.
    • Here, choose the endpoints for connecting to your IoT Hub. However, you can select the default setting Public endpoint or choose Public endpoint or Private endpoint.
Choose the endpoints that can connect.
Source: Microsoft
  • Then, select Next: Management for continuing in creating the hub process.
However, you can accept the default settings here. And, you can modify any of the following fields:
  1. Firstly, Pricing and scale tier: You can choose from several tiers based on how many features you want and messages you send through your solution per day. However, it gives access to 500 devices to be connected to the hub and 8,000 messages per day.
  2. Secondly, IoT Hub units. The number of messages allowed per unit per day is totally based on your hub’s pricing tier. 
  3. Thirdly, Defender for IoT. Turn this on for adding an extra layer of threat protection to IoT and your devices. 
  4. Lastly, Advanced Settings > Device-to-cloud partitions. This property links the device-to-cloud messages to the number of synchronous readers of the messages. 
  • Now, select Next: Tags to continue to the next screen.
    • Here, tags are name/value pairs. However, you can assign the same tag to multiple resources and resource groups for categorizing resources and consolidate billing.
Assign tags for the hub using the Azure portal.
Source: Microsoft
  • After that, select Next: Review + create for reviewing your choices. 
  • Lastly, select Create for creating your new hub.
2. Changing the settings of the IoT hub

After creating an IoT Hub pane, you can change the settings of an existing IoT hub.

Some of the properties you can set for an IoT hub are:

1. Pricing and scale

You can use this property for migrating to a different tier or set the number of IoT Hub units.

2. Operations monitoring

Turning the different monitoring categories on or off like logging for events related to device-to-cloud messages or cloud-to-device messages.

3. IP Filter

Defining a range of IP addresses that will either get accepted or rejected by the IoT hub.

4. Properties

Providing the list of properties for copying and using elsewhere. This includes the resource ID, resource group, location, and so on.

Shared access policies

Click on Shared access policies in the Settings section for viewing or modifying the list of shared access policies. However, these policies specify the permissions for devices and services for connecting to IoT Hub.

  • Firstly, click Add for opening the Add a shared access policy blade.
Screenshot showing adding a shared access policy
Source: Microsoft
  • Here, you can enter the new policy name and the permissions you want to associate with this policy:
    • Firstly, the Registry read and Registry write policies are for granting read and write access rights to the identity registry. 
    • Secondly, the Service connect policy is for granting permission for accessing service endpoints. This permission is used by back-end cloud services for sending and receiving messages from devices.
    • Lastly, the Device connect policy is for granting permissions for sending and receiving messages using the IoT Hub device-side endpoints. This permission is used by,
      • devices for sending and receiving messages from an IoT hub
      • updating and reading device twin
      • module twin data
      • performing file uploads.
  • Then, click Create to add this newly created policy to the existing list.
3. Registering a new device in the IoT hub
  • Firstly, open IoT Devices in your IoT hub navigation menu. Then, select New to add a device to your IoT hub.
  • Secondly, provide a name for your new device in Create a device. The name can be myDeviceId. Then, select Save for creating device identity for your IoT hub.
  • Lastly, after creating a device, open the device from the list in the IoT devices pane. Then, copy the Primary Connection String for using it later.
4. Message Routing for an IoT hub

Firstly, click Message Routing under Messaging for viewing the Message Routing pane. Then, specify the routes and custom endpoints for the hub. 

However, message routing is for managing how data is sent from your devices to your endpoints. The initial step here is to add a new route. After that, you can add an existing endpoint to the route. Or further, create a new one of the types supported, like blob storage.

Routes

  • On the Message Routing pane, Routes is the first tab. For adding a new route, click +Add.
Screenshot showing adding a new route
Source: Microsoft
  • Then, Name your route. The route name must be unique.
  • After that, Endpoint. For this, you can select one from the dropdown list, or add a new one. For example, a storage account and container are already available. Further, for adding them as an endpoint, click +Add next to the Endpoint dropdown and select Blob Storage. 
  • Now, click Pick a container for selecting the storage account and container. After selecting those fields, it returns to the Endpoint pane. Using the defaults for the rest of the fields and Create for creating the endpoint for the storage account. Then, add it to the routing rules.
  • Next, for Data source, select Device Telemetry Messages.
  • Then, add a routing query. In this example, the messages contain an application property called level with a value equal to critical are routed to the storage account.
  • Lastly, click Save for saving the routing rule. Now, you will get back to the Message Routing pane, and a new routing rule is displayed.

Custom endpoints

For this, click the Custom endpoints tab. There you will see any custom endpoints already created. From here, you can add new endpoints or delete existing endpoints.

However, you can define up to 10 custom endpoints for an IoT hub.

5. Find a specific IoT hub

For finding a specific IoT hub in your subscription, the ways are:

  • Firstly, if you know the resource group to which the IoT hub belongs, just click Resource groups.
    • Then select the resource group from the list. 
    • After that, the resource group screen displays all of the resources in that group, including the IoT hubs. 
    • Now, click on the hub for which you’re looking.
  • Secondly, click All resources. There is a dropdown list that defaults to All types on the All resources pane. 
    • Then, click on the dropdown list, uncheck Select all. 
    • Next, Find IoT Hub and check it. 
    • Lastly, click on the dropdown list box for closing it, and the entries will be filtered, showing only your IoT hubs.
6. Deleting the IoT hub

For deleting an IoT hub, find the IoT hub you want to delete. After that, click the Delete button mentioned below the IoT hub name.

Azure IoT Hub pricing

Azure IoT helps in connecting, monitoring, and controlling billions of IoT assets without the need for any upfront cost or termination fees. In Azure IoT hub pricing, you pay only for what you need. The pricing options include:

Basic tier

Edition TypePrice per IoT Hub unit (per month)Total number of messages/day per IoT Hub unitMessage meter size
B1₹720.4534,00,0004 KB
B2₹3,602.26360,00,0004 KB
B3₹36,022.6330,00,00,0004 KB
Source: Microsoft

Standard tier

Edition TypePrice per IoT Hub unit (per month)Total number of messages/day per IoT Hub unitMessage meter size
FreeFree8,0000.5 KB
S1₹1,801.1324,00,0004 KB
S2₹18,011.31560,00,0004 KB
S3₹1,80,113.1530,00,00,0004 KB
Source: Microsoft

Azure IoT Hub Device Provisioning Service

The Azure IoT Hub Device Provisioning Service is for enabling zero-touch provisioning to the right IoT Hub without requiring human intervention. This allows customers for provisioning millions of devices in a secure and scalable manner. Moreover, it enables device lifecycle support and important capabilities together with IoT Hub device management. This further helps customers address all stages of IoT device lifecycle.

TierPrice
S1 General Availability Price: ₹8.862 per 1,000 operations
Source: Microsoft

Final Words

Above we learned about the Azure IoT hub services for connecting, monitoring, and controlling millions of IoT assets running on a broad set of operating systems. This provides security for your IoT solutions by using per-device authentication for communicating with devices with the appropriate credentials. Moreover, many top companies like Maersk, Ecolab, and Mexa have shown their trust in the Azure IoT hub. So at last, go through the article for getting familiar with the internet of things services. Use the documentation for getting started it. I hope the above information will help you in starting your journey in the world of the Internet of things (IoT).

Iot developer
Menu