question

MichalZurek avatar image
1 Vote"
MichalZurek asked SumanthMarigowda-MSFT edited

IoTHubDeviceClient_LL_UploadToBlob not availaible on Azure Sphere

How to use IoTHubDeviceClient_LL_UploadToBlob on Azure Sphere? This function is not present in any header file in following folder and compilation crashes on implicit declaration of this function.

 C:\Program Files (x86)\Microsoft Azure Sphere SDK\Sysroots\8\usr\include\

It looks like Azure Sphere team bundles modified https://github.com/Azure/azure-iot-sdk-c/ library. There are some additional functions like

IoTHubDeviceClient_LL_CreateWithAzureSphereFromDeviceAuth but lot of functions including IoTHubDeviceClient_LL_UploadToBlob are missing.

Is there possibility to upload file to Azure from Azure Sphere without need to do it fully manually?

azure-sphere
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,
Our customer hope to use this API, too.
However, since the RAM size of the MT3620 is small, I would be happier if I could use IoTHubClient_LL_UploadMultipleBlocksToBlobEx().

0 Votes 0 ·

@MichalZurek Thanks for the query, we are looking into it.

0 Votes 0 ·

1 Answer

SatishBoddu-MSFT avatar image
0 Votes"
SatishBoddu-MSFT answered SatishBoddu-MSFT commented

Hello @MichalZurek Thanks for the query, I hope the below response from our product team may help with your initial query.

Upload file to Azure Blob using libcurl:

This sample demonstrates uploading a text file to Azure Blob service from Azure Sphere using libcurl to initiate Put Blob REST API with SAS authorization.

Please comment in the below section if you have any suggestions or comments.

If the response is helpful, please click "Accept Answer" and upvote it.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SatishBoddu-MSFT ,
Thanks for this information.

If we can use the IoT Hub mechanism, it is easy to use because you don't need to think how to pass the SAS token.

1 Vote 1 ·

Hello @matsujirushi Yes that is great feedback!, let me check on this.

0 Votes 0 ·

The main reason of use IoTHubDeviceClient_LL_UploadToBlob is that it generates short term SAS token using IoT Hub Service. Generated SAS is sent over encrypted trusted connection and we do not need to store any SAS anywhere in our app. We also do not need to rebuild app everytime buildin static SAS expire. Another advantage of using IoT Hub to generate SAS is that IoT Hub has configured connection to blob storage in cloud and we can change target storage without need to modify Azure Sphere app. From the security perspective IoTHubDeviceClient_LL_UploadToBlob is also more safe because integrated SAS in sources is vulnerable to leak of source or built firmware.

If we should implement it yourself using CURL, we need to get access to {iot hub}.azure-devices.net/devices/{deviceId}/files mentioned here https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload, but as I know we have no option to make requests agains this service using current library.

1 Vote 1 ·

Hello @MichalZurek thanks for the feedback, let me check on this.

0 Votes 0 ·