azure-sdk-for-net: [BUG] BlobSasBuilder does not accept "d" as value for "Resource"
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
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 19 (6 by maintainers)
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.