Skip to content

Commit d988fce

Browse files
authored
Merge pull request #177650 from davidsmatlak/ds-updates-troubleshooting
Updates ARM troubleshooting docs
2 parents 5bf4cd0 + 94b4e9a commit d988fce

File tree

9 files changed

+118
-64
lines changed

9 files changed

+118
-64
lines changed

articles/azure-resource-manager/troubleshooting/common-deployment-errors.md

Lines changed: 79 additions & 51 deletions
Large diffs are not rendered by default.
Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,58 @@
11
---
22
title: Storage account name errors
3-
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.
44
ms.topic: troubleshooting
5-
ms.date: 03/09/2018
5+
ms.date: 10/26/2021
66
---
7+
78
# Resolve errors for storage account names
89

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.
1011

1112
## Symptom
1213

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:
1415

15-
```
16+
```Output
1617
Code=AccountNameInvalid
1718
Message=S!torageckrexph7isnoc is not a valid storage account name. Storage account name must be
1819
between 3 and 24 characters in length and use numbers and lower-case letters only.
1920
```
2021

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:
2223

23-
```
24+
```Output
2425
Code=StorageAccountAlreadyTaken
2526
Message=The storage account named mystorage is already taken.
2627
```
2728

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.
2930

3031
## Cause
3132

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.
3334

3435
## Solution
3536

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).
3740

3841
```json
3942
"name": "[concat('storage', uniqueString(resourceGroup().id))]",
4043
"type": "Microsoft.Storage/storageAccounts",
4144
```
4245

43-
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).
47+
48+
```bicep
49+
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
50+
name: 'storage${uniqueString(resourceGroup().id)}'
51+
```
52+
53+
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.
4456

4557
```json
4658
"parameters": {
@@ -49,10 +61,24 @@ Make sure your storage account name does not exceed 24 characters. The [uniqueSt
4961
"maxLength": 11,
5062
"defaultValue": "storage",
5163
"metadata": {
52-
"description": "The value to use for starting the storage account name."
64+
"description": "The prefix value for the storage account name."
5365
}
5466
}
5567
}
5668
```
5769

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.
77+
78+
```json
79+
"name": "[concat(parameters('storageNamePrefix'), uniquestring(resourceGroup().id))]"
80+
```
81+
82+
```bicep
83+
name: '${storageNamePrefix}${uniqueString(resourceGroup().id)}'
84+
```
16.2 KB
Loading
33.6 KB
Loading
-3.14 KB
Loading
14.7 KB
Loading

0 commit comments

Comments
 (0)