Book Image

Azure IoT Development Cookbook

By : Yatish Patil
Book Image

Azure IoT Development Cookbook

By: Yatish Patil

Overview of this book

Microsoft’s end-to-end IoT platform is the most complete IoT offering, empowering enterprises to build and realize value from IoT solutions efficiently. It is important to develop robust and reliable solutions for your organization to leverage IoT services. This book focuses on how to start building custom solutions using the IoT hub or the preconfigured solution of Azure IoT suite. As a developer, you will be taught how to connect multiple devices to the Azure IoT hub, develop, manage the IoT hub service and integrate the hub with cloud. We will be covering REST APIs along with HTTP, MQTT and AMQP protocols. It also helps you learn Pre-Configured IoT Suite solution. Moving ahead we will be covering topics like:-Process device-to-cloud messages and cloud-to-device messages using .Net-Direct methods and device management-Query Language, Azure IoT SDK for .Net-Creating and managing, Securing IoT hub, IoT Suite and many more. We will be using windows 10 IoT core, Visual Studio, universal Windows platform. At the end, we will take you through IoT analytics and provide a demo of connecting real device with Azure IoT.
Table of Contents (10 chapters)

Creating Azure IoT Hub from the Command Prompt

How to do it...

In this section, let's look at creating an IoT Hub using CLI:

  1. Open the Command Prompt within administrator mode.
  2. Use the login command in Command Prompt:
azure login
  1. It will ask you to login using a web browser with the link displayed in the Command Prompt:
Login command
  1. The web link will validate the code generated in Command Prompt:
Login authenticate through web
  1. Once you successfully log in, it will show a message on the browser and you can go back to the Command Prompt for your work:
Login validated successfully
  1. Now, select the account with which you want to work and create the IoT Hub:
azure account set “Visual Studio Enterprise”
Select Azure account
  1. Now, we need to create a resource group, which this IoT Hub will be a part of:
azure group create -n MyBookIoTHub -l westus
  1. We use the following command to create a new IoT Hub using the Command Prompt:
azure iothub create -g MyBookIoTHub -n MyBookIoTHub -l westus -k s1 -u 1

In the preceding create IoT Hub command, the parameters are resource group, IoT Hub name, location, instance size, and unit.