Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.36 KB

File metadata and controls

55 lines (40 loc) · 1.36 KB
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

Bicep diagnostic code - BCP416

This diagnostic occurs when the supplied string doesn't match the expected pattern.

Description

The supplied string does not match the expected pattern of <expected-pattern>.

Level

Error

Examples

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'
}

Next steps

For more information about Bicep diagnostics, see Bicep core diagnostics.