IoT hub to Azure Edge - azure

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

Related

Azure Device Provisioning to Edge Device

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/

Azure IoT Edge Queue Depth

We are trying to debug an issue with Azure IoT edge modules deployed in a transient network environment. The problem is our edge module code sends messages using moduleclient and the call returns successfully. However some messages do not make it to the Azure Iot Hub in the cloud. The devices are often in a disconnected state and we are unsure if the messages are timing out on the upload queue or backing up on the edge hub queue because of lack of bandwidth. Is there anyway to check for edge hub queue depth and failed message count on the IoT edge runtime?
edgeHub exposes some metrics that you can collect and send to Log Analytics (or other tools), including messages received and sent. This might help you.
edgeHub metrics usage
List of edgeHub metrics
You may need to debug the communication between the IoT Edge Hub from the IoT Edge Runtime and the IoT Hub or between your module and the IoT Edge Hub. You can find more here:
https://learn.microsoft.com/en-us/azure/iot-edge/troubleshoot
From the cloud side (IoT Hub), you can try:
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-troubleshoot-connectivity

Can Azure IOT Edge device connect to the multiple Azure IOT Hubs?

Can we connect Azure IoT Edge Gateway part of multiple Azure IoT Hubs? or Any recommendations to achieve the following multiple hierarchical hubs in the Azure IoT solution?
For example device1, device2 connected to Edge Gateway.
Edge Gateway, device1, device2 -> Root Azure IoT Hub owner
Edge Gateway, Device 1 - IoT Hub 1
Edge Gateway, Device 2 - IoT Hub 2
so that relevant devices message can be forwarded to Hub1, Hub2.
No, as of today one Edge device can only connect to one IoT Hub. To achieve your use case, I would probably use routing in the IoT Hub to forward messages to subsequent Event Hubs, for example with routing based on the device id or some other property that you choose.
with ASA Azure Stream Analytics. in the input of the ASA configure the iothub that receives the data from the iotedge, in the outputs configure the iothubs that need to replicate the data, in the output use for iothub the "Event Hub" and put the "Event Hub compatible endpoint" of iothub.
iotedge -> iothub -> ASA -> multiples iothubs

Does Microsoft IoT Central send data through an Azure IoT Hub...?

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.

How does device anti-spoofing work in Azure IoT hub?

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.

Resources