question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] BlobSasBuilder does not accept "d" as value for "Resource"

See original GitHub issue

Library name and version

Azure.Storage.Blobs

Describe the bug

The BlobSasBuilder ignores Resource set to “d”

Expected behavior

I want to create a sas token for a directory in a blob container using the BlobSasBuilder.

Actual behavior

Currently, when setting Resource to “d”, the resulting sr querystring parameters is still “c”. If i look at the github code of BlobSasBuilder, i see that i will never set the value to “d”.

The documentation does list “d” as a valid value: https://learn.microsoft.com/en-us/rest/api/storageservices/create-service-sas#specify-the-signed-resource-blob-storage-only

Reproduction Steps

Shortened code: ` BlobServiceClient client = new BlobServiceClient(“connection string”); var result = await client.CreateBlobContainerAsync(containername);

        BlobSasBuilder blobSasBuilder = new BlobSasBuilder(
            BlobContainerSasPermissions.Create,
            DateTimeOffset.UtcNow.AddHours(1))
        {
            BlobContainerName = containername,
            Resource = "d"
        };

        var storageSharedKeyCredential = new StorageSharedKeyCredential(
               "storageaccountname",
               "storageaccountkey"
           );

        var sasQueryParameters = blobSasBuilder.ToSasQueryParameters(storageSharedKeyCredential);

`

Environment

No response

Issue Analytics

  • State:closed
  • Created 5 months ago
  • Reactions:2
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davyvanlaerecommented, Apr 26, 2023

Ok. I also noticed that signedDirectoryDepth, which is required if signedResource=“d”, is not included when constructing the signature string.

1reaction
SaurabhSharma-MSFTcommented, Apr 20, 2023

@davyvanlaere We are looking into it and get back to you for any additional information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Azure Stored access policy, Signature did not match
1 Answer. I believe you are getting this error is because you have not specified the blob container name in your GetBlobSas() method....
Read more >
BlobSasBuilder Class (Azure.Storage.Sas)
Possible values are HttpsAndHttp, Https, and None. Resource. Specifies which resources are accessible via the shared access signature. Specify "b" if the shared ......
Read more >
BlobSasBuilder.Resource Property (Azure.Storage.Sas)
Specifies which resources are accessible via the shared access signature. Specify "b" if the shared resource is a blob. This grants access to...
Read more >
Solved: 404 "The specified container does not exist" When
I use PowerBI Desktop > Get Data > Select Azure Data Lake Gen2 > Enter the URL I find under properties of my...
Read more >
(404) Not Found. while using sas token from blob storage
Coding example for the question The remote server returned an error: (404) Not Found. while using sas token from blob storage.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found