แก้ไข

แชร์ผ่าน


Understand how apps interact with Blob Storage data resources

As you build applications to work with data resources in Azure Blob Storage, your code primarily interacts with three resource types: storage accounts, containers, and blobs. This article explains these resource types and shows how they relate to one another. It also shows how application code uses the Azure Blob Storage client libraries to interact with these various resources.

Blob Storage resource types

The Azure Blob Storage client libraries allow you to interact with three types of resources in the storage service:

The following diagram shows the relationship between these resources:

Diagram showing the relationship between a storage account, containers, and blobs

Storage accounts

A storage account provides a unique namespace in Azure for your data. Every object that you store in Azure Storage has an address that includes your unique account name. The combination of the account name and the Blob Storage endpoint forms the base address for the objects in your storage account.

For example, if your storage account is named sampleaccount, then the default endpoint for Blob Storage is:

https://sampleaccount.blob.core.windows.net

To learn more about types of storage accounts, see Azure storage account overview.

Containers

A container organizes a set of blobs, similar to a directory in a file system. A storage account can include an unlimited number of containers, and a container can store an unlimited number of blobs.

The URI for a container is similar to:

https://sampleaccount.blob.core.windows.net/sample-container

For more information about naming containers, see Naming and Referencing Containers, Blobs, and Metadata.

Blobs

Azure Storage supports three types of blobs:

  • Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually. Block blobs can store up to about 190.7 TiB.
  • Append blobs are made up of blocks like block blobs, but are optimized for append operations. Append blobs are ideal for scenarios such as logging data from virtual machines.
  • Page blobs store random access files up to 8 TiB in size. For more information about page blobs, see Overview of Azure page blobs

For more information about the different types of blobs, see Understanding Block Blobs, Append Blobs, and Page Blobs.

The URI for a blob is similar to:

https://sampleaccount.blob.core.windows.net/sample-container/sample-blob

For more information about naming blobs, see Naming and Referencing Containers, Blobs, and Metadata.

Work with data resources using the Azure SDK

The Azure SDKs contain libraries that build on top of the Azure REST API, allowing you to interact with REST API operations through familiar programming language paradigms. The SDKs are designed to simplify interactions between your application and Azure resources.

In the Azure Blob Storage client libraries, each resource type is represented by one or more associated classes. These classes provide operations to work with an Azure Storage resource.

The following table lists the basic classes, along with a brief description:

Class Description
BlobServiceClient Represents the storage account, and provides operations to retrieve and configure account properties, and to work with blob containers in the storage account.
BlobContainerClient Represents a specific blob container, and provides operations to work with the container and the blobs within.
BlobClient Represents a specific blob, and provides general operations to work with the blob, including operations to upload, download, delete, and create snapshots.
AppendBlobClient Represents an append blob, and provides operations specific to append blobs, such as appending log data.
BlockBlobClient Represents a block blob, and provides operations specific to block blobs, such as staging and then committing blocks of data.

The following packages contain the classes used to work with Blob Storage data resources:

Next steps

Working with Azure resources using the SDK begins with creating a client instance. To learn more about client object creation and management, see Create and manage client objects that interact with data resources.