Blob Reference
This document provides a comprehensive reference for Azure Storage Blobs, covering their types, operations, properties, and access tiers. Understanding these concepts is crucial for effectively managing and utilizing blob storage.
Blob Types
Azure Blob Storage offers three distinct types of blobs, each optimized for different use cases:
Block Blobs
Block blobs are optimized for storing large amounts of unstructured data such as text or binary data. They are composed of blocks, and each block can be a different size. Block blobs are ideal for:
- Serving images or documents directly to a browser.
- Storing files for distributed access.
- Writing log data.
- Storing data for backup and restore, disaster recovery, and archiving.
A single block blob can be up to 190 TiB in size, with a maximum of 50,000,000 blocks. Individual blocks can range from 4 MiB to 100 MiB.
Append Blobs
Append blobs are optimized for append operations, such as writing to a log file. Like block blobs, they are made up of blocks, but blocks can only be appended to the end of the blob. This makes them suitable for scenarios where data is continuously added without needing to modify existing data.
- Logging data.
- Enabling scenarios like appending logs from a virtual machine.
An append blob can be up to 190 TiB in size, with a maximum of 50,000,000 blocks. Individual blocks can range from 4 MiB to 100 MiB.
Page Blobs
Page blobs are optimized for random read and write operations. They store unstructured data as a collection of pages. Page blobs are ideal for:
- Storing virtual hard disk (VHD) files for Azure virtual machines.
- Storing data that requires frequent random read/write access.
Page blobs are mutable and can be up to 8 TiB in size. Pages are fixed at 512 bytes in size.
Blob Operations
The following are common operations you can perform on blobs using the Azure Storage REST API, SDKs, or Azure CLI:
Create Blob
This operation creates a new blob. The method and parameters depend on the blob type. For block blobs, you can use Put Blob or Put Block List. For append blobs, Append Block is used. Page blobs use Put Page.
// Example: Creating a block blob using Azure SDK (conceptual)
// const blobClient = containerClient.getBlockBlobClient("my-new-blob.txt");
// await blobClient.upload("Hello, Azure Blob Storage!", "text/plain");
Read Blob
Retrieves the content of a blob. The Get Blob operation is used for this purpose.
// Example: Reading a block blob using Azure SDK (conceptual)
// const blobClient = containerClient.getBlockBlobClient("my-file.txt");
// const downloadResponse = await blobClient.download();
// const blobContent = await downloadResponse.text();
// console.log(blobContent);
Update Blob
For block blobs, updates are typically achieved by uploading new blocks or replacing the entire blob. Append blobs only support adding blocks. Page blobs support updating individual pages using the Put Page operation.
Delete Blob
Removes a blob from storage. The Delete Blob operation is used.
// Example: Deleting a blob using Azure SDK (conceptual)
// const blobClient = containerClient.getBlobClient("blob-to-delete.txt");
// await blobClient.delete();
List Blobs
Retrieves a list of blobs within a container. The List Blobs operation is used, which can be filtered by prefix and other parameters.
Blob Properties
Each blob has several associated properties, including:
- Name: The unique identifier of the blob within its container.
- ETag: An entity tag which is used for optimistic concurrency.
- Last Modified: The date and time the blob was last modified.
- Content-Length: The size of the blob in bytes.
- Content-Type: The MIME type of the blob.
- Access Tier: The access tier of the blob (Hot, Cool, Archive).
- Lease Status/State: Indicates if a lease is active on the blob.
Access Tiers
Azure Blob Storage offers different access tiers to help manage costs and access frequency:
- Hot: Optimized for frequently accessed data. Lowest access latency, highest storage costs.
- Cool: Optimized for infrequently accessed data. Higher access latency and storage costs compared to Hot, but lower than Archive. Ideal for data accessed at least once every 30 days.
- Archive: Optimized for rarely accessed data. Highest access latency (hours), lowest storage costs. Suitable for data that can tolerate hours of retrieval time.
You can configure the default access tier for a storage account and change the access tier of individual blobs.
Examples
For detailed code examples demonstrating these operations across various languages and platforms, please refer to the official Azure Blob Storage documentation and SDKs.
You can find further information and quickstarts on the Azure Blob Storage Introduction page.