0
votes

I have a use case, where I need to download the file from Azure blob location to an IoT Device which is registered with IoT Hub.

In this case, I will be sending an instruction to IoT Device (through IoT Hub) to download the file from Azure blob location, to specific destination on the machine (where IoT Device app is running).

These instructions will be sent through IoT Hub using a backend (customised) application.

Just wanted to know whether Azure IoT Hub currently support this facility which I can use directly into the IoT Device app (by using Azure IoT API).

Any reference will be helpful.

Thanks,

Avinash Deshmukh

2

2 Answers

0
votes

Yes, sure. As I known, you can generate an url of an Azure Blob file with its SAS token to send it as a cloud-to-device message from IoTHub, then to receive it from IoT device and to download file via the file url with SAS token directly on the IoT device.

As references, you can refer to these offical documents to try to realize it.

  1. To generate a blob url with SAS token, please refer to Create an account SAS with .NET. If you are using Java, I think it's very simple for you to write the Java one with Azure Storage SDK for Java.
  2. To send a cloud-to-device message from IoTHub, please refer to Send cloud-to-device messages with IoT Hub (Java).
  3. To receive the c2d message on a device, the REST API for all languages is Device - Receive Device Bound Notification. Or you can refer to the part of sample code SendReceive.java by searching the key word D2C to know how to retrieve messages from IoT Hub.
  4. If you have to get the blob url with SAS token from IoT Hub on devices, I think it's not hard for you to download a file from a public link.

Hope it helps.

0
votes

Yes, you could do it by using azure cloud to device messaging.in Data parameter you can pass directly blob object url but ensure that it is belonging to the right security group . You can follow the article https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-c2d