Azure Blob Storage
How to list Azure Blob Storage versions
Use List Blobs with include=versions for a programmatic inventory, or use az storage blob list --include v for a terminal inspection.
Documentation reviewed · 2 methods with sources
Ways to do it
API
List Blobs with include=versions
List blob versions in a container. Optionally add a name prefix to narrow the results and read VersionId for each returned version.
Read source: Azure Storage List Blobs REST API- Requirements
- For Microsoft Entra authorization, use an Azure Storage bearer token and Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read. Storage Blob Data Reader is the least-privileged built-in role. Supply x-ms-date and x-ms-version headers and a container with versions to list.
- Limitations
- The versions include value requires REST API version 2019-12-12 or later. A page contains up to 5,000 items and may contain fewer. Continue using NextMarker.
Example shell
curl --fail -H "Authorization: Bearer $AZURE_STORAGE_TOKEN" \
-H "x-ms-date: $AZURE_STORAGE_DATE" \
-H "x-ms-version: 2023-11-03" \
"https://$AZURE_STORAGE_ACCOUNT.blob.core.windows.net/$AZURE_CONTAINER?restype=container&comp=list&include=versions&maxresults=100"CLI
az storage blob list --include v
Request blob versions from a container with Azure CLI and use --prefix to narrow the listing by blob name.
Read source: Microsoft Azure CLI blob list reference- Requirements
- Azure CLI, an active Azure sign-in for --auth-mode login, Storage Blob Data Reader access on the container or a parent scope, and existing versions to list.
- Limitations
- The listing defaults to up to 5,000 items. Use --show-next-marker and --marker to page, or --num-results '*' to request all results.
Example shell
az storage blob list --account-name "$AZURE_STORAGE_ACCOUNT" \
--container-name "$AZURE_CONTAINER" --auth-mode login --include v \
--num-results 100 --show-next-marker