I am trying to figure out how to use DPS to pass down to a device which edge device to connect to. Is this an option to do with DPS or do we have do to this manually?
The DPS is a helper service for IoT hub that will provide the right IoT hub without requiring human intervention
The IoT Hub Device Provisioning Service (DPS) is a helper service for IoT Hub that enables zero-touch, just-in-time provisioning to the right IoT hub without requiring human intervention.
Below are the scenarios in which DPS is an excellent choice for getting devices connected and configured to IoT Hub.
Zero-touch provisioning to a single IoT solution without hardcoding IoT Hub connection information at the factory (initial setup)
Load-balancing devices across multiple hubs
Connecting devices to their owner's IoT solution based on sales transaction data (multitenancy)
Connecting devices to a particular IoT solution depending on use-case (solution isolation)
Connecting a device to the IoT hub with the lowest latency (geo-sharding)
Reprovisioning based on a change in the device
Rolling the keys used by the device to connect to IoT Hub (when not using X.509 certificates to connect)
Here are a few references which have the complete information on DPS.
https://learn.microsoft.com/en-us/azure/iot-dps/about-iot-dps
https://learn.microsoft.com/en-us/azure/iot-dps/
Related
How can I connect devices connected to loriot to Azure IoT Central?
I've got the documentation of connecting it to an Azure IoT Hub, but I'm actually using IoT central, so this seems to work differently.
Log in to the Azure portal (Microsoft Azure account required).
Create a IoT Hub
Copy Shared access primary key from IoT Hub > Settings > Shared
access policies > device
Use this primary key and the IoT Hub Name to configure your LORIOT
application output
From IoT Hub > Explorers > IoT devices: create a device using the
Device EUI as Device ID
Messages will have the following format:
https://docs.loriot.io/display/LNS5/Uplink+Data+Message
Loroiot setup only allows "IoT Hub Name" & "Primary Key" which IoT Central application does not expose unless a Device Provisioning Call is made to it from device or API. It is possible to get the device key from Azure CLI or IoT Central portal, but IoTHub name is only via the DPS call.
One option is to get this IoTHub name seperately and then configure Loroiot, but in case of HA/DR the IoTHub name could change (IoT Central manages multiple IoTHubs for HA/DR and scale).
In absence of Loroiot having this functionality, check if its API allows configuration then orchestrate provisioning via script, function, etc.
https://learn.microsoft.com/en-us/rest/api/iot-dps/device/runtime-registration
Is it possible to control a Azure Edge device through IoT hub, eg. I would like to request "an image data/ control a led connected to as IoT device to the Azure Edge runtime through IoT hub.
The Flow would be, IoT hub -- Azure Edge -- IoT device (Led sensor)..
I want to control LeD through Edge from IoT hub or by any means.
All the Cloud-2-Device messaging features to leaf devices also work when you connect the device through an IoT Edge device as a transparent gateway.
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-c2d
https://learn.microsoft.com/en-us/azure/iot-edge/iot-edge-as-gateway
In my case I have 1000+ of devices that stores activity inside. I need to send a http get request to this device to get those data in csv or json format and save it in a storage hosted on azure.
Cab IOT hub require data using get request and can it be scheduled to read daily/weekly?
What other azure services would you suggest to facilitated this scheduled reads?
You have not mentioned which the Azure IoT Hub scale tier is used. Basically there are two price groups such as Basic and Standard with a significant different cost and capabilities. The Basic tier offers only services for one-way communications between the devices and Azure IoT Hub.
Based on that, the following scenarios can be used for your business case:
1. Basic Tier (non event-driven solution)
The device pushs periodicaly a telementry and non-telemetry messages based on the needs to the Azure IoT Hub, where the non-telemetry messages are routed to the Azure Function via the Service Bus Queue/Topic. Responsibility for this non-telemetry pipe is to persist a real device state in the database. Note, that the 6M messages will cost only $50/month. The back-end application can any time to query this database for devices state.
2. Standard Tier (event-driven solution) In this scenario you can use a Device Twin of the Azure IoT Hub to enable storing a real-device state in the cloud-backend (described by #HelenLo). The device can be triggered by C2D message, changing a desired property, invoking a method or based on the device edge trigger to the action for updating a state (reported properties).
The Azure IoT Hub has a capabilities to run your scheduled jobs for multiple devices.
In this solution, the back-end application can call any time a job for ExportDevicesAsync to the blob storage, see more details here. Note, that the 6M messages will cost $250/month.
As you can see the above each scenario needs to build a different device logic model based on the communications capabilities between the devices and Azure IoT Hub and back. Note, there are some limitations for these communications, see more details here.
You can consider using Device Twin of IoT Hub
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins
Use device twins to:
Store device-specific metadata in the cloud. For example, the deployment location of a vending machine.
Report current state information such as available capabilities and conditions from your device app. For example, a device is connected to your IoT hub over cellular or WiFi.
Synchronize the state of long-running workflows between device app and back-end app. For example, when the solution back end specifies the new firmware version to install, and the device app reports the various stages of the update process.
Query your device metadata, configuration, or state.
IoT Hub provides you with the ability to connect your devices over various protocols. Preferred protocols are messaging protocols, such as MQTT or AMQP, but HTTPS is also supported. Using IoT hub, you do not request data from the device, though. The device will send the data to the IoT Hub. You have to options to implement that with IoT Hub:
The device connects to the IoT Hub whenever it has some data to be sent, and pushes the data up to IoT Hub
The device does not send any data on its own, but stays always or at least regularly connected to IoT Hub. You then can send a cloud to device message over IoT Hub to the device, requesting the data to be sent. The device then sends the data the same way it would in the first option.
When the data then has been sent to IoT Hub, you need to push it somewhere where it is persistently stored - IoT Hub only keeps messages for 1 day by default. Options for this are:
Create a blob storage account and push to that directly from IoT Hub using a custom endpoint This would probably be the easiest and cheapest. Dependening on how you need to access your data, a blob might not be the best option, though
Create a function app, create a function with an EventHubTrigger, connect it to IoT Hub and let the function process incoming data by outputting it into any kind of data sink, such as SQL, CosmosDB, Table Storage...
I am just reading up on the new IoT Central, currently in preview.
Our customers seldom let their devices connect to cloud by themselves,
but are rather connected to some kind of management system that in turn connects to Azure.
We however consider using IoT Central for demo purposes and would like to know if devices defined in IoT Central sends their data to an IoT Hub of choice or if is handled in any other way behind the scenes?
Microsoft IoT Central does use an IoT Hub internally. If you look here you can see that when you add a physical device to an IoT Central application it generates an IoT Hub device connection string: https://learn.microsoft.com/microsoft-iot-central/tutorial-add-device#get-connection-string-for-real-device-from-application.
However, you cannot get admin access to the IoT Hub or use an IoT Hub of your own choosing - all you have is the device connection string.
From Azure development guide https://azure.microsoft.com/en-us/documentation/articles/iot-hub-devguide, there is a small section (shown as below) talking about device anti-spoofing. It is not clear for me, it says IoT hub stamps every message with properties, but for me device anti-spoofing is that IoT hub to stop receiving messages sent from any spoofed device. Please help to explain how does this work?
Anti-spoofing properties
To avoid device spoofing in device-to-cloud messages, IoT Hub stamps
all messages with the following properties:
ConnectionDeviceId
ConnectionDeviceGenerationId
ConnectionAuthMethod
In IoT Hub there is a device registry that is used to authorize devices to the gateway. After authentication the device is checked against the registry.
When a device is registered with IoT Hub, the device's identity and key are saved in the device registry. This device and key is what the device uses to authenticate to the service.
The generation ID is a key part of this too. When the device is first registered with IoT Hub, a generation ID is assigned to the device. The purpose of this is to distinguish between identity registrations of the same device ID (added, removed, and then later added).
If you're interested in a deeper dive into the IoT Hub architecture see Clemen's 2015 Build talk here.