How to correctly access blobs inside server-side encrypted scoped containers?

Deanna Delapasse 1 Reputation point
2024-09-24T23:38:21.6233333+00:00

I created 2 encryption scopes and applied each to a container. I uploaded a blob into each, but then I was able to connect via the account connection string and read the content without supplying anything. Is that expected and I'm just confused about how this should work? Any ideas what I might be doing wrong? The blobs clearly show ServerEncrypted=true.

using Azure.Storage.Blobs with Azure.Storage.Blobs (12.20.0)

var container = new BlobContainerClient(storageConn, containerName);
var blob = container.GetBlobClient(fileName);
if (blob.Exists())
{
    using var memoryStream = new MemoryStream();
    blob.DownloadTo(memoryStream);
    var text = System.Text.Encoding.UTF8.GetString(memoryStream.ToArray());
    List<string> result = text.Split('\n').ToList();
    Console.WriteLine("READ: " + result[0]);
    return true;
}
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,918 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,995 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,127 Reputation points Microsoft Employee
    2024-09-30T23:08:41.72+00:00

    @Deanna Delapasse Yes, a container with an encryption scope in an Azure storage account can be accessed using a connection string. The encryption scope does not change the way you access the container; it only affects how the data within the container is encrypted and decrypted.

    When you use a connection string to access the container, the encryption and decryption processes happen transparently. This means you can read and write data to the container as usual, and Azure handles the encryption and decryption behind the scenes.

    -https://learn.microsoft.com/en-us/azure/storage/blobs/encryption-scope-overview

    -https://learn.microsoft.com/en-us/azure/storage/blobs/encryption-scope-manage?tabs=portal

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.