AZURE

StorageAccountNameAlreadyTaken - Storage Account Name Already Taken: Global Uniqueness Violation

Hitting StorageAccountNameAlreadyTaken means someone else already claimed that storage account name—names are globally unique across all Azure subscriptions, not just yours. ARM returns this 409 client-side error when name validation finds a collision before provisioning starts. The name might be in use by another subscription, reserved by a soft-deleted account during retention, or blocked by Azure for system use. While you'll see this most often creating storage for VM disk backups, it also pops up in AKS container registries, Azure SQL backup storage, and App Service application files. Names must be 3-24 lowercase alphanumeric characters.

#Common Causes

  • Global Name Collision: A storage account with that exact name already exists in another Azure subscription. Storage account names are globally unique across all subscriptions, so if any subscription has that name, you can't use it. This is persistent—you must choose a different name.
  • Soft-Deleted Account Reservation: The storage account was recently deleted but still exists in soft-delete state, reserving the name during the retention period. Soft-deleted accounts maintain name reservations until permanent deletion completes. This can be transient—waiting for deletion to complete may free the name, but timing isn't guaranteed.
  • System Name Reservation: The name is reserved by Azure for system use or by another subscription's internal processes. Some names may be blocked even if no visible account exists. This is persistent—you must use a different name.

Solutions

  1. 1Step 1: Diagnose - Check name availability before creation: az storage account check-name --name <account-name> --output table Verify the "nameAvailable" field is true before proceeding.
  2. 2Step 2: Diagnose - Check for soft-deleted accounts reserving the name: az storage account list-deleted --query "[?name=='<account-name>']" --output table If found, the name is reserved during retention.
  3. 3Step 3: Fix - Generate a unique name using timestamps, UUIDs, or random suffixes. Use the code example below to create a unique name generator.
  4. 4Step 4: Fix - If a soft-deleted account exists, wait for permanent deletion or permanently delete it (if you have permissions).
  5. 5Step 5: Verify - After selecting an available name, retry storage account creation. It should succeed with HTTP 201 instead of 409.

</>Code Examples

Storage Account Name Availability Check
1# This script helps diagnose StorageAccountNameAlreadyTaken by checking name availability
2
3# Step 1: Set desired storage account name (replace with your name)
4DESIRED_NAME="mystorageaccount"
5echo "Checking availability for name: ${DESIRED_NAME}"
6
7# Step 2: Check name availability
8echo "Checking name availability..."
9az storage account check-name \
10  --name ${DESIRED_NAME} \
11  --output table
12
13# Step 3: Check if name is available (parse JSON response)
14NAME_AVAILABLE=$(az storage account check-name \
15  --name ${DESIRED_NAME} \
16  --query "nameAvailable" \
17  --output tsv)
18
19if [ "$NAME_AVAILABLE" == "true" ]; then
20  echo "Name ${DESIRED_NAME} is available"
21else
22  echo "Name ${DESIRED_NAME} is not available"
23  echo "Reason: $(az storage account check-name --name ${DESIRED_NAME} --query "reason" -o tsv)"
24fi
25
26# Step 4: Check for soft-deleted accounts with the same name
27echo "Checking for soft-deleted accounts..."
28az storage account list-deleted \
29  --query "[?name=='${DESIRED_NAME}']" \
30  --output table
31
32# Step 5: Generate unique name using timestamp and random suffix
33UNIQUE_NAME="mystorage$(date +%s | sha256sum | head -c 8)"
34echo "Generated unique name: ${UNIQUE_NAME}"
35
36# Step 6: Verify generated name is available
37az storage account check-name \
38  --name ${UNIQUE_NAME} \
39  --output table
40
41# Step 7: Function to check and create storage account with unique name
42check_and_create_storage() {
43  local base_name=$1
44  local resource_group=$2
45  local location=$3
46  
47  # Try base name first
48  if az storage account check-name --name $base_name --query "nameAvailable" -o tsv | grep -q "true"; then
49    echo "Creating storage account with name: $base_name"
50    az storage account create \
51      --resource-group $resource_group \
52      --name $base_name \
53      --location $location \
54      --sku Standard_LRS
55  else
56    # Generate unique name
57    local unique_name="${base_name}$(date +%s | sha256sum | head -c 8)"
58    echo "Base name unavailable, using: $unique_name"
59    az storage account create \
60      --resource-group $resource_group \
61      --name $unique_name \
62      --location $location \
63      --sku Standard_LRS
64  fi
65}
66
67# Example usage:
68# check_and_create_storage "mystorage" "myResourceGroup" "eastus"

Related Errors

Provider Information

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

StorageAccountNameAlreadyTaken - Storage Account Name Already Taken: Global Uniqueness Violation | AZURE Error Reference | Error Code Reference