Skip to content

Commit 7f012f2

Browse files
authored
Merge pull request #180515 from tfitzmac/1118ts
add template specs to modules
2 parents e1dabb9 + c7ff0c6 commit 7f012f2

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

articles/azure-resource-manager/bicep/modules.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
title: Bicep modules
33
description: Describes how to define a module in a Bicep file, and how to use module scopes.
44
ms.topic: conceptual
5-
ms.date: 11/12/2021
5+
ms.date: 11/19/2021
66
---
77

88
# Bicep modules
99

1010
Bicep enables you to organize deployments into modules. A module is just a Bicep file that is deployed from another Bicep file. With modules, you improve the readability of your Bicep files by encapsulating complex details of your deployment. You can also easily reuse modules for different deployments.
1111

12-
To share modules with other people in your organization, [create a private registry](private-module-registry.md). Modules in the registry are only available to users with the correct permissions.
12+
To share modules with other people in your organization, create a [template spec](../templates/template-specs.md) or [private registry](private-module-registry.md). Template specs and modules in the registry are only available to users with the correct permissions.
13+
14+
> [!TIP]
15+
> The choice between template specs and private registries is mostly a matter of preference. If you're deploying templates or Bicep files without other project artifacts, template specs are an easier option. If you're deploying project artifacts with the templates or Bicep files, you can integrate the private registry with your development work and then more easily deploy all of it from the registry.
1316
1417
Bicep modules are converted into a single Azure Resource Manager template with [nested templates](../templates/linked-templates.md#nested-template).
1518

@@ -58,7 +61,7 @@ Like resources, modules are deployed in parallel unless they depend on other mod
5861

5962
## Path to module
6063

61-
The file for the module can be either a local file or an external file in a Bicep module registry. Both options are shown below.
64+
The file for the module can be either a local file or an external file. The external file can be in template spec or a Bicep module registry. All fo these options are shown below.
6265

6366
### Local file
6467

@@ -90,6 +93,31 @@ The full path for a module in a registry can be long. Instead of providing the f
9093

9194
::: code language="bicep" source="~/azure-docs-bicep-samples/syntax-samples/modules/alias-definition.bicep" highlight="1" :::
9295

96+
### File in template spec
97+
98+
After creating a [template spec](../templates/template-specs.md), you can link to that template spec in a module. Specify the template spec in the following format:
99+
100+
```bicep
101+
module <symbolic-name> 'ts:<sub-id>/<rg-name>/<template-spec-name>:<version>' = {
102+
```
103+
104+
However, you can simplify your Bicep file by [creating an alias](bicep-config-modules.md) for the resource group that contains your template specs. When using an alias, the syntax becomes:
105+
106+
```bicep
107+
module <symbolic-name> 'ts/<alias>:<template-spec-name>:<version>' = {
108+
```
109+
110+
The following module deploys a template spec to create a storage account. The subscription and resource group for the template spec is defined in the alias named **ContosoSpecs**.
111+
112+
```bicep
113+
module stgModule 'ts/ContosoSpecs:storageSpec:2.0' = {
114+
name: 'storageDeploy'
115+
params: {
116+
storagePrefix: 'examplestg1'
117+
}
118+
}
119+
```
120+
93121
## Parameters
94122

95123
The parameters you provide in your module definition match the parameters in the Bicep file.

0 commit comments

Comments
 (0)