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.
Introduction
Blob storage is designed to store data as individual blobs. It's highly scalable, cost-effective, and offers various tiers for different access patterns. This documentation provides a comprehensive overview of Azure Blob Storage, its features, and how to use it.
Key Concepts
- Storage Account: A unique namespace in Azure for your data objects. All Azure Storage services are accessible through a storage account.
- Container: A logical grouping of blobs, similar to a directory in a file system.
- Blob: An object that can store a large amount of unstructured data, like text or binary data.
- Access Tier: Determines the cost and access latency for blobs. Common tiers include Hot, Cool, and Archive.
Getting Started
Create a Storage Account
To use Blob Storage, you first need an Azure Storage Account. You can create one through the Azure portal, Azure CLI, or PowerShell.
az storage account create \
--name mystorageaccountname \
--resource-group myresourcegroup \
--location eastus \
--sku Standard_RAGRS \
--kind StorageV2
Create a Container
Once your storage account is ready, you can create containers to organize your blobs.
az storage container create \
--name mycontainer \
--account-name mystorageaccountname \
--auth-mode login
Upload a Blob
You can upload files (blobs) to your container using various methods, including the Azure portal, Azure CLI, or SDKs.
az storage blob upload \
--container-name mycontainer \
--name myblob.txt \
--file /path/to/your/local/file.txt \
--account-name mystorageaccountname \
--auth-mode login
Accessing Blobs
Blobs can be accessed using Shared Access Signatures (SAS) for limited-time access, access keys for full control, or managed identities for secure application access. You can also set public access levels for containers and blobs.
To download a blob:
az storage blob download \
--container-name mycontainer \
--name myblob.txt \
--file ./downloaded-myblob.txt \
--account-name mystorageaccountname \
--auth-mode login
Blob Types
Azure Blob Storage supports three types of blobs:
- Block blobs: Optimized for storing large amounts of unstructured data. Ideal for documents, media files, backups, and logs.
- Append blobs: Optimized for append operations, such as logging.
- Page blobs: Optimized for random read/write operations. Used to back IaaS virtual machine disks.
Security
Security is paramount. Azure Blob Storage offers robust security features:
- Authentication: Azure AD, Shared Access Signatures (SAS), account access keys.
- Authorization: Role-Based Access Control (RBAC) for fine-grained permissions.
- Encryption: Data is encrypted at rest by default and can be encrypted in transit using HTTPS.
- Network Security: Firewalls, virtual networks, and private endpoints.
Pricing
Blob storage pricing is based on several factors:
- Data storage (GB per month)
- Operations (number of reads and writes)
- Data transfer (egress data)
- Redundancy options (LRS, GRS, RA-GRS)
- Access tier (Hot, Cool, Archive)
Refer to the Azure Blob Storage pricing page for detailed information.
Use Cases
- Serving images or documents directly to a browser.
- Storing files for distributed access.
- Streaming video and audio.
- Writing to log files.
- Storing data for backup and restore, disaster recovery, and archiving.
- Storing data for analysis by an on-premises or Azure-hosted service.
SDKs & Tools
Interact with Azure Blob Storage using a variety of SDKs and tools:
- Azure CLI: Command-line interface for managing Azure resources.
- Azure PowerShell: Scripting language for managing Azure resources.
- SDKs: Available for .NET, Java, Python, Node.js, Go, C++, and more.
- Azure Storage Explorer: A cross-platform graphical tool for managing Azure Storage resources.