Logical functions for Bicep

Bicep provides the bool function for converting values to a boolean.

Most of the logical functions in Azure Resource Manager templates are replaced with logical operators in Bicep.

bool

bool(arg1)

Converts the parameter to a boolean.

Namespace: sys.

Parameters

Parameter Required Type Description
arg1 Yes string or int The value to convert to a boolean.

Return value

A boolean of the converted value.

Examples

The following example shows how to use bool with a string or integer.

output trueString bool = bool('true')
output falseString bool = bool('false')
output trueInt bool = bool(1)
output falseInt bool = bool(0)

The output from the preceding example with the default values is:

Name Type Value
trueString Bool True
falseString Bool False
trueInt Bool True
falseInt Bool False

Next steps