question

bcb44-4548 avatar image
1 Vote"
bcb44-4548 asked bcb44-4548 commented

How to tell how many blob storage sas tokens have been requested for a device?

I'm using the File Upload operation in IoT Hub to send aggregated telemetry from our devices to blob storage. Our devices sometimes lose power and aren't able to invoke a cancelation token or send a 400 error code to IoT Hub before shutting down. Then they start back up and don't know how many of the 10 upload tokens are available.

Is there a property I can poll to see how many tokens are active at a certain time for a device?

Thanks

azure-iot-hubazure-iot-sdk
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.

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

Hello @bcb44-4548 Thanks for posting this great question which is very useful to other community members as well.

Question:There's not a IoT Hub property I can query to check the number of SAS URI's are in use by my device?
Response: Unfortunately, not available!

Below is the response from the Microsoft Product team addressing your initial query and along with a workaround.

There is a rate limit of 100/min/unit for file uploads as of now, Reference - IoT Hub quotas and throttling.

The alternative is to use a blob client on the device and connect directly to the Blob service bypassing the limit, it will also allow more flexibility. Associated key or token can be passed to the device via twin or direct method, so configurable.

Also, I hope you have already referred to : Azure Storage samples using v12 .NET client libraries

Your workaround is also more thoughtful > "I would write to a file to keep track... "

Please comment in the below section for further feedbacks or help in this matter.

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





· 1
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.

Ok thanks so much, I think that's definitely the way to go. Really appreciate the help here!!

2 Votes 2 ·
asergaz avatar image
0 Votes"
asergaz answered asergaz commented

Hi @bcb44-4548 ,
The SAS URIs returned to the device by IoT Hub contain the information you need.

See here: https://docs.microsoft.com/en-us/rest/api/storageservices/create-service-sas

89536-image.png

"The access policy portion of the URI indicates the period of time over which the shared access signature is valid and the permissions to be granted to the user."

Ones you are interested:

89537-image.png

See also how to Configure IoT Hub file uploads using Azure CLI .

  • "SAS TTL: This setting is the time-to-live of the SAS URIs returned to the device by IoT Hub. Set to one hour by default."

Hope I could help!

Remember:
- Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
- Want a reminder to come back and check responses? Here is how to subscribe to a notification.





image.png (27.5 KiB)
image.png (33.8 KiB)
· 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.

Hello @bcb44-4548 ,

Please share with us if you have any other questions related with your original post. Otherwise could you go ahead and mark the above as answer?

Thank you so much.

Remember:
- Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.

0 Votes 0 ·

Hm so the idea here is that when I request a SAS URI, I would write to a file to keep track of its SAS TTL and whether the SAS URI had been returned to IoT Hub?

There's not a IoT Hub property I can query to check the number of SAS URI's are in use by my device?

0 Votes 0 ·

@bcb44-4548 I am doing some research on this "There's not a IoT Hub property I can query to check the number of SAS URI's are in use by my device?"

Your workaround looks good to me:

when I request a SAS URI, I would write to a file to keep track of its SAS TTL and whether the SAS URI had been returned to IoT Hub

Thanks.

0 Votes 0 ·