Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This rule encourages the use of user-defined data types instead of the generic object or array types. Using user-defined data types improves code readability, provides better IntelliSense support, enables compile-time validation, and makes your Bicep files more maintainable.
Note
This rule is off by default. Change the level in bicepconfig.json to enable it.
Linter rule code
Use the following value in the Bicep configuration file to customize rule settings:
use-user-defined-types
Solution
The following parameter definitions for object and array types fail this test.
param storageConfig object
param subnets array
param appSettings object
Instead, use user-define data types as shown in the following example:
type StorageConfig = {
name: string
sku: string
kind: 'StorageV2' | 'FileStorage'
tags?: object
}
type Subnet = {
name: string
addressPrefix: string
}
type AppSettings = {
key: string
value: string
}
param storageConfig StorageConfig
param subnets Subnet[]
param appSettings AppSettings[]
Next steps
For more information about the linter, see Use Bicep linter.