Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Azure IoT Handbook

You're reading from   The Azure IoT Handbook Develop IoT solutions using the intelligent edge-to-cloud technologies

Arrow left icon
Product type Paperback
Published in Dec 2023
Publisher Packt
ISBN-13 9781837633616
Length 248 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Dan Clark Dan Clark
Author Profile Icon Dan Clark
Dan Clark
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Part 1: Capturing Data from Remote Devices
2. Chapter 1: An Introduction to the IoT FREE CHAPTER 3. Chapter 2: Exploring the IoT Hub Service 4. Chapter 3: Provisioning Devices with the Device Provisioning Service 5. Chapter 4: Exploring Device Management and Monitoring 6. Chapter 5: Securing IoT Systems 7. Part 2: Processing the Data
8. Chapter 6: Creating Message Routing 9. Chapter 7: Exploring Azure Stream Analytics 10. Chapter 8: Investigating IoT Data with Azure Data Explorer 11. Chapter 9: Exploring IoT Edge Computing 12. Part 3: Processing the Data
13. Chapter 10: Visualizing Streaming Data in Power BI 14. Chapter 11: Integrating Machine Learning 15. Chapter 12: Responding to Device Events 16. Index 17. Other Books You May Enjoy

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.

You have been reading a chapter from
The Azure IoT Handbook
Published in: Dec 2023
Publisher: Packt
ISBN-13: 9781837633616
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image