Home IoT & Hardware The Azure IoT Handbook

The Azure IoT Handbook

By Dan Clark
books-svg-icon Book
eBook $35.99 $24.99
Print $44.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $35.99 $24.99
Print $44.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: An Introduction to the IoT
About this book
With the rise of cloud-based computing, deploying IoT systems has become more cost-effective for businesses. This transformation has led to developers and architects shouldering the responsibility of creating, managing, and securing these systems, even if they are new to the IoT technology. The Azure IoT Handbook is a comprehensive introduction to quickly bring you up to speed in this rapidly evolving landscape. Starting with the basic building blocks of any IoT system, this book guides you through mobile device management and data collection using an IoT hub. You’ll explore essential tools for system security and monitoring. Following data collection, you’ll delve into real-time data analytics using Azure Stream Analytics and view real-time streaming on a Power BI dashboard. Packed with real-world examples, this book covers common IoT use as well. By the end of this IoT book, you’ll know how to design and develop IoT solutions leveraging intelligent edge-to-cloud technologies implemented on Azure.
Publication date:
December 2023
Publisher
Packt
Pages
248
ISBN
9781837633616

 

An Introduction to the IoT

The Internet of Things (IoT) is rapidly transforming the way we live, work, and interact with the world around us. It has the potential to revolutionize countless industries, from manufacturing and healthcare to transportation and agriculture. With billions of interconnected devices already in use, and that number projected to grow exponentially in the coming years, understanding and harnessing the power of the IoT is becoming increasingly important. This book aims to provide a comprehensive introduction to the IoT and is arranged to guide you through setting up and securing your devices, routing and analyzing data, and then visualizing and augmenting it. Although there are no prerequisites for this book, it would be beneficial to have some experience with programming and scripting languages.

This chapter introduces you to the IoT. It introduces some common use cases for developing IoT systems and introduces you to the common components of an IoT system. You will understand the benefits of an IoT hub and its role in the IoT system. The chapter ends with a hands-on lab where you will connect a virtual IoT device to an Azure IoT hub and capture the streaming data.

In this chapter, we’re going to cover the following main topics:

  • What is the IoT?
  • What are some common IoT use cases?
  • What are the components of an IoT system?
  • Lab – setting up an IoT hub in Azure
 

Technical requirement

In order to complete the lab in this chapter, you will need a subscription to Azure. If you do not have access to one, you can sign up for a free trial subscription at https://azure.microsoft.com/subscription/free. This free trial will give you $200 of Azure credit to spend over the next 30 days. Take some time to explore all the free services you get with your free subscription; they are quite extensive.

 

What is the IoT?

If you are reading this book, you are probably somewhat aware of what the IoT is and have been tasked with an IoT project. Nonetheless, it is a good idea to look at the common components of IoT systems. The IoT is a network of connected computing devices with embedded sensors that can transfer the sensor data to the cloud for centralized data processing. These devices run the gamut of wearable devices, such as Fitbit, that track your steps and vitals to smart cars and appliances.

Once you begin planning an IoT solution, you will find that it is a complex task. Both the device side and the cloud side involve complicated implementations that provide hundreds of required features, and the security of these devices is of the utmost importance. This is where Azure comes into play. It provides a set of Platform-as-a-Service (PaaS) offerings that make creating IoT systems easier, more reliable, and secure.

Now that we know what the IoT is, let’s look at some use cases before we dive into further details.

 

What are some common IoT use cases?

While there are some common IoT use cases to consider, this list is getting bigger all the time. People are constantly coming up with exciting new ways to use the IoT to solve problems, and I think we are just scratching the surface of its full potential. Nevertheless, it is helpful to consider the following common use cases to get a feel for the technology:

  • Agriculture: This domain is finding many ways to use the IoT. For example, smart irrigation is a popular IoT use case for farmers that provides real-time visibility; IoT sensors recognize when environmental factors, such as ground moisture, call for adjusted watering schedules and can pinpoint where water is needed.
  • Predictive maintenance: Predictive maintenance sensors and software help recognize when a piece of equipment is out of date, slowing down, or malfunctioning and needs to be replaced proactively instead of reactively.
  • Remote monitoring: This IoT use case allows companies to monitor sensors that are in dangerous and remote places. This is particularly helpful in industries such as mining and environmental agencies, where specialized equipment is widely distributed.

Now that we have discussed a few use cases, let’s review the common components of an IoT system.

 

What are the components of an IoT system?

At their core, all IoT systems are composed of things, insights, and actions. Things refers to small computing devices with embedded sensors that send data up to the cloud through a cloud gateway. The cloud gateway offers a central hub in the cloud that provides secure connectivity, telemetry, event ingestion, cloud-to-device communication, and device management functionalities. It routes the streaming data to storage for long-term analysis and to services that can analyze real-time streaming data. Once the data is processed, it is sent to reporting tools, dashboards, and automated workflows that can automatically respond to the conditions and insights garnered from the telemetry data of the devices. The following figure shows a generic IoT system:

Figure 1.1 – Basic structure of a generic IoT system

Figure 1.1 – Basic structure of a generic IoT system

In addition to the basic components of an IoT system, many IoT solutions include subsystems for provisioning management at scale, end-to-end security, and machine learning. The following figure shows an IoT system architecture with additional subsystems:

Figure 1.2 – Adding optional subsystems to the IoT solution

Figure 1.2 – Adding optional subsystems to the IoT solution

As shown in the figure, Bulk Device Provisioning allows the provisioning of a large number of devices. Edge devices play an active role in managing access and controlling the flow of information. They can assist in tasks such as filtering, batching, aggregating, and buffering data, as well as translating protocols. Data Transformation refers to the manipulation or aggregation of the raw streaming data. The User Management subsystem allows the capabilities of different users and groups to be specified in the context of the actions they can perform via the applications and on the systems. Machine Learning provides the systems with the ability to perform actions based on the data, such as predictive maintenance and security alerts. In addition to supporting these subsystems, IoT systems should provide the ability to set up system-wide security and end-to-end logging and monitoring, in addition to high availability and disaster recovery for the system.

Now that we have seen the pieces that make up an IoT system, let’s see what the corresponding resources are in Azure.

Understanding the Azure IoT system

The first thing we need for an IoT system is the devices that will collect the data. These devices can be very small, such as 8-bit microcontrollers, all the way up to server-grade devices depending on the implementation requirements. There are a tremendous number of devices on the market to choose from. The key differentiators are cost, power, network access, types of sensors, and the inputs and outputs accepted.

Although not necessary, when using an IoT device on Azure it is beneficial to ensure it is an Azure Certified Device. This guarantees the device supports telemetry that will be compatible with the IoT hub and the Device Provisioning Service (DPS). It will also facilitate cloud-to-device messaging, direct methods, and device-twin updating. Microsoft maintains a catalog of Azure Certified Devices at https://devicecatalog.azure.com.

Organizations that choose Azure Certified Devices for their IoT projects benefit from reduced development time, increased security, and a more streamlined integration process when building and scaling their IoT solutions on the Azure platform. These devices are typically used in a wide range of IoT applications, including industrial automation, smart cities, healthcare, agriculture, and more.

After selecting a device, the next step is to set up an IoT hub on Azure and connect the device to it. Within Azure IoT Hub, numerous features are available to simplify device management and control. These features comprise secure communication channels that enhance data transmission and reception, the automatic resending of device messages to accommodate intermittent connectivity, and selective revocation of access rights for specific devices as required.

In the following hands-on lab, you will learn how to set up a virtual device that will send simulated data to an IoT hub you will create in Azure. Make sure you have the technical requirements in place before you start!

 

Lab – setting up an IoT hub in Azure

By the end of this lab, you will be able to do the following:

  • Navigate the Azure portal
  • Set up a resource group
  • Create an IoT hub
  • Create a virtual device
  • Send data from the device to the IoT hub

To do this, you will need to perform the following steps:

  1. Before you start the lab, you will need to create a unique ID. We will add this to the ends of your resource names to make them unique. This ID can be whatever you want. I find using my initials and then attaching the month and day I was born works well. So I would use drc0830.
  2. Open a Microsoft Edge browser window, and then navigate to the Azure portal (https://portal.azure.com).
  3. Sign in with the credentials you used to create the account. You should land on the home page. You can customize the look and feel by selecting the settings icon in the top-right corner:
Figure 1.3 – Selecting the settings icon

Figure 1.3 – Selecting the settings icon

  1. On the settings page, select the Appearance + startup views tab. Make sure the Menu behavior option is set to Docked (see Figure 1.4). Also, verify that the startup page is set to Home.
Figure 1.4 – Setting up the look and feel of the portal

Figure 1.4 – Setting up the look and feel of the portal

  1. Via the left-side menu, go back to the Home page.
  2. At the top of the page, you should see a + icon that lets you create a resource. Click on it, and in the search bar that appears, enter Resource group, then select Resource group from the results dropdown:
Figure 1.5 – Creating a resource group

Figure 1.5 – Creating a resource group

  1. On the next page, click on the Create button to start the creation of the resource group.
  2. In the Basics tab, create a resource group named rg-iot-training-{your-id} (replacing {your-id} with the one you created earlier). Select a region close to your location and then select Review + create at the bottom:
Figure 1.6 – Creating a resource group

Figure 1.6 – Creating a resource group

  1. Once it passes validation, click on the Create button at the bottom of the page.
  2. After your new resource group has been created, select Resource groups in the menu on the left. You should see the resource group you just created in the list. Select your resource group from this list.
  3. At the top of the resource group page, select the + Create button. This brings you back to the Azure Marketplace. Search for and create an IoT hub. Name the hub iothub-{your-id}. Select the same region as that of the resource group you created.
  4. Select Review and create at the bottom of the page. Once it passes validation, select Create. Once it is created, click the Go to resource button.
  5. Investigate the features of the IoT hub using the left-side menu.
  6. From the menu on the left, select Devices. On the Devices page, select Add Device.
  7. Name the device device01, leave the rest of the settings as the defaults, and select Save:
Figure 1.7 – Creating an IoT device

Figure 1.7 – Creating an IoT device

  1. You may have to refresh the page to see the device just created in the device list. Once the device has been created, select it from the list. Copy and save the Primary connection string value for the device.
  2. In order to simulate a device, we are going to use the Raspberry Pi Azure IoT simulator. You can get access to it by going to https://azure-samples.github.io/raspberry-pi-web-simulator/.
  3. Go to line 15 in the code and paste the device connection string you copied earlier:
Figure 1.8 – Updating the connection string

Figure 1.8 – Updating the connection string

  1. Select Run and verify messages are being sent.
  2. Go back to the Azure portal and navigate to your IoT hub. On the Overview page, verify that you are getting signals from the simulated device. From the list labeled Show data for last, select 1 Hour:
Figure 1.9 – Verifying messages in the IoT hub

Figure 1.9 – Verifying messages in the IoT hub

  1. Once satisfied you are getting signals, stop the simulated device and close the web page.

Now that we are done with this chapter, let’s summarize what we have learned so far and where we are going next.

 

Summary

In this chapter, you learned the basics of an IoT system consisting of things, insights, and actions. You should now understand in a broad sense what kind of services are needed to create an IoT system. In particular, you set up an IoT hub in Azure and verified that it was receiving data from a virtual device. In this chapter, we did not go deep into all the features of an IoT hub. The goal was to get comfortable working in the Azure portal and gain a broad view of the services that make up an IoT system. In Chapter 2, Exploring the IoT Hub Service, we will take a deeper look at the capabilities of this service.

About the Author
  • Dan Clark

    Dan Clark is a senior developer and data engineer specializing in Microsoft technologies. He is focused on learning new AI and data technologies and training others on how to best implement those technologies. He has worked as an Azure Technical Trainer (ATT)for Microsoft and has over 25 years of experience as a Microsoft Certified Trainer. Dan has published several books and numerous articles on Microsoft technologies. He is a regular speaker at various developer and database conferences and user group meetings and enjoys interacting with the Microsoft communities.

    Browse publications by this author
The Azure IoT Handbook
Unlock this book and the full library FREE for 7 days
Start now