Bicep error code - BCP126

This error occurs when you specify an invalid variable decorator.

Error description

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

Solutions

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

Examples

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

@minLength()
var name = uniqueString(resourceGroup().id)

The valid variable decorators are @description() and @export().

Next steps

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