Blob Storage Operations from the CLI
Beginner8 min
Create storage accounts, manage blob containers, upload and download files, and set access tiers using the Azure CLI.
Prerequisites
- -Azure CLI installed
- -Active Azure subscription
Steps
1
Create a storage account
Creates a general-purpose v2 storage account with locally redundant storage.
$ az storage account create --name mystorageacct --resource-group myapp-rg --location eastus --sku Standard_LRS
Storage account names must be globally unique, 3-24 characters, and lowercase alphanumeric only.
2
Create a blob container
Creates a private blob container. The --auth-mode login uses your Azure AD credentials.
$ az storage container create --name uploads --account-name mystorageacct --auth-mode login
3
Upload a file
Uploads a local file to a specific blob path in the container.
$ az storage blob upload --account-name mystorageacct --container-name uploads --file ./report.pdf --name reports/2026/report.pdf --auth-mode login
4
List blobs in a container
Shows all blobs in the container with size and last modified date.
$ az storage blob list --account-name mystorageacct --container-name uploads --auth-mode login --output table
5
Download a blob
Downloads a blob to a local file path.
$ az storage blob download --account-name mystorageacct --container-name uploads --name reports/2026/report.pdf --file ./downloaded-report.pdf --auth-mode login
Full Script
FAQ
Discussion
Loading comments...