Template Specs is a new resource type for storing ARM templates in your resource groups for faster sharing, deployment, and role-based access control (RBAC) on those Templates shared within an organization. Template Specs addresses today's biggest challenges around ARM template management, storage, and access.
The Problem: Sharing ARM templates across an organization is challenging, requiring more management steps of the external or internal storage from which they are shared.
As a native solution, Template Specs will enable users to bring all their ARM templates to Azure as a resource and securely store and share them within an Azure tenant.
The Solution: 1st Party secure storage and management of ARM templates within Azure.
New API version 2021-05-01. Thanks to all the customer feedback during our public preview, we were able to close 3 issues, fix 5 bugs, and make the decision to change the names of the ‘template’ and ‘artifacts’ properties:
Template Spec Reference and Docs:
Note: Template Specs can be created with an ARM template, but we strongly recommend using Portal, PowerShell or CLI for creating Template Specs. Microsoft.Resources/templateSpecs/versions - ARM template reference | Microsoft Docs
A Template Spec is a resource that contains an array of Template Spec versions which consists of a root template and any number of linked templates. A Template Spec can be created using the Portal, PowerShell, Azure CLI, REST API, or ARM Template. To help visualize a Template Spec create, here are some examples of what it would look like in the Azure CLI:
Creating a Template Spec using Azure CLI
To create a Template Spec, use the az ts create command to package an ARM into the Template Spec resource.
Creating and Deploying a Template Spec with Linked Templates using Azure CLI
To create a Template Spec with linked templates inside it, we need the following:
In this example the linked templates are stored in a subfolder called linkedTemplates, which is in the same path as the main template file. The relativePath property is relative to the template file where relativePath is declared. The relativePath property can take any of the following values:
Note: relativePath can also be used deploy remote linked templates given all template files are staged together and available via remote URI, such as GitHub or Azure storage. The main template is called by using URI and all linked templates referenced as relative to that main template will have a URI constructed using the main template URI and the relativePath specified. This feature requires api version 2020-10-01 or greater. To learn more about this feature, please refer to Link templates for deployment - Azure Resource Manager | Microsoft Docs.
This command packages the template file azuredeploy.json into the main template of the Template Spec version webAppSpec-1.0 and all linked templates specified into the linkedTemplates array of the Template Spec object.
First, we need to get the ID of the Template Spec resource created, and this can be done easily in the Azure CLI by using the az ts show command.
After storing the resource ID of the template spec into a variable, run the command az deployment group create and pass in the variable into the --template-spec parameter
This command deploys the Template Spec and its linked templates into the specified resource group.
This command exports the specified Template Spec’s main template (e.g. webAppSpec.JSON) and a linked templates folder with all its corresponding linked templates. The contents of a Template Spec version can also be seen using the Azure Portal.
Deploying a Template Spec as Linked Template using ARM Template with ID Reference
A Template Spec resource can also be referenced using the templateLink property and specifying the id of the template spec:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.