Configure your Bicep environment

Bicep supports a configuration file named bicepconfig.json. Within this file, you can add values that customize your Bicep development experience. If you don't add this file, Bicep uses default values.

To customize values, create this file in the directory where you store Bicep files. You can add bicepconfig.json files in multiple directories. The configuration file closest to the Bicep file in the directory hierarchy is used.

To configure Bicep extension settings, see VS Code and Bicep extension.

Create the config file in Visual Studio Code

You can use any text editor to create the config file.

To create a bicepconfig.json file in Visual Studio Code, open the Command Palette ([CTRL/CMD]+[SHIFT]+P), and then select Bicep: Create Bicep Configuration File. For more information, see Create Bicep configuration file.

Screenshot of how to create Bicep configuration file in VS Code.

The Bicep extension for Visual Studio Code supports intellisense for your bicepconfig.json file. Use the intellisense to discover available properties and values.

Screenshot of the intellisense support in configuring bicepconfig.json.

Configure Bicep modules

When working with modules, you can add aliases for module paths. These aliases simplify your Bicep file because you don't have to repeat complicated paths. You can also configure cloud profile and credential precedence for authenticating to Azure from Bicep CLI and Visual Studio Code. The credentials are used to publish modules to registries and to restore external modules to the local cache when using the insert resource function. For more information, see Add module settings to Bicep config.

Configure Linter rules

The Bicep linter checks Bicep files for syntax errors and best practice violations. You can override the default settings for the Bicep file validation by modifying bicepconfig.json. For more information, see Add linter settings to Bicep config.

Enable experimental features

You can enable preview features by adding:

{
  "experimentalFeaturesEnabled": {
    "userDefinedTypes": true,
    "extensibility": true
  }
}

Warning

To utilize the experimental features, it's necessary to have the latest version of Azure CLI.

The preceding sample enables 'userDefineTypes' and 'extensibility`. The available experimental features include:

  • assertions: Should be enabled in tandem with testFramework experimental feature flag for expected functionality. Allows you to author boolean assertions using the assert keyword comparing the actual value of a parameter, variable, or resource name to an expected value. Assert statements can only be written directly within the Bicep file whose resources they reference.
  • compileTimeImports: Allows you to use symbols defined in another template. See Import user-defined data types.
  • extensibility: Allows Bicep to use a provider model to deploy non-ARM resources. Currently, we only support a Kubernetes provider. See Bicep extensibility Kubernetes provider.
  • sourceMapping: Enables basic source mapping to map an error location returned in the ARM template layer back to the relevant location in the Bicep file.
  • resourceTypedParamsAndOutputs: Enables the type for a parameter or output to be of type resource to make it easier to pass resource references between modules. This feature is only partially implemented. See Simplifying resource referencing.
  • symbolicNameCodegen: Allows the ARM template layer to use a new schema to represent resources as an object dictionary rather than an array of objects. This feature improves the semantic equivalent of the Bicep and ARM templates, resulting in more reliable code generation. Enabling this feature has no effect on the Bicep layer's functionality.
  • testFramework: Should be enabled in tandem with assertions experimental feature flag for expected functionality. Allows you to author client-side, offline unit-test test blocks that reference Bicep files and mock deployment parameters in a separate test.bicep file using the new test keyword. Test blocks can be run with the command bicep test <filepath_to_file_with_test_blocks> which runs all assert statements in the Bicep files referenced by the test blocks.
  • userDefinedFunctions: Allows you to define your own custom functions. See User-defined functions in Bicep.

Next steps