[BUG] BlobSasBuilder does not accept "d" as value for "Resource"
See original GitHub issueLibrary 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:
- Created 5 months ago
- Reactions:2
- Comments:19 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok. I also noticed that signedDirectoryDepth, which is required if signedResource=“d”, is not included when constructing the signature string.
@davyvanlaere We are looking into it and get back to you for any additional information.