Creating an IOT Hub on Azure Portal and Authenticate using Raspberry Pi
Published: 2023-12-16 04:34:10

**Introduction**

The Azure Internet of Things (IoT) is a collection of Microsoft-managed cloud services, edge components, and SDKs that allow connection, monitoring, and controlling IoT assets at scale. Simply put, an IoT solution is made up of IoT devices that communicate with cloud services.
Azure IoT has a wide range of practical applications and use cases across various industries due to its ability to connect, manage, and analyze data from diverse IoT devices. 
These practical applications demonstrate how Azure IoT can be employed across diverse industries to gather, manage, and derive insights from IoT data, leading to improved operational efficiency, cost savings, better decision-making, and enhanced customer experiences.

How can one create IoT Hub through Azure portal? This write up shows how this can be done in a step-by-step format.

**Step 1**
Log into you azure portal account https://portal.azure.com/#home  and if you have none, create one for purpose of learning

**Step 2**
Search the web browser for IoT

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oeizvgpz1j2nxtwch6z8.png)
Click on create:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83kq40dzu78kv51mkom3.png)

**Step 3**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/59ey69sbvn03iajnb7t3.png)

As can be seen, the IoT hub consists of tabs ranging from Basics to Review + Create.
On the Basics, we have project details and instance details.
The project details is made up of Subscription and resource group. 
On the Basics Tab, the first item is the Project Details and Instance details. The project details contains the Subscriptions and the Resource group.
The Subscription allows you to determine which subscription will be billed for the resources consumed by the IoT device.
While Resource Group allows you to organize and manage the IoT device along with other related resources under a common grouping for administrative, billing, and lifecycle management purposes.

Below is the selection based on the preferred requirements for the device:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5tohvbc6utqi5uthbek.png)

Then click on review + create

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0nn5bxspy1rrwy0g8wsx.png)

Wait for the deployment to be completed:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jalh42dvuyazr59gwmy.png)

**Step 4**
The deployment is completed now, click on go to resource

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfwcr4hj7s5f6tfvgg28.png)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b92cgos26lowqxkc8sq6.png)

The IoT Hub Usage should be noted at this stage so as to compare later.
Messages used today **0**
Daily messages quota **400000**
IoT Devices **0**

**Step 5**
We want to deploy a new device in the Azure IoT Hub. To achieve this, we need to go back to the Microsoft Azure portal and search for the IoT we just created, click on it:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/reenekt73kt97gcjhdc0.png)

When you are on IoT pane, look for device management, click on device, and next click on **+ Add Devic**e:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x3vhs5shcpjgvveu66h1.png)

Step 6
On the Create device tab, create the ID for the device to be added and Save:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3x1b4r2mh2vujmc7499q.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/po2i7n9b0fw7ribwzr2y.png)

Step 7
Click on the created device,

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8n91gln0hpndtpss4oqm.png)

**Step 8**
Go to the https://azure-samples.github.io/raspberry-pi-web-simulator/ web page, replace the string on line 15 with the one we copied in step 7.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9as8s2jsji0wau62yjmr.png)

**Step 9**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0xamby03pi2q3m3qhzr.png)


This is the end. The fact that it detects a device shows our deployment works.
Please read and comment.