Microsoft Azure Documentation

Azure Blob Storage

Azure Blob Storage is Microsoft's object storage solution for the cloud. It's optimized for storing massive amounts of unstructured data, such as text or binary data.

Blob storage is designed to store:

  • Images or documents for direct serving to a browser.
  • Files for distributed access.
  • Data for backup, restore, disaster recovery, and data warehousing.
  • Data for logging, auditing, and archiving.
  • Data for machine learning and high-performance computing.

Key Concepts

Blobs

A blob is any collection of binary data. Blob storage is used to store blobs of data. A blob is a single file or a collection of files.

Storage Accounts

A storage account provides a unique namespace in Azure for your data. Every object that you store in Azure Storage is referenced by a URL that is part of that account's unique namespace. For example, if your account name is mystorageaccount, then your data is accessible at a URL like mystorageaccount.blob.core.windows.net.

Containers

A container is a logical grouping of blobs. You must create a container before you can upload any data to Blob storage. Each container must have a unique name within the storage account.

Tip: Container names must follow DNS naming conventions. They must start with a letter or number, can contain only letters, numbers, and hyphens, and must be between 3 and 63 characters long.

Blob Types

Azure Blob Storage supports three types of blobs:

  • Block blobs: Optimized for storing large amounts of unstructured data such as text or binary data. Block blobs are made up of blocks of data that can be indexed by block IDs.
  • Append blobs: Optimized for append operations, such as logging data from a virtual machine. An append blob is a collection of blocks that are optimized to be appended to.
  • Page blobs: Optimized for random read and write operations. Page blobs are composed of pages of data, and each page can be a different size. Page blobs are used to implement IaaS virtual machine disk storage and SQL Server-based PaaS solutions.

Getting Started with Blob Storage

To get started with Azure Blob Storage, you'll need:

  1. An Azure subscription.
  2. A storage account.

You can create a storage account using the Azure portal, Azure CLI, or Azure PowerShell.

Example: Uploading a file using Azure CLI

First, ensure you have the Azure CLI installed and are logged in. Then, create a storage account (if you don't have one):


az storage account create --name mystorageaccount --resource-group myresourcegroup --location eastus --sku Standard_LRS
                    

Next, create a container:


az storage container create --name mycontainer --account-name mystorageaccount --auth-mode login
                    

Finally, upload a blob:


az storage blob upload --account-name mystorageaccount --container-name mycontainer --name myblob.txt --file mylocalfile.txt --auth-mode login
                    
Important: For production scenarios, it is recommended to use Azure AD authentication (--auth-mode login if using Azure CLI with your logged-in user, or a service principal) instead of account keys for better security.

Use Cases

  • Serving images and documents: Directly serve images, documents, and other content to a web browser.
  • Storing files for distributed access: Store files that need to be accessed from multiple applications or services.
  • Backup, restore, disaster recovery, and archiving: A cost-effective solution for storing backup data and for long-term archiving.
  • Data for analysis: Store large datasets for big data analytics and machine learning workloads.

Further Reading