You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/template-specs.md
+20-14Lines changed: 20 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,12 @@
2
2
title: Create & deploy template specs in Bicep
3
3
description: Describes how to create template specs in Bicep and share them with other users in your organization.
4
4
ms.topic: conceptual
5
-
ms.date: 02/01/2022
5
+
ms.date: 08/23/2022
6
6
---
7
7
8
8
# Azure Resource Manager template specs in Bicep
9
9
10
-
A template spec is a resource type for storing an Azure Resource Manager template (ARM template) for later deployment. This resource type enables you to share ARM templates with other users in your organization. Just like any other Azure resource, you can use Azure role-based access control (Azure RBAC) to share the template spec. You can use Azure CLI or Azure PowerShell to create template specs by providing Bicep files. The Bicep files are transpiled into ARM JSON templates before they are stored. Currently, you can't import a Bicep file from the Azure portal to create a template spec resource.
10
+
A template spec is a resource type for storing an Azure Resource Manager template (ARM template) for later deployment. This resource type enables you to share ARM templates with other users in your organization. Just like any other Azure resource, you can use Azure role-based access control (Azure RBAC) to share the template spec. You can use Azure CLI or Azure PowerShell to create template specs by providing Bicep files. The Bicep files are transpiled into ARM JSON templates before they're stored. Currently, you can't import a Bicep file from the Azure portal to create a template spec resource.
11
11
12
12
[Microsoft.Resources/templateSpecs](/azure/templates/microsoft.resources/templatespecs) is the resource type for template specs. It consists of a main template and any number of linked templates. Azure securely stores template specs in resource groups. Both the main template and the linked templates must be in JSON. Template Specs support [versioning](#versioning).
13
13
@@ -29,6 +29,12 @@ When designing your deployment, always consider the lifecycle of the resources a
29
29
30
30
To learn more about template specs, and for hands-on guidance, see [Publish libraries of reusable infrastructure code by using template specs](/learn/modules/arm-template-specs).
31
31
32
+
## Required permissions
33
+
34
+
To create a template spec, you need **write** access to `Microsoft.Resources/templateSpecs` and `Microsoft.Resources/templateSpecs/versions`.
35
+
36
+
To deploy a template spec, you need **read** access to `Microsoft.Resources/templateSpecs` and `Microsoft.Resources/templateSpecs/versions`. You also need **write** access to any resources deployed by the template spec, and access to `Microsoft.Resources/deployments/*`.
37
+
32
38
## Why use template specs?
33
39
34
40
Template specs provide the following benefits:
@@ -150,7 +156,7 @@ The JSON template embedded in the Bicep file needs to make these changes:
150
156
* To access the parameters and variables defined in the Bicep file, you can directly use the parameter names and the variable names. To access the parameters and variables defined in `mainTemplate`, you still need to use the ARM JSON template syntax. For example, **'name': '[parameters(\'storageAccountType\')]'**.
151
157
* Use the Bicep syntax to call Bicep functions. For example, **'location': resourceGroup().location**.
152
158
153
-
The size of a template spec is limited to approximated 2 MB. If a template spec size exceeds the limit, you will get the **TemplateSpecTooLarge** error code. The error message says:
159
+
The size of a template spec is limited to approximated 2 MB. If a template spec size exceeds the limit, you'll get the **TemplateSpecTooLarge** error code. The error message says:
154
160
155
161
```error
156
162
The size of the template spec content exceeds the maximum limit. For large template specs with many artifacts, the recommended course of action is to split it into multiple template specs and reference them modularly via TemplateLinks.
@@ -325,7 +331,7 @@ When you create a template spec, you provide a version name for it. As you itera
325
331
326
332
## Use tags
327
333
328
-
[Tags](../management/tag-resources.md) help you logically organize your resources. You can add tags to template specs by using Azure PowerShell and Azure CLI:
334
+
[Tags](../management/tag-resources.md) help you logically organize your resources. You can add tags to template specs by using Azure PowerShell and Azure CLI. The following example shows how to specify tags when creating the template spec:
329
335
330
336
# [PowerShell](#tab/azure-powershell)
331
337
@@ -353,6 +359,8 @@ az ts create \
353
359
354
360
---
355
361
362
+
The next example shows how to apply tags when updating an existing template spec:
363
+
356
364
# [PowerShell](#tab/azure-powershell)
357
365
358
366
```azurepowershell
@@ -379,17 +387,15 @@ az ts update \
379
387
380
388
---
381
389
382
-
When creating or modifying a template spec with the version parameter specified, but without the tag/tags parameter:
383
-
384
-
* If the template spec exists and has tags, but the version doesn't exist, the new version inherits the same tags as the existing template spec.
385
-
386
-
When creating or modifying a template spec with both the tag/tags parameter and the version parameter specified:
387
-
388
-
* If both the template spec and the version don't exist, the tags are added to both the new template spec and the new version.
389
-
* If the template spec exists, but the version doesn't exist, the tags are only added to the new version.
390
-
* If both the template spec and the version exist, the tags only apply to the version.
390
+
Both the template and its versions can have tags. The tags are applied or inherited depending on the parameters you specify.
391
391
392
-
When modifying a template with the tag/tags parameter specified but without the version parameter specified, the tags is only added to the template spec.
392
+
| Template spec | Version | Version parameter | Tag parameter | Tag values |
0 commit comments