What is the timestamp of a Servicebus SAS token obtained via Azure Portal?

I'm trying to send a message to my Azure Servicebus queue using the REST Api in Python (can't use Azure package on Orange PI Zero system, not enough memory to install package...).

Now the example page shows a specifically formatted Authorization header:

Authorization: SharedAccessSignature sr=your-namespace&sig=Fg8yUyR4MOmXfHfj55f5hY4jGb8x2Yc%2b3%2fULKZYxKZk%3d&se=1404256819&skn=RootManageSharedAccessKey

How do I obtain the se ("Token expiry instant": reference) value for my SAS token from the Azure Portal? It only shows "Primary"/"Secondary" key...

enter image description here

1 answer

  • answered 2020-07-05 00:04 Gaurav Mantri-AIS

    How do I obtain the se ("Token expiry instant": reference) value for my SAS token from the Azure Portal? It only shows "Primary"/"Secondary" key

    This is something you will need to compute yourself as it dictates when your SAS token will expire. For example if you want to have your SAS token expire in 15 minutes from when it was created, you will get a date/time value 15 minutes from now, and calculate the number of seconds between that date/time and epoch (Jan 1st, 1970 00:00:00 UTC).

    Once you have that value, you will need to compute the signature using the logic described here: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas#generate-a-shared-access-signature-token.