Nullable types in Bicep
Sometimes you need to define nullable parameters in Bicep files. It is possible by adding ? character after the type of the parameter:
param <param_name> <param_type>?
For example - let's assume the case that you need to deploy subnet and assign the NSG to it, but it happens conditionally. Then in Bicep module for subnet you could have
param nsgId string?
So if you have not deployed the NSG and you do not have the ID of NSG to push to the subnet, you can just skip it and accept null value.
This is the basic stuff, but I have not found it in the documentation, so I am adding it here. Here you can find other useful docs and blogposts about nullability in Bicep:






