Hi @Jerry Naidoo I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer .
Error Message:
Failed to get the file upload SAS URI" , cause "TooManyDevicesException"
Issue:
Trying to upload 400+ plus files using the file upload sample results in TooManyDevicesException
and fails to upload files.
Solution:
Changing the structure of the file upload code helped resolve the issue.
Here is the initial code structure.
//pseudo code
Start upload loop
new client
open client
uploadfile
close client
loop end
Here is what worked to address the issue
//pseudo code
new client
open client
Start upload loop
uploadfiles
loop end
close client
If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.
I hope this helps!
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.
Kindly note that, even though the issue is resolved with the changed code structure, the limitations mentioned by Sander above are still valid. If you try to use the same code concurrently and upload files onto a different device in your IoT Hub, you will still get throttled with respect to the limitations.