From the course: Azure Serverless Computing

What is IoT Hub? - Azure Tutorial

From the course: Azure Serverless Computing

Start my 1-month free trial

What is IoT Hub?

- [Instructor] The scenario that we wanna go out and build is gonna be something that's going to model a way of connecting together the different services we're talking about in this course. And so I picked the weather scenario, kinda the weather alert where we have a bunch of devices that have sensors like temperature, humidity, and they will capture data and we wanna be able to persist it for long term storage. And we're gonna use table storage for that. And we also wanna be able to generate alerts. And we would identify anomalies that would be like weather alerts that could be sent out through something like email. But there's some infrastructure and the pieces that we're going to create are gonna be kinda the demo of what we're doing today. So the first piece is we're going to take the information coming in from the device and we're gonna capture it somehow. We're gonna use an IoT hub which is one of Azure's services that we can use to keep track of information about the devices and then also be able to connect it into other pieces of our ingestion pipeline. The ingestion pipeline is the collection of services that we configure and set up and include in our deployment. In this case I'm using a stream analytic job, an Azure stream analytic job or ASA, is a way of doing analysis on data in motion. And I can use that to stream data into the table storage. Everything that comes in can go right into table storage, and I can also have it identify anomalies, look for things that aren't quite right that are outside the limits of what I would consider to be a alert situation. And I can send that off to a separate place like an event hub. An event hub is a transient storage in Azure that lets me capture data for a little bit of time and then have readers process off of it. Will read from that with an Azure function that then will write out to a queue so that we have our alerts, now we know what to do with 'em, we can create a queue to say okay, here's the alerts we need to send. And then we can have another job, a logic app, read from the queue and actually send those alerts out. The first thing we're gonna do is actually talk about the IoT hub though. What is an IoT hub? In Azure an IoT hub is a service that's available that allows us to communicate and move information back and forth between the devices and the Cloud. It does two way communication so not only does it receive information, but it can also send information back. There's shared access policies which allow us to lock down access to this, so the device will have a key and a connection string to be able to talk back to our service. It also has custom end points and consumer groups, which allow us to define who the readers are. And we can route from the devices into other services. The basic flow of it is that an IoT hub has a bunch of ways that it can receive information from the device. Things like telemetry, that would be our sensor readings, the actual data, the individual pings that come out of the device. There's also commands that we can send to the device. So from the Cloud we can communicate and tell the device to turn on a switch, or turn off a light. There's also a collection of information that kinda describes what that device looks like. We call it the device twin because it is a dictionary of properties that are kept on the device that is then mirrored into the Cloud. Some of those properties are things that we would wanna be able to set the device to have, like maybe the current time. Other things are gonna come from the device where it's going to send us a setting. The device itself might have some properties like when it was installed and other metadata as well, and we can keep that in tags inside of the Cloud devices. And then we have operations. So we can go out and actually run operations inside the device and get data coming back. So let's go out and create an IoT hub.

Contents