次の方法で共有


Using ステートメント

Bicep パラメーター ファイル内の using ステートメントは、このファイルを Bicep ファイルJSON Azure Resource Manager テンプレート (ARM テンプレート)、Bicep モジュール、またはテンプレート スペックに関連付けます。すべての Bicep パラメーター ファイルに必ず using 宣言が必要です。

Note

Bicep パラメーター ファイルは、Bicep CLI バージョン 0.18.4 以降、Azure CLI バージョン 2.47.0 以降、Azure PowerShell バージョン 9.7.1 以降でのみサポートされています。

JSON ARM テンプレート、Bicep モジュール、テンプレート スペックでこのステートメントを使用するには、Bicep CLI バージョン 0.22.6 以降 および Azure CLI バージョン 2.53.0 以降が必要です。

構文

  • Bicep ファイルを使用するには:

    using '<path>/<file-name>.bicep'
    
  • JSON ARM テンプレートを使用するには:

    using '<path>/<file-name>.json'
    
  • パブリック モジュールを使用するには:

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

    次に例を示します。

    using 'br/public:avm/res/storage/storage-account:0.9.0' 
    
    param name = 'mystorage'
    
  • プライベート モジュールを使用するには:

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

    次に例を示します。

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

    bicepconfig.json ファイルで定義された別名でプライベート モジュールを使用するには:

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

    次に例を示します。

    using 'br/storageModule:storage:v1'
    
  • テンプレート スペックを使用するには:

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

    次に例を示します。

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

    bicepconfig.json ファイルで定義された別名でテンプレート スペックを使用するには:

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

    次に例を示します。

    using 'ts/myStorage:storageSpec:1.0'
    

次のステップ