You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Describes the errors you may encounter when specifying a storage account name.
3
+
description: Describes errors that can occur when specifying a storage account name in an Azure Resource Manager template (ARM template) or Bicep file.
4
4
ms.topic: troubleshooting
5
-
ms.date: 03/09/2018
5
+
ms.date: 10/26/2021
6
6
---
7
+
7
8
# Resolve errors for storage account names
8
9
9
-
This article describes naming errors you may encounter when deploying a storage account.
10
+
This article describes naming errors that can occur when deploying a storage account with an Azure Resource Manager template (ARM template) or Bicep file.
10
11
11
12
## Symptom
12
13
13
-
If your storage account name includes prohibited characters, you receive an error like:
14
+
If your storage account name includes prohibited characters, like an uppercase letter or exclamation point, you receive an error:
14
15
15
-
```
16
+
```Output
16
17
Code=AccountNameInvalid
17
18
Message=S!torageckrexph7isnoc is not a valid storage account name. Storage account name must be
18
19
between 3 and 24 characters in length and use numbers and lower-case letters only.
19
20
```
20
21
21
-
For storage accounts, you must provide a name for the resource that is unique across Azure. If you do not provide a unique name, you receive an error like:
22
+
For storage accounts, you must provide a resource name that's unique across Azure. If you don't provide a unique name, you receive an error:
22
23
23
-
```
24
+
```Output
24
25
Code=StorageAccountAlreadyTaken
25
26
Message=The storage account named mystorage is already taken.
26
27
```
27
28
28
-
If you deploy a storage account with the same name as an existing storage account in your subscription, but provide a different location, you receive an error indicating the storage account already exists in a different location. Either delete the existing storage account, or provide the same location as the existing storage account.
29
+
If you deploy a storage account with the same name as an existing storage account in your subscription, but in a different location, you receive an error. The error indicates the storage account already exists in a different location. Either delete the existing storage account or use the same location as the existing storage account.
29
30
30
31
## Cause
31
32
32
-
Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. The name must be unique.
33
+
Storage account names must be between 3 and 24 characters in length and only use numbers and lowercase letters. No uppercase letters or special characters. The name must be unique.
33
34
34
35
## Solution
35
36
36
-
Make sure the storage account name is unique. You can create a unique name by concatenating your naming convention with the result of the [uniqueString](../templates/template-functions-string.md#uniquestring) function.
37
+
You can create a unique name by concatenating your naming convention with the result of the `uniqueString` function.
38
+
39
+
ARM templates use [concat](../templates/template-functions-string.md#concat) with [uniqueString](../templates/template-functions-string.md#uniquestring).
Make sure your storage account name does not exceed 24 characters. The [uniqueString](../templates/template-functions-string.md#uniquestring) function returns 13 characters. If you concatenate a prefix or postfix to the **uniqueString** result, provide a value that is 11 characters or less.
46
+
Bicep uses [string interpolation](../bicep/bicep-functions-string.md#concat) with [uniqueString](../bicep/bicep-functions-string.md#uniquestring).
Make sure your storage account name doesn't exceed 24 characters. The `uniqueString` function returns 13 characters. If you want to concatenate a prefix or suffix, provide a value that's 11 characters or less.
54
+
55
+
The following examples use a parameter that creates a prefix with a maximum of 11 characters.
44
56
45
57
```json
46
58
"parameters": {
@@ -49,10 +61,24 @@ Make sure your storage account name does not exceed 24 characters. The [uniqueSt
49
61
"maxLength": 11,
50
62
"defaultValue": "storage",
51
63
"metadata": {
52
-
"description": "The value to use for starting the storage account name."
64
+
"description": "The prefix value for the storage account name."
53
65
}
54
66
}
55
67
}
56
68
```
57
69
58
-
Make sure your storage account name does not include any upper-case letters or special characters.
70
+
```bicep
71
+
@description('The prefix value for the storage account name.')
72
+
@maxLength(11)
73
+
param storageNamePrefix string = 'storage'
74
+
```
75
+
76
+
You then concatenate the parameter value with the `uniqueString` value to create a storage account name.
0 commit comments