Azure Blob Storage Quickstart

This guide will walk you through the essential steps to get started with Azure Blob Storage, a service for storing large amounts of unstructured data like text or binary data.

Prerequisites: You need an Azure account. If you don't have one, you can create a free account.

1. Create a Storage Account

Before you can store data, you need an Azure Storage account. You can create one through the Azure portal, Azure CLI, or Azure PowerShell.

Using Azure Portal:

  1. Sign in to the Azure portal.
  2. Search for "Storage accounts" and select it.
  3. Click Create.
  4. Fill in the required details: Subscription, Resource group, Storage account name (globally unique), Region, and Performance tier.
  5. Review and create the storage account.

Using Azure CLI:

Open your terminal or command prompt and run the following command, replacing placeholders:

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

2. Create a Container

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

Using Azure Portal:

  1. Navigate to your newly created storage account.
  2. Under "Data storage", select Containers.
  3. Click + Container.
  4. Give your container a name (e.g., mycontainer) and choose its public access level.
  5. Click Create.

Using Azure CLI:

You'll need your storage account name and key. You can get the key from the Azure portal under your storage account's "Access keys" section.

az storage container create \
    --name mycontainer \
    --account-name mystorageaccountname \
    --account-key YOUR_STORAGE_ACCOUNT_KEY

3. Upload a Blob

Now, let's upload a file (blob) to your container.

Using Azure Portal:

  1. Navigate to your container.
  2. Click the Upload button.
  3. Select the file you want to upload from your local machine.
  4. Click Upload.

Using Azure CLI:

az storage blob upload \
    --account-name mystorageaccountname \
    --account-key YOUR_STORAGE_ACCOUNT_KEY \
    --container-name mycontainer \
    --file /path/to/your/local/file.txt \
    --name myblob.txt

4. Download a Blob

Retrieve your uploaded blob.

Using Azure Portal:

  1. Navigate to your container and click on the blob you want to download.
  2. Click the Download button.

Using Azure CLI:

az storage blob download \
    --account-name mystorageaccountname \
    --account-key YOUR_STORAGE_ACCOUNT_KEY \
    --container-name mycontainer \
    --name myblob.txt \
    --file ./downloaded-file.txt

5. Delete a Blob

Clean up by deleting blobs.

Using Azure Portal:

  1. Navigate to your container.
  2. Select the blob(s) you want to delete.
  3. Click the Delete button.

Using Azure CLI:

az storage blob delete \
    --account-name mystorageaccountname \
    --account-key YOUR_STORAGE_ACCOUNT_KEY \
    --container-name mycontainer \
    --name myblob.txt

Next Steps

Congratulations! You've completed the basic operations for Azure Blob Storage. Consider exploring these topics next:

Continue to Create Container