Introduction
The aim of this tutorial is to connect numerous virtual remote cameras, placed at different locations, to a single IoT hub.

Prerequisites
You require an Azure subscription to perform these steps. If you don't have one, you can create one by following the steps outlined on the Create your Azure free account today webpage.
Road Map
- Create an Azure IoT Hub
- Register sample devices with the IoT hub
- Define the data for the simulated cameras
- Create a set of simulated camera devices
- Verify the registered devices
Create an Azure IoT Hub
- Open your browser and log into portal.azure.com.
- Click on "create a resource".

- Click on the "Internet of Things" and select "IoT Hub".

Subscription: < select your own subscription >
Resource group: Test-IOT-RG
Region: < select a Datacenter location nearest to you. Note: All subsequent resources that you create must be in the same location.>
IoT hub name: 0<Select a name for your Hub>

- Select the free tier to save useful resources.

- Wait for the validation and click on "Create" on the same window after the validation. This will start the deployment process.

Register sample devices with the IoT hub
Note
- Click to open the scripting panel.
- You will not see the 2nd button, i.e., "Create storage" if you already have a storage created.

- Select "Bash" as displayed below.

Now, you have entered the Bash Shell.
- Create a new directory and access it through the following commands.
mkdir photoproc //creates a directory
cd photoproc //enters the directory
- Execute the following commands in sequence to initialize the project directory to host a Node project and install the required packages.
- Npm is a software package manager and installer.
npm init -y //initialize the project directory
npm install azure-iothub –save // install packages that Node can use to communicate with Azure IoT hubs
npm install azure-iot-device azure-iot-device-mqtt –save //install a trio of packages that Node can use to communicate with Azure IoT hubs
Note
Try downloading and installing Node.js from https://nodejs.org/ if the above lines don’t execute.

Define the data for the simulated cameras
- After successful execution, the following screen should appear.
- Using the Cloud Shell, create a new file in the project directory you created earlier and name it as "devices".
code devices.json //create a file


Bidyasagar MishraPosted Jul 28, 2019, 9:29 PM
Nice article
Rajanikant HawaldarPosted Jul 28, 2019, 11:54 AM
super thanks for sharing