ContainerNotFound - Container Not Found: Blob Container Does Not Exist
The blob container doesn't exist in the storage account—name format might be invalid (3-63 characters, lowercase alphanumeric plus hyphens, no consecutive hyphens), the container was deleted, or the case doesn't match (containers are case-sensitive, so "MyContainer" ≠ "mycontainer"). This 404 client-side error occurs after Storage validates the name format but can't locate the container. Unlike Key Vaults and Storage accounts, containers don't support soft-delete—when deleted, they're permanently gone with no recovery period. Appears when accessing containers for VM disk backups, AKS container images, Azure SQL backups, or App Service application files.
#Common Causes
- →Invalid Container Name Format: The name doesn't match the DNS-compliant pattern (3-63 characters, lowercase alphanumeric + hyphens, no consecutive hyphens). Storage rejects names that violate these rules before querying.
- →Container Deleted: Deleted containers are permanently gone—containers don't support soft-delete. When a delete operation succeeds, the container is immediately and permanently deleted. There's no recovery period.
- →Case Sensitivity Mismatch: Container names are case-sensitive. "MyContainer" and "mycontainer" are different containers. The container name case doesn't exactly match the stored container name.
- →Container Never Existed: The container was never created, or you're using the wrong container name. Verify the container name is correct.
✓Solutions
- 1Step 1: Diagnose - List all containers to see what exists: az storage container list --account-name <account> --account-key <key> --query "[].name" --output table
- 2Step 2: Diagnose - Check container existence: az storage container show --name <container> --account-name <account> --account-key <key> --output table
- 3Step 3: Diagnose - Verify container name format (3-63 characters, lowercase alphanumeric + hyphens, no consecutive hyphens).
- 4Step 4: Fix - Create missing container: az storage container create --name <container> --account-name <account> --account-key <key> --output table
- 5Step 5: Fix - Verify exact case-sensitive name matches stored container name. List containers and compare the exact case.
- 6Step 6: Verify - Retry container operation. It should succeed instead of returning ContainerNotFound.
</>Code Examples
1# This script helps diagnose ContainerNotFound errors
2
3# Step 1: Set storage account details (replace with your values)
4STORAGE_ACCOUNT="mystorageaccount"
5CONTAINER_NAME="mycontainer"
6# Note: For production, use Azure Key Vault or managed identity instead of account key
7ACCOUNT_KEY="your-storage-account-key"
8
9# Step 2: Verify container name format (3-63 characters, lowercase alphanumeric + hyphens, no consecutive hyphens)
10if [[ ! $CONTAINER_NAME =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ ]] || [ ${#CONTAINER_NAME} -lt 3 ] || [ ${#CONTAINER_NAME} -gt 63 ]; then
11 echo "ERROR: Invalid container name format"
12 echo "Required: 3-63 characters, lowercase alphanumeric + hyphens, no consecutive hyphens"
13 exit 1
14fi
15echo "Container name format is valid"
16
17# Step 3: List all containers to see what exists
18echo "Listing all containers in storage account $STORAGE_ACCOUNT..."
19az storage container list \
20 --account-name $STORAGE_ACCOUNT \
21 --account-key $ACCOUNT_KEY \
22 --query "[].{name:name, lastModified:properties.lastModified}" \
23 --output table
24
25# Step 4: Check if container exists
26echo "Checking if container $CONTAINER_NAME exists..."
27if az storage container show \
28 --name $CONTAINER_NAME \
29 --account-name $STORAGE_ACCOUNT \
30 --account-key $ACCOUNT_KEY \
31 --output table 2>&1; then
32 echo "Container found and accessible"
33else
34 echo "Container not found. Creating..."
35
36 # Step 5: Create container if it doesn't exist
37 az storage container create \
38 --name $CONTAINER_NAME \
39 --account-name $STORAGE_ACCOUNT \
40 --account-key $ACCOUNT_KEY \
41 --output table
42
43 echo "Container created successfully"
44fi
45
46# Step 6: Verify container case sensitivity
47echo "Note: Container names are case-sensitive"
48echo " 'MyContainer' and 'mycontainer' are different containers"
49echo " Ensure the exact case matches when referencing containers"↗Related Errors
Provider Information
This error code is specific to AZURE services. For more information, refer to the official AZURE documentation.