| title | BCP416 |
|---|---|
| description | The supplied string does not match the expected pattern of <expected-pattern>. |
| ms.topic | reference |
| ms.custom | devx-track-bicep |
| ms.date | 09/04/2025 |
This diagnostic occurs when the supplied string doesn't match the expected pattern.
The supplied string does not match the expected pattern of <expected-pattern>.
Error
The following code raises the diagnostic code because the resource name isn't valid according to Azure rules - the -(dash) character isn't permitted. For more information, see Resource name rules.
param location string = resourceGroup().location
resource accounts 'Microsoft.Storage/storageAccounts@2025-01-01' = {
name: 'storage-account'
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}You can fix the issue by correcting the resource name property value to meet the naming requirements:
param location string = resourceGroup().location
resource accounts 'Microsoft.Storage/storageAccounts@2025-01-01' = {
name: 'storageaccount'
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
}For more information about Bicep diagnostics, see Bicep core diagnostics.