0
votes

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?

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.Ivan Yang
Thank you for the heads up, I will switch over as soon as possible. Great help my friend.kdeez

1 Answers

1
votes

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.