Редактиране

Споделяне чрез


Using statement

The using statement in Bicep parameter files ties the Bicep parameters file to a Bicep file, an ARM JSON template, or a Bicep module, or a template spec. A using declaration must be present in any Bicep parameters file.

Note

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

To use the statement with ARM JSON 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 file:

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

    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 module:

    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 bicepconfig.json:

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

    For example:

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

    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 bicepconfig.json:

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

    For example:

    using 'ts/myStorage:storageSpec:1.0'
    

Next steps