Quickstart: Azure Blob Storage

This guide will walk you through the essentials of using Azure Blob Storage. Blob storage is Microsoft’s highly scalable object store solution for the cloud. Optimized for storing massive amounts of unstructured data, such as text or binary data, Blob storage is ideal for:

  • 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.

Prerequisites

Before you begin, you'll need an Azure subscription. If you don't have one, create a free account before you start.

Step 1: Create a Storage Account

A storage account gives you access to Azure Storage data. To create a storage account, follow these steps:

  1. Sign in to the Azure portal.
  2. In the Azure portal, search for and select "Storage accounts".
  3. Select "+ Create".
  4. In the "Basics" tab, provide the following information:
    • Subscription: Select your Azure subscription.
    • Resource group: Create a new resource group or select an existing one.
    • Storage account name: Enter a globally unique name.
    • Region: Select a region.
    • Performance: Choose "Standard".
    • Redundancy: Choose "Locally-redundant storage (LRS)" for this quickstart.
  5. Click "Review + create" and then "Create".

Step 2: Create a Container

Containers organize sets of blobs within a storage account. Think of them like folders.

  1. Navigate to your newly created storage account in the Azure portal.
  2. Under "Data storage", select "Containers".
  3. Select "+ Container".
  4. Enter a name for your container (e.g., mycontainer).
  5. Set "Public access level" to "Blob (anonymous read access for blobs only)".
  6. Click "Create".

Step 3: Upload a Blob

You can upload files (blobs) to your container.

  1. Click on your newly created container (e.g., mycontainer).
  2. Click the "Upload" button.
  3. Browse and select a file from your local machine.
  4. Click "Upload".

Note: For programmatic access, you can use the Azure Storage SDKs for various languages (e.g., Python, .NET, Java, Node.js) or Azure CLI.

Example: Uploading a File with Azure CLI

First, ensure you have Azure CLI installed and logged in. Then, use the following command:


# Replace with your storage account name and container name
STORAGE_ACCOUNT_NAME="yourstorageaccountname"
CONTAINER_NAME="mycontainer"
LOCAL_FILE_PATH="./path/to/your/local/file.txt"
BLOB_NAME="remote/file/name.txt" # Optional: specify a path/name in the container

az storage blob upload \
    --account-name $STORAGE_ACCOUNT_NAME \
    --container-name $CONTAINER_NAME \
    --file $LOCAL_FILE_PATH \
    --name $BLOB_NAME \
    --auth-mode login 
                

The --auth-mode login uses your Azure AD identity for authentication.

Next Steps

Congratulations! You've successfully performed your first Azure Blob Storage operations. You can now explore other capabilities:

Learn More About Azure Storage