Bicep error code - BCP127

This error occurs when you specify an invalid resource decorator.

Error description

Function <function-name> can't be used as a resource decorator.

Solutions

Use the valid decorators for resource declarations. For more information, see Decorators.

Examples

The following example raises the error because @export() is not a valid resource decorator.

@export()
resource store 'Microsoft.Storage/storageAccounts@2023-05-01' existing = {
  name: uniqueString(resourceGroup().id)
}

The valid resource decorators are @description() and @batchSize().

Next steps

For more information about Bicep error and warning codes, see Bicep core diagnostics.