In a previous article, we saw how to create an Azure IoT Hub.    

In this article, we will show how to add devices to the IoT Hub.

When I first began working with IoT hub devices, I was confused by language that suggested I was "Adding" or "Creating" a device. What we are really doing is registering a device with the hub, so that a physical device of the same name can communicate with this hub. When you see words like "Add" and "Create", think of the fact that it is adding and creating the registration entry.

To begin, log into the Azure Portal and navigate to your IoT Hub, as shown in Fig. 1.

id01-IotHubOverviewBlade
Fig. 1

Click "IoT devices" to open the "IoT devices" blade, as shown in Fig. 2.

id02-IotDevicesBlade
Fig. 2

If this hub has any devices, you will see them listed. You can use the fields at the top to filter the list to more quickly find one or more devices.

To add a new device, click the [Add] button (Fig. 2) to display the "Create a device" blade, as shown in Fig. 3.

id03-AddDeviceButton
Fig. 3

id04-CreateADevice
Fig. 4

At the "Device ID", enter a name for this device. The name must be unique among this hub's devices.

At the "Authentication type", select the type of authentication you wish this device to use. If you select "Symmetric key", you have the option to enter your keys or allow the system to generate keys for you.

Click the [Save] button to create this device.

After a few seconds, the device is created and displays in the device list of the "IoT devices" blade, as shown in Fig. 5.

id05-IotDevicesBlade
Fig. 5

If you click on the device, you can see the "Device details" for this device, as showin in Fig. 6.

id06-DeviceDetails
Fig. 6

The connection string is required to target this specific device.

Now that you have a device registered, a device of that name can communicate with this hub.