Real-Time Big Data Processing with Azure

Similar documents
User Manual for ICP DAS WISE Monitoring IoT Kit -Microsoft Azure IoT Starter Kit-

Raspberry Pi, SenseHat and Weather Service

administration access control A security feature that determines who can edit the configuration settings for a given Transmitter.

KEPServerEX IoTGateway to Azure IoT Hub. Initial Setup and Configuration

How to Build A Table of Authorities in Word * By: Morgan Otway

Positive Attendance. Overview What is Positive Attendance? Who may use Positive Attendance? How does the Positive Attendance option work?

IoT Software Platforms

Integrating Device Connectivity in IoT & Embedded devices

Checking Out ebooks From The Sunflower elibrary (Preparation)

5620 SERVICE AWARE MANAGER. NTP Driver Version Guide

***Please be aware that there are some issues of compatibility between all current versions of EndNote and macos Sierra (version 10.12).

How to use EndNote? Training. Faculty of Fisheries and Protection of Waters USB Academic Library of USB March 26, 2015

SecureFTP Procedure for Alma Implementing Customers

EEG A1452 SCTE-104 Inserter Frame Card

CA Outbound Dialer Module. Operation Manual v1.1

EndNote Essentials. EndNote Overview PC. KUMC Dykes Library

X-Sign 2.0 User Manual

GETTING STARTED WITH ENDNOTE

Global launch of "OpenBlocks IoT VX2" Plat'Home s Intelligent Edge IoT Gateway

Printing From Applications: Adobe InDesign CS3, CS4, and CS5

Class Notes for Cite While You Write Basics. EndNote Training

Mendeley. By: Mina Ebrahimi-Rad (Ph.D.) Biochemistry Department Head of Library & Information Center Pasteur Institute of Iran

DVB-T USB SET-TOP BOX

ITU-T Y.4552/Y.2078 (02/2016) Application support models of the Internet of things

1. Create an EndNote Library database. 2. Add references a. Direct export from a database b. From a PDF c. Manually d. Importing a text file

Kolding June 12, 2018

What s New in VISION Digital Vision Inc February 2017

To complete this document, you will need the following file:

Autotask Integration Guide

Getting started with EndNote X7

EndNote X8. Research Smarter. Online Guide. Don t forget to download the ipad App

Deltasoft Services M A N U A L LIBRARY MANAGEMENT. 1 P a g e SCHOOL MANAGEMENT SYSTEMS. Deltasoft. Services. User Manual. Aug 2013

2G Video Wall Guide Just Add Power HD over IP Page1 2G VIDEO WALL GUIDE. Revised

SAP Edge Services, cloud edition Edge Services Overview Guide Version 1802

Away from home and realized you forgot to record a program, or want to see what is on TV tonight? No worries, just access MyTVs App!

MyTVs Menu. Recordings. Search. What s Hot. Settings

Introduction to IBM SPSS Statistics (v24)

EndNote for Mac. EndNote for PC. User Guide. UTS Library University of Technology Sydney UTS CRICOS PROVIDER CODE 00099F

EndNote for Windows. Take a class. Background. Getting Started. 1 of 17

EndNote for Mac. User Guide. UTS Library University of Technology Sydney UTS CRICOS PROVIDER CODE 00099F

Netflix on the IMC IMC and up. User guide for viewing Netflix Content

Welcome to the U-verse App

GTIMS WAIVERS PART I SETUP

Mendeley Basics. Get Mendeley. Get Articles and Documents into Mendeley. Import Citations from a Website

Teacher s AIDE Training System. EZ Teach Silver Installation

CI-218 / CI-303 / CI430

RedRat Control User Guide

Using EndNote Web to Manage your References. Workbook

Using SuperTrafficBoard Client on another computer

Grande2Go FAQs. 1. What is Grande2Go?

ipass Open Mobile 2.0 for Android Quick Start Guide

SignalTap: An In-System Logic Analyzer

All about Mendeley. University of Southampton 18 May mendeley.com. Michaela Kurschildgen, Customer Consultant Elsevier

In this guide you will learn how to:

IPTV Middleware ipad ManageMyTVs Application User Guide

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at. Model Serial No.

Booya16 SDR Datasheet

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at. Model Serial No.

Network Camera Operating Manual

5620 SAM SERVICE AWARE MANAGER AAA GNE Driver Version Guide

DPS Telecom Your Partners in Network Alarm Management

Remote Application Update for the RCM33xx

The Administrator s Guide to using EndNote online

Harmony Smart Control. User Guide

InPlace User Guide for Faculty of Arts, Education and Social Sciences Staff

Lab experience 1: Introduction to LabView

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at

XJTAG DFT Assistant for

5620 SAM SERVICE AWARE MANAGER 14.0 R8. Integration Guide

Setup Guide. CalMAN Client for SCRATCH. Rev. 1.1

Software version TC7.1 APRIL Administrator guide. for Cisco TelePresence System Codec C90 and Profile 65 Dual using C90

5620 SAM SERVICE AWARE MANAGER 14.0 R9. Integration Guide

Cisco Spectrum Expert Software Overview

More Skills 14 Watch TV in Windows Media Center

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at. M o d e l S e r i a ln o.

Fibe TV Reference Guide

Teradici Naming and Branding Guide for Partners

Using SuperTrafficBoard on another computer

rekordbox TM LIGHTING mode Operation Guide

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at.

MyTVs App for Android TM

Remote Control/Cloud DVR Guide. Special Instructions INPUT:

Microsoft's IoT Vision and Roadmap. Tony Shakib General Manager, Azure IoT Microsoft

VideoMate U3 Digital Terrestrial USB 2.0 TV Box Start Up Guide

E-MANUAL. Thank you for purchasing this Samsung product. To receive more complete service, please register your product at.

WAVES Cobalt Saphira. User Guide

Managing a Time Clock Station

Any feature not specifically noted as supported is not supported.

USER GUIDE. Quickflix streaming on Samsung Android SmartPhones

Using EndNote Online: health

Getting Started EndNote X2

Printing From Applications: QuarkXPress 8

Netflix payment info Netflix Netflix

CHAPTER 3 EXPERIMENTAL SETUP

Swinburne University of Technology

2-/4-Channel Cam Viewer E- series for Automatic License Plate Recognition CV7-LP

48 TV Caller ID TV CALLER ID

The Basics of EndNote. Endnote Training (Desktop Client Version) Brian Erb

Wetek OpenELEC TVHeadend Freesat Bouquet and XMLTV data

5620 SAM SERVICE AWARE MANAGER. SMM GNE Driver Version Guide

Transcription:

Real-Time Big Data Processing with Azure Lab 2 - Getting Started with IoT Hubs Overview In this lab, you will create an Azure IoT Hub and use it to collect data from a client application. What You ll Need To complete the labs, you will need the following: A web browser A Microsoft account A Microsoft Azure subscription A Windows, Linux, or Mac OS X computer The lab files for this course Note: To set up the required environment for the lab, follow the instructions in the Setup document for this course. Specifically, you must have signed up for an Azure subscription and installed Node.JS on your computer. Exercise 1: Provision an IoT Hub In this exercise, you will create an IoT hub. Note: The Microsoft Azure portal is continually improved in response to customer feedback. The steps in this exercise reflect the user interface of the Microsoft Azure portal at the time of writing, but may not match the latest design of the portal exactly. Create an IoT Hub In this procedure, you will use the Azure portal to create an IoT hub. 1. In the Microsoft Azure portal, in the Hub Menu, click New. Then in the Internet of Things menu, click IoT Hub. 2. In the IoT Hub blade, enter the following settings, and then click Create: Name: Enter a unique name (and make a note of it!) Pricing and scale tier: Free IoT Hub Units: 1 Device-to-cloud partitions: 2 partitions Subscription: Select your Azure subscription Resource Group: Select the existing resource group you created previously

Location: Select any available region Pin to dashboard: Not selected 3. In the Azure portal, view Notifications to verify that deployment has started. Then wait for the service bus namespace to be deployed (this can take a few minutes.) Exercise 2: Register a Client Device Unlike event hubs, all devices that use an IoT hub must be individually registered, and use their own endpoint and shared access key to access the hub. In this exercise, you will register a client device. Create a Device Identity Each device that sends data to the IoT hub must be registered with a unique identity. 1. In the Azure portal, browse to the blade for the IoT Hub that you created in the previous exercise, and click the Device Explorer tab. 2. Click the + Add button and add a new device with the ID MyDevice that uses a Symmetric Key authentication type (auto-generate the keys). 3. After it has been added, click MyDevice and view the device-specific keys and connection strings that have been generated. Then copy the connection string-primary key for MyDevice to the clipboard. You will use this in the next exercise. Exercise 3: Submit Data from a Client Device Application Now that you have registered a client device, you can create an application that the device can use to submit data to the IoT Hub. Create a Client Device Application Now that you have registered a device, it can submit data to the IoT hub. Note: The code for MyDevice is similar to the code you used in the previous lab to submit events to an event hub it generates readings from ten random devices. In a real solution, each device would use its own device-specific ID and connection string to enable you to manage them individually. 1. In the Node.JS console, navigate to the iotdevice folder in the folder where you extracted the lab files. 2. Enter the following command, and press RETURN to accept all the default options. This creates a package.json file for your application: npm init 3. Enter the following command to install the Azure IoT device and AMQP protocol packages: npm install azure-iot-device azure-iot-device-amqp 4. Use a text editor to edit the iotdevice.js file in the iotdevice folder. 5. Modify the script to set the connstr variable to reflect the device connection string for the MyDevice device (which you copied to the clipboard in the previous exercise), as shown here: 'use strict'; var clientfromconnectionstring = require('azure-iot-deviceamqp').clientfromconnectionstring; var Message = require('azure-iot-device').message; var connstr = '<DEVICE_CONNECTION_STRING>';

var client = clientfromconnectionstring(connstr); function printresultfor(op) { return function printresult(err, res) { if (err) console.log(op + ' error: ' + err.tostring()); if (res) console.log(op + ' status: ' + res.constructor.name); } var connectcallback = function (err) { if (err) { console.log('could not connect: ' + err); } else { console.log('client connected'); } // Create a message and send it to the IoT Hub every second setinterval(function(){ var r = Math.random(); var data = JSON.stringify({ device: 'MyDevice', reading: r }); var message = new Message(data); console.log("sending message: " + message.getdata()); client.sendevent(message, printresultfor('send')); }, 1000); client.open(connectcallback); 6. Save the script and close the file. Submit data to the IoT Hub Now you can run your client application to submit data to the IoT hub. 1. In the Node.JS console window, enter the following command to run the script: node iotdevice.js 2. Observe the script running as it starts to submit device readings. Then leave the script running and start the next exercise. Exercise 4: Read Data from the IoT Hub When devices submit messages to your IoT hub, you can read the messages from its event hub endpoint. Create an Application to Read Messages from the IoT Hub In this procedure, you will create a client application that reads from the event hub endpoint of the IoT hub. 1. In the Azure portal, browse to the blade for the IoT Hub. 2. In the blade for your IoT Hub, click Shared access policies. 3. In the Shared access policies blade, click the service policy, and then copy the connection string-primary key for your IoT Hub to the clipboard you will need this later. 4. Open a new Node.JS console, and navigate to the iotreader folder in the folder where you extracted the lab files.

5. Enter the following command, and press RETURN to accept all the default options. This creates a package.json file for your application: npm init 6. Enter the following command to install the Azure Event Hub package: npm install azure-event-hubs 7. Use a text editor to edit the iotreader.js file in the iotreader folder. 8. Modify the script to set the connstr variable to reflect the service shared access policy connection string for your IoT Hub (not the device-specific connection string you used in the previous procedure), as shown here: 'use strict'; var EventHubClient = require('azure-event-hubs').client; var connstr = '<IOT-HUB-CONNECTION-STRING>'; var printerror = function (err) { console.log(err.message); var printmessage = function (message) { console.log('message received: '); console.log(json.stringify(message.body)); console.log(''); var client = EventHubClient.fromConnectionString(connStr); client.open().then(client.getpartitionids.bind(client)).then(function (partitionids) { return partitionids.map(function (partitionid) { return client.createreceiver('$default', partitionid, { 'startaftertime' : Date.now()}).then(function(receiver) { console.log('created partition receiver: ' + partitionid) receiver.on('errorreceived', printerror); receiver.on('message', printmessage); }); }); }).catch(printerror); 9. Save the script and close the file. Read Data from the IoT Hub Now you arew ready to run your application and read data from the IoT Hub. 1. Ensure that the iotdevice.js script is still running. 2. In the Node.JS console window for the iotreader.js application, enter the following command to run the script: node iotreader.js 3. Observe the script running as it reads the device readings that were submitted to the IoT hub by the iotdevice.js script.

4. After both scripts have been running for a while, stop them by pressing CTRL+C in each of the console windows. Then close the console windows. Note: You will use the resources you created in this lab when performing the next lab, so do not delete them. Ensure that all Node.js scripts are stopped to minimize ongoing resource usage costs.