Understanding Microsoft Azure Blobs: Storage for Binary Large Objects

Microsoft Azure Blobs, or Binary Large Objects, provide efficient storage solutions for various file types like images, text, videos, and audio. This guide explores the three types of Azure blobs—Block Blobs, Append Blobs, and Page Blobs—each optimized for specific data storage and retrieval needs, from large uploads to sequential data appends and random access.



Microsoft Azure - Blobs

Let's start by understanding what a "Blob" is. The term Blob stands for Binary Large Object. In Azure, Blobs can be various types of files like images, text files, videos, and audio files. Azure offers three types of blobs:

Types of Blobs

  • Block Blobs: These are collections of individual blocks, each with a unique block ID. Block blobs are designed to allow users to upload large amounts of data efficiently.
  • Append Blobs: These are optimized for operations that append data, making them efficient for scenarios like logging.
  • Page Blobs: These consist of pages and are designed to support random read and write operations. If you don’t specify a blob type when creating a blob, it defaults to a block blob.

All blobs must reside within a container in your Azure storage account. Here's how to create a container.

Creating a Container

Step 1: Log in to Azure Portal

Log in to the Azure portal and navigate to your storage account.

Step 2: Create a New Container

Click on Create new container. You'll see an interface similar to the one shown below.

Access Permissions

When creating a container, you'll have three options in the Access dropdown to set who can access the blobs:

  • Private: Only the account owner can access the blobs.
  • Public Container: Anyone can access all the contents of the container.
  • Public Blob: Allows open access to the blobs but does not permit access to the container itself.

Uploading a Blob Using PowerShell

You can also upload blobs using PowerShell, which provides a command-line interface for managing your Azure resources.

Step 1: Open PowerShell

Open ‘Windows PowerShell’ from the taskbar, right-click, and choose ‘Run ISE as Administrator.’

Step 2: Access Your Azure Storage Account

Use the following command to access your Azure storage account. Replace the highlighted fields with your actual account details.

Syntax

$context = New-AzureStorageContext -StorageAccountName tutorialsarena -StorageAccountKey "your-storage-account-key"
        

Step 3: Verify Azure Subscription

Run this command to retrieve the details of your Azure account and ensure your subscription is set up correctly.

Syntax

Get-AzureSubscription
        

Step 4: Upload a File

To upload a file, use the following command:

Syntax

Set-AzureStorageBlobContent -Blob Montiorlog.png -Container images -File "E:\MyPictures\MonitorLog.png" -Context $context -Force
        

Step 5: Verify the Upload

To verify the upload, run:

Syntax

Get-AzureStorageBlob -Container $ContainerName -Context $context | Select Name
        

Downloading a Blob

To download a blob, follow these steps:

Step 1: Set the Directory

Set the directory where you want to save the downloaded file:

Syntax

$localTargetDirectory = "C:\Users\YourName\Downloads"
        

Step 2: Download the Blob

Use the following command to download the blob:

Syntax

$BlobName = "Montiorlog.png"
Get-AzureStorageBlobContent -Blob $BlobName -Container $ContainerName -Destination $localTargetDirectory -Context $context
        

Important Notes

  • PowerShell command names and file names are case-sensitive.
  • Commands should be written in one line, or if they continue on the next line, use the backtick (`) as a continuation character.

Managing Blobs with Azure Storage Explorer

Azure Storage Explorer is a user-friendly tool that makes managing blobs simple, much like working with files and folders in Windows Explorer. With it, you can:

  • Create new containers
  • Upload and download blobs
  • View blobs in a list format
  • Copy blobs to another location

The interface makes it easy to manage Azure storage with just a few clicks. Once you add your account, you can select it from a dropdown and start managing your blobs with ease.

This tool simplifies the process of managing your Azure storage, making it accessible even if you’re not comfortable with command-line tools like PowerShell.