Skip to content

Latest commit

 

History

History
97 lines (66 loc) · 2.58 KB

File metadata and controls

97 lines (66 loc) · 2.58 KB
title description ms.topic ms.date ms.custom
Using statement
Learn how to use the `using` statement in Bicep.
conceptual
01/10/2025
devx-track-bicep

Using statement

The using statement in Bicep parameters files ties the file to a Bicep file, a JSON Azure Resource Manager template (ARM template), a Bicep module, or a template spec. A using declaration must be present in all Bicep parameters files.

Note

The Bicep parameters file is only supported in the Bicep CLI version 0.18.4 or later, Azure CLI version 2.47.0 or later, and Azure PowerShell version 9.7.1 or later.

To use the statement with JSON ARM templates, Bicep modules, and template specs, you need to have Bicep CLI version 0.22.6 or later and Azure CLI version 2.53.0 or later.

Syntax

  • To use Bicep files:

    using '<path>/<file-name>.bicep'
  • To use JSON ARM templates:

    using '<path>/<file-name>.json'
  • To use public modules:

    using 'br/public:<file-path>:<tag>'

    For example:

    using 'br/public:avm/res/storage/storage-account:0.9.0' 
    
    param name = 'mystorage'
  • To use private modules:

    using 'br:<acr-name>.azurecr.io/bicep/<file-path>:<tag>'

    For example:

    using 'br:myacr.azurecr.io/bicep/modules/storage:v1'

    To use a private module with an alias defined in a bicepconfig.json file:

    using 'br/<alias>:<file>:<tag>'

    For example:

    using 'br/storageModule:storage:v1'
  • To use template specs:

    using 'ts:<subscription-id>/<resource-group-name>/<template-spec-name>:<tag>

    For example:

    using 'ts:00000000-0000-0000-0000-000000000000/myResourceGroup/storageSpec:1.0'

    To use a template spec with an alias defined in a bicepconfig.json file:

    using 'ts/<alias>:<template-spec-name>:<tag>'

    For example:

    using 'ts/myStorage:storageSpec:1.0'

Next steps