AZURE
StorageContainerQuotaExceeded - Storage Container Quota Exceeded: Container Limit Reached
StorageContainerQuotaExceeded triggers when you've maxed out containers in the storage account—default is unlimited, but custom quotas or service-level limits can cap container count. ARM returns this 403 client-side error after checking container count against configured limits. Quotas vary by storage account type (Standard vs Premium) and can be set at the account level. Most common when creating containers for VM disk backups, but also appears in AKS container image storage, Azure SQL backup storage, and App Service application file storage.
#Common Causes
- →Custom Quota Limit: A custom quota has been configured that limits container count in the storage account. Quotas may be set at the account level by administrators. This is persistent—you must delete containers or request a quota increase.
- →Service-Level Limits: Certain storage account types or configurations have service-level limits on container count. Premium storage accounts or specific SKUs may have different limits than standard accounts. This is persistent—you must delete containers or use a different storage account type.
- →Account Configuration Restrictions: The storage account has configuration restrictions that limit container creation. Some account settings or policies may restrict container count. This is persistent—you must adjust account configuration or delete containers.
✓Solutions
- 1Step 1: Diagnose - Count current containers in the storage account: az storage container list --account-name <account> --account-key <key> --query "length(@)" --output tsv
- 2Step 2: Diagnose - List all containers to identify candidates for deletion: az storage container list --account-name <account> --account-key <key> --query "[].{Name:name,LastModified:properties.lastModified}" --output table
- 3Step 3: Diagnose - Find empty or unused containers: az storage container list --account-name <account> --account-key <key> --query "[?properties.lastModified<'$(date -u -d '30 days ago' +%Y-%m-%dT%H:%M:%SZ)'].name" --output table
- 4Step 4: Fix - Delete unused containers to free quota: az storage container delete --account-name <account> --account-key <key> --name <container-name> --yes
- 5Step 5: Fix - Request quota increase through Azure Support if custom quotas are configured. Check storage account properties for quota settings.
- 6Step 6: Fix - Consider consolidating containers by using blob naming conventions (virtual directories) to organize content within fewer containers.
- 7Step 7: Verify - After deleting containers or getting quota approval, retry container creation. It should succeed instead of returning StorageContainerQuotaExceeded.
</>Code Examples
Storage Container Quota Usage Diagnosis
1# This script helps diagnose StorageContainerQuotaExceeded by checking container count
2
3# Step 1: Set storage account details (replace with your values)
4STORAGE_ACCOUNT="mystorageaccount"
5# Note: For production, use managed identity or SAS tokens instead of account key
6STORAGE_KEY="your-storage-account-key"
7echo "Checking container quota for storage account: ${STORAGE_ACCOUNT}"
8
9# Step 2: List all containers
10echo "Listing all containers..."
11az storage container list \
12 --account-name ${STORAGE_ACCOUNT} \
13 --account-key ${STORAGE_KEY} \
14 --query "[].{Name:name,LastModified:properties.lastModified,PublicAccess:properties.publicAccess}" \
15 --output table
16
17# Step 3: Count containers
18CONTAINER_COUNT=$(az storage container list \
19 --account-name ${STORAGE_ACCOUNT} \
20 --account-key ${STORAGE_KEY} \
21 --query "length(@)" \
22 --output tsv)
23echo "Current container count: ${CONTAINER_COUNT}"
24
25# Step 4: Check storage account properties for quota settings
26echo "Checking storage account properties..."
27az storage account show \
28 --name ${STORAGE_ACCOUNT} \
29 --resource-group myResourceGroup \
30 --query "{Kind:kind,Sku:sku.name,Tier:sku.tier,ProvisioningState:provisioningState}" \
31 --output table
32
33# Step 5: Find containers not modified in the last 30 days (potentially unused)
34echo "Finding potentially unused containers (not modified in 30 days)..."
35THIRTY_DAYS_AGO=$(date -u -d '30 days ago' +%Y-%m-%dT%H:%M:%SZ)
36UNUSED_CONTAINERS=$(az storage container list \
37 --account-name ${STORAGE_ACCOUNT} \
38 --account-key ${STORAGE_KEY} \
39 --query "[?properties.lastModified<'${THIRTY_DAYS_AGO}'].{Name:name,LastModified:properties.lastModified}" \
40 --output table)
41
42if [ ! -z "${UNUSED_CONTAINERS}" ]; then
43 echo "Potentially unused containers:"
44 echo "${UNUSED_CONTAINERS}"
45else
46 echo "No unused containers found (all modified within 30 days)"
47fi
48
49# Step 6: Check container sizes to identify large containers
50echo "Checking container sizes (this may take time for many containers)..."
51CONTAINER_NAMES=$(az storage container list \
52 --account-name ${STORAGE_ACCOUNT} \
53 --account-key ${STORAGE_KEY} \
54 --query "[].name" \
55 --output tsv)
56
57for container in ${CONTAINER_NAMES}; do
58 BLOB_COUNT=$(az storage blob list \
59 --account-name ${STORAGE_ACCOUNT} \
60 --account-key ${STORAGE_KEY} \
61 --container-name ${container} \
62 --query "length(@)" \
63 --output tsv 2>/dev/null || echo "0")
64 echo "Container ${container}: ${BLOB_COUNT} blobs"
65done
66
67# Step 7: Instructions for deleting containers
68echo ""
69echo "To delete unused containers, run:"
70echo " az storage container delete \"
71echo " --account-name ${STORAGE_ACCOUNT} \"
72echo " --account-key ${STORAGE_KEY} \"
73echo " --name <container-name> \"
74echo " --yes"↗Related Errors
Provider Information
This error code is specific to AZURE services. For more information, refer to the official AZURE documentation.