Skip to Content
Azure IoT Development Cookbook
book

Azure IoT Development Cookbook

by Yatish Patil
August 2017
Intermediate to advanced
254 pages
6h 10m
English
Packt Publishing
Content preview from Azure IoT Development Cookbook

How to do it...

In this section, we will start with registering the new device, followed by some more device management operations such as: retrieve, delete, list, export, and import.

  1. Create a device identity by initializing the Azure IoT Hub registry connection:
string deviceId = "myFirstDevice";registryManager = RegistryManager.CreateFromConnectionString(connectionString);   Device device = new Device();            try            {                device = await registryManager.AddDeviceAsync(new Device(deviceId));                success = true;            }            catch (DeviceAlreadyExistsException)            {                success = false;}
  1. Retrieve the device identity by deviceId:
string deviceId = "myFirstDevice";Device device = new Device(); try { device = await registryManager.GetDeviceAsync(deviceId); } catch (DeviceAlreadyExistsException) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Azure Serverless Computing Cookbook - Third Edition

Azure Serverless Computing Cookbook - Third Edition

Praveen Kumar Sreeram, Kasam Shaikh, Greg Leonardo

Publisher Resources

ISBN: 9781787283008Supplemental Content