question

VishrutiPawar-0541 avatar image
0 Votes"
VishrutiPawar-0541 asked ·

Create SAS Token using Python

I would like to know if it is possible to generate SAS Token for Azure IoT Hub using Python scirpt.
Also I would like to know what is the maximum expiry time for SAS Token if generated through the Azure Portal.
Please guide me through this, and let me know how can I create SAS Token using proramming.

azure-ad-domain-services
10 |1000 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.

1 Answer

SaurabhSharma-msft avatar image
1 Vote"
SaurabhSharma-msft answered ·

Please refer to the sample over here which you can use to generate a SAS token for IoT Hub using Python.


· 6 ·
10 |1000 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.

@SaurabhSharma-msft Thank you for the response. Can you please guide me on what all parameters do I need to change so that the script will generate SAS Token for my IoTHub.

0 Votes 0 ·

@VishrutiPawar-0541 As per the sample I believe you need to pass the URI of the resource to be accessed, shared Access Key Name and Shared Access Key to generate the token.

0 Votes 0 ·

@saurabhsh-msft Yes, I gave these parameters in the section from line 49 to 54.
I am not getting any error but there is no output as well. What do you think might be the issue here??

0 Votes 0 ·
Show more comments