AZURE

StorageAccountNotFound - Storage Account Not Found: Name Invalid or Deleted

ARM can't find the storage account—the name format is wrong (3-24 lowercase alphanumeric, no hyphens), the account was soft-deleted, or you're querying the wrong resource group/subscription. This 404 client-side error happens after ARM validates the name format but the provider can't resolve it. Storage account names are globally unique across all Azure subscriptions and case-sensitive. Soft-deleted accounts exist during retention but aren't accessible via standard GET operations. Common when referencing storage for VM disk backups, AKS container registries, Azure SQL backups, or App Service application storage.

#Common Causes

  • Invalid Storage Account Name Format: The name doesn't match the required pattern (lowercase alphanumeric, 3-24 characters, no hyphens). ARM rejects names that violate these rules before querying.
  • Soft-Deleted Storage Account: Storage accounts exist in a "Deleted" state with the retention period still active. During retention, standard GET operations return StorageAccountNotFound even though the account technically exists. Retention period is configurable but varies.
  • Name Not Available Globally: Storage account names are globally unique, so if you're trying to create one and get this error, the name might already exist in another subscription. The name was never created or was permanently deleted after the retention period expired.
  • Wrong Resource Group or Subscription: Storage accounts in different resource groups or subscriptions aren't accessible from your current path. The account exists but in a different resource group or subscription than specified in your request path.

Solutions

  1. 1Step 1: Diagnose - Check storage account name format (3-24 lowercase alphanumeric, no hyphens).
  2. 2Step 2: Diagnose - Check if storage account exists: az storage account show --name <account-name> --resource-group <rg-name> --output table
  3. 3Step 3: Diagnose - Check for soft-deleted storage accounts: az storage account list-deleted --query "[?name=='<account-name>']" --output table
  4. 4Step 4: Diagnose - Check name availability before creation: az storage account check-name --name <account-name> --output table
  5. 5Step 5: Fix - Restore soft-deleted account if found: az storage account restore --name <account> --resource-group <rg> --deleted-account-name <deleted-name>
  6. 6Step 6: Fix - Create storage account with unique name: az storage account create --name <unique-name> --resource-group <rg> --location <location> --sku Standard_LRS
  7. 7Step 7: Fix - Verify resource group and subscription in your request path match where the account actually exists.
  8. 8Step 8: Verify - Retry storage account lookup: az storage account show --name <account-name> --resource-group <rg-name> --output table

</>Code Examples

Storage Account Lookup and Recovery
1# This script helps diagnose StorageAccountNotFound errors
2
3# Step 1: Example storage account name (replace with your actual account name)
4ACCOUNT_NAME="mystorageaccount"
5RG_NAME="my-resource-group"
6echo "Checking storage account: $ACCOUNT_NAME"
7
8# Step 2: Verify storage account name format (3-24 lowercase alphanumeric, no hyphens)
9if [[ ! $ACCOUNT_NAME =~ ^[a-z0-9]{3,24}$ ]]; then
10  echo "ERROR: Invalid storage account name format"
11  echo "Required: 3-24 lowercase alphanumeric characters, no hyphens"
12  exit 1
13fi
14echo "Storage account name format is valid"
15
16# Step 3: Check name availability
17echo "Checking name availability..."
18az storage account check-name --name $ACCOUNT_NAME --output table
19
20# Step 4: Try to show storage account details
21echo "Attempting to show storage account details..."
22if az storage account show --name $ACCOUNT_NAME --resource-group $RG_NAME --output table 2>&1; then
23  echo "Storage account found and accessible"
24else
25  echo "Storage account not found. Continuing diagnosis..."
26fi
27
28# Step 5: Check for soft-deleted storage accounts
29echo "Checking for soft-deleted storage accounts..."
30az storage account list-deleted --query "[?name=='$ACCOUNT_NAME']" --output table
31
32# Step 6: List all storage accounts in resource group
33echo "Listing all storage accounts in resource group $RG_NAME..."
34az storage account list --resource-group $RG_NAME --query "[].{name:name, location:location, sku:sku.name}" --output table
35
36# Step 7: Search for storage account across all resource groups
37echo "Searching for storage account across all resource groups..."
38az storage account list --query "[?name=='$ACCOUNT_NAME'].{name:name, resourceGroup:resourceGroup, location:location}" --output table
39
40# Step 8: If storage account is soft-deleted and you want to restore it:
41# DELETED_ACCOUNT_NAME="mystorageaccount"
42# LOCATION="eastus"
43# echo "Restoring soft-deleted storage account..."
44# az storage account restore --name $ACCOUNT_NAME --resource-group $RG_NAME --deleted-account-name $DELETED_ACCOUNT_NAME --location $LOCATION
45
46# Step 9: Create storage account if it doesn't exist
47if ! az storage account show --name $ACCOUNT_NAME --resource-group $RG_NAME &>/dev/null; then
48  echo "Storage account does not exist. Creating..."
49  LOCATION="eastus"
50  az storage account create \
51    --name $ACCOUNT_NAME \
52    --resource-group $RG_NAME \
53    --location $LOCATION \
54    --sku Standard_LRS \
55    --output table
56fi

Related Errors

Provider Information

This error code is specific to AZURE services. For more information, refer to the official AZURE documentation.

StorageAccountNotFound - Storage Account Not Found: Name Invalid or Deleted | AZURE Error Reference | Error Code Reference