StorageAzure Resource ManagerKnown error
StorageAccountAlreadyTaken
Storage account names are global
Naming / Storage
What the error looks like
- Error code
- WHO โ identity
- WHAT โ action
- WHERE โ scope
- Policy
- Correlation / trace
{
"code": "StorageAccountAlreadyTakenCODE",
"message": "The storage account named stlogs is already taken."
}What you told me
โAzure won't let me create a storage account.โ
you ยท just now
Let's read it.
RTFE ยท seen
What it actually says
Storage account names are globally unique across all of Azure. Someone, somewhere, already has that name.
Azure outage? No. Global namespace collision.
The fix
- 01Generate a deterministic unique suffix in your IaC instead of a hard-coded name.
param prefix string = 'stlogs'
var storageName = toLower('${prefix}${uniqueString(resourceGroup().id)}')resource "random_string" "suffix" {
length = 6
special = false
upper = false
}
# name = "stlogs${random_string.suffix.result}"Read it faster next time
3โ24 characters, lowercase letters and numbers only. And globally unique.