Skip to content

Cannot generate SAS URI from BlobContainerClient created through BlobServiceClient.GetBlobContainerClient #17626

@mikamins

Description

@mikamins

Describe the bug
A SAS URI cannot be generated from a BlobContainerClient obtained through BlobServiceClient.GetBlobContainerClient.

Expected behavior
If a BlobServiceClient is created from an account key connection string, I expect a BlobContainerClient obtained through BlobServiceClient.GetBlobContainerClient to be able to generate a SAS URI.

That is, I expect the following test to pass:

    [TestMethod]
    public void ContainerClientCanGenerateSasUri()
    {
        var connectionString = "UseDevelopmentStorage=true;";
        var serviceClient = new BlobServiceClient(connectionString);
        var containerClient = serviceClient.GetBlobContainerClient("test");

         // passes as expected
        Assert.IsTrue(serviceClient.CanGenerateAccountSasUri);

         // fails unexpectedly
        Assert.IsTrue(containerClient.CanGenerateSasUri);
    }

Actual behavior (include Exception or Stack Trace)
In the above example, containerClient.CanGenerateSasUri returns false.

To Reproduce

  1. Create a BlobServiceClient from an account key connection string
  2. Call GetBlobContainerClient on the service client
  3. CanGenerateSasUri returns false since the StorageSharedKeyCredential isn't passed to the container

Environment:

  • Name and version of the Library package used: Azure.Storage.Blobs 12.7.0
  • Hosting platform or OS and .NET runtime version: Windows 10 .NET Framework 4.7.2
  • IDE and version : Visual Studio 16.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue is related to a non-management packageService AttentionWorkflow: This issue is responsible by Azure service team.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions