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

bcb44 86 Reputation points

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?


Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
745 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
164 questions
No comments
1 vote

Accepted answer
  1. SatishBoddu-MSFT 14,436 Reputation points

    Hello @bcb44 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 additional answer

Sort by: Oldest
  1. António Sérgio Azevedo 7,646 Reputation points Microsoft Employee

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

    See here:


    "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:


    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!


    • 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.