0

I am generating shared access signatures for blobs inside an azure blob container like so:

        string sasToken = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy()
        {
            Permissions = SharedAccessBlobPermissions.Read,
            SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(30)
        });
        return new Uri(blob.Uri, sasToken).AbsoluteUri;

This returns a URI string that we can ping to download an individual blob. Great, it works.

However, I need to potentially generate hundreds of these shared access signatures, for many different blobs inside the container. It seems very inefficient to loop through each blob and make this call individually each time.

I know that I can call:

        container.GetSharedAccessSignature()

in a similar manner, but how would I use the container's SAS token to distribute SAS tokens for each individual blob inside the container?

2
  • 1
    By the way, it seems that you're using the old version: v11 version of azure storage sdk. Now we suggest you can use the latest version v12, and follow this doc. Commented Feb 23, 2021 at 1:30
  • Thank you for the heads up, I will switch over as soon as possible. Great help my friend. Commented Feb 23, 2021 at 1:42

1 Answer 1

1

Yes, you can.

After you generate the container sas token, then it can also work for each blob inside it. You just need to add the blob name in the url like below:

https://xxxxx/container/blob?container_sastoken.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.