| title | BCP335 |
|---|---|
| description | The provided value can have a length as large as <source-max-length> and may be too long to assign to a target with a configured maximum length of <target-max-length>. |
| ms.topic | reference |
| ms.custom | devx-track-bicep |
| ms.date | 09/04/2025 |
This diagnostic occurs when the provided value may be too long to assign to a target with a configured maximum length.
The provided value can have a length as large as <source-max-length> and may be too long to assign to a target with a configured maximum length of <target-max-length>.
Warning
Assign a string whose length is within the allowable range.
The following code raises the diagnostic code because a storage account name must be between 3 and 24 characters, but the provided value can be up to 25 characters long. For more information, see Resource name rules.
param storageCount int
resource accounts 'Microsoft.Storage/storageAccounts@2025-01-01' = [for i in range(0, storageCount): if (i % 2 == 0) {
name: 'sa0820${i}'
location: resourceGroup().location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}]
output storageEndpoints array = [for i in range(0, storageCount): accounts[i].?properties.primaryEndpoints.blob]
You can fix the diagnostic by using a short storage account name.
param storageCount int
resource accounts 'Microsoft.Storage/storageAccounts@2025-01-01' = [for i in range(0, storageCount): if (i % 2 == 0) {
name: 'sa082${i}'
location: resourceGroup().location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}]
output storageEndpoints array = [for i in range(0, storageCount): accounts[i].?properties.primaryEndpoints.blob]For more information about Bicep diagnostics, see Bicep core diagnostics.