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:
- Sign in to the Azure portal.
- Search for "Storage accounts" and select it.
- Click Create.
- Fill in the required details: Subscription, Resource group, Storage account name (globally unique), Region, and Performance tier.
- 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:
- Navigate to your newly created storage account.
- Under "Data storage", select Containers.
- Click + Container.
- Give your container a name (e.g.,
mycontainer) and choose its public access level. - 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:
- Navigate to your container.
- Click the Upload button.
- Select the file you want to upload from your local machine.
- 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:
- Navigate to your container and click on the blob you want to download.
- 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:
- Navigate to your container.
- Select the blob(s) you want to delete.
- 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:
- Managing Access with Shared Access Signatures (SAS) and Access Policies
- Using Azure Storage SDKs for programmatic access
- Configuring static website hosting with Blob Storage