Bicep Data Types Explained

Bicep Data Types

Bicep is a Domain-Specific Language (DSL) for defining Azure Resource Manager (ARM) templates. It provides a concise and readable way to describe Azure resources and their properties. Understanding data types is crucial in Bicep, as they define the structure and behavior of resources.

This is a new series of articles about ‘BiCep’ technology by Microsoft – it is a game changer for resource management in the cloud – well worth investigating if you are a cloud builder!

Basic Data Types in Bicep


Strings in Bicep are sequences of characters enclosed in single or double quotes. They are used to represent text values. Strings in Bicep support interpolation, enabling dynamic content insertion.


param storageAccountName string = ‘myStorageAccount’

Multi-line Strings

Bicep supports multi-line strings using triple quotes ”’ ”’. This is useful when defining long text values. The characters entered within the opening and closing sequence are read exactly as they are, and there is no need for escaping characters.


var longText = ”’

This is a



Integers are whole numbers without a decimal point. In Bicep, integers are represented as 64-bit integers. However, the range of values may be constrained by the SDK or command-line tool used for deployment when passed as inline parameters. For instance, when deploying a Bicep template using PowerShell, integer types typically range from -2147483648 to 2147483647.

To work around this limitation, it is advisable to specify large integer values in a parameter file. Additionally, it is worth noting that resource types may impose their own restrictions on integer properties.


Note: Bicep does not currently support floating-point, decimal, or binary formats.


param numberOfInstances int = 3


Boolean values represent true or false. These data types are useful for logical decisions and conditions in your code.

Note: Avoid enclosing the value in quotation marks.


param useSSLEncryption bool = true

Complex Data Types


Objects in Bicep are collections of key-value pairs enclosed in curly braces {}. They are used to represent complex data structures and are commonly used to define properties of Azure resources. Each key in an object is a property name, and the corresponding value is the property value.

Objects allow you to group related properties together, which can improve the readability and maintainability of your Bicep code. They also enable you to pass structured data to resources or modules, making your templates more flexible and reusable.


var storageAccountConfig =
name: ‘myStorageAccount’,
type: ‘Standard_LRS’,
environment: ‘production’,
department: ‘finance’

You can access properties of an object using dot notation (.). For example, to access the name property of storageAccountConfig’, you would use ‘’.


Arrays in Bicep are ordered collections of values enclosed in square brackets []. They are used to represent lists of items. Arrays can be declared in a single line or multiple lines, providing flexibility in coding.

Use commas (,) to separate values in single-line declarations, while in multiple-line declarations, they are not required.


var instanceTypes = [

Secure Objects

Bicep has introduced secure objects to enhance security by protecting sensitive information. These objects are encrypted and provide an extra layer of protection for confidential data. Thus, to enhance the security of a string or object, apply the @secure() decorator to it.


param mySuperSecretObject object

Secure Strings

Similar to secure objects, secure strings provide additional security for sensitive information. These strings are encrypted and are designed to prevent unauthorized access to critical data.


param intAsString string
var num = int(intAsString)

Now that we have covered the supported data types in Bicep, let’s explore how user-defined data types can further enhance your Bicep code in the next section.

User-Defined Data Types in Bicep

Bicep extends its supported data types by enabling the definition of user-defined types using the `type` statement. This feature enhances code reusability and simplifies Bicep projects by allowing developers to define custom types based on primitive literals, arrays, and objects.

User-defined types can be utilized across a Bicep file, including in `param` statements and object type properties, making it easy to encapsulate complex data structures and reuse them throughout your code.

This capability empowers developers to create efficient and maintainable infrastructure as code solutions. Whether representing tagged union types or importing types from external sources, Bicep’s user-defined data types provide the flexibility and expressiveness needed for robust Azure deployments.


type SkuType = ‘Standard_LRS’ | ‘Standard_GRS’
type StorageAccountConfig = {
name: string
sku: SkuType



So then, we have learned that mastering data types in Bicep is essential for creating concise and effective Azure Resource Manager templates. By understanding and utilizing the various data types available, you can accurately define the structure and behavior of your Azure resources, leading to more efficient deployments.

Happy cloud building!