A template spec is a resource type for storing an Azure Resource Manager template (ARM template) in Azure 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.
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. Template Specs support versioning.
To deploy the template spec, you use standard Azure tools like PowerShell, Azure CLI, Azure portal, REST, and other supported SDKs and clients. You use the same commands as you would for the template.
When starting from a template: select one of the campaign template tabs or the 'My Campaigns' tab. Then locate the template you want to build on. Clicking the template will show you a preview of the template. Click the Select button to get started. When starting from scratch: on the 'Blank Email' tab, click the Start Editing button to get started.
To use template spec with Azure PowerShell, you must install version 5.0.0 or later. To use it with Azure CLI, use version 2.14.2 or later.
- An About Us slide tells clients all about you and your business. You want to make a good first impression, and an About Us slide is critical for building customer trust and loyalty. Your slide should highlight the story of your business, products or services you offer, your mission and vision, and how your company differs from the competition.
- An About Us page helps your company make a good first impression, and is critical for building customer trust and loyalty. Which is why we've created this free, easy-to-use tool that lets you instantly generate a custom About Us page for your store. Once your content is generated, you’ll be able to tweak and customize it until it's just right.
Why use template specs?
Template specs provide the following benefits:
- You use standard ARM templates for your template spec.
- You manage access through Azure RBAC, rather than SAS tokens.
- Users can deploy the template spec without having write access to the template.
- You can integrate the template spec into existing deployment process, such as PowerShell script or DevOps pipeline.
Template specs enable you to create canonical templates and share them with teams in your organization. The template specs are secure because they're available to Azure Resource Manager for deployment, but not accessible to users without the correct permission. Users only need read access to the template spec to deploy its template, so you can share the template without allowing others to modify it.
If you currently have your templates in a GitHub repo or storage account, you run into several challenges when trying to share and use the templates. To deploy the template, you need to either make the template publicly accessible or manage access with SAS tokens. To get around this limitation, users might create local copies, which eventually diverge from your original template. Template specs simplify sharing templates.
The templates you include in a template spec should be verified by administrators in your organization to follow the organization's requirements and guidance.
Create template spec
The following example shows a simple template for creating a storage account in Azure.
When you create the template spec, the PowerShell or CLI commands are passed the main template file. If the main template references linked templates, the commands will find and package them to create the template spec. To learn more, see Create a template spec with linked templates.
Create a template spec by using:
You can view all template specs in your subscription by using:
You can view details of a template spec, including its versions with:
Template For About Us
Deploy template spec
After you've created the template spec, users with read access to the template spec can deploy it. For information about granting access, see Tutorial: Grant a group access to Azure resources using Azure PowerShell.
Template specs can be deployed through the portal, PowerShell, Azure CLI, or as a linked template in a larger template deployment. Users in an organization can deploy a template spec to any scope in Azure (resource group, subscription, management group, or tenant).
Instead of passing in a path or URI for a template, you deploy a template spec by providing its resource ID. The resource ID has the following format:
Notice that the resource ID includes a version name for the template spec.
For example, you deploy a template spec with the following command.
In practice, you'll typically run
az ts show to get the ID of the template spec you want to deploy.
You can also open a URL in the following format to deploy a template spec:
Passing in parameters to template spec is exactly like passing parameters to an ARM template. Add the parameter values either inline or in a parameter file.
To pass a parameter inline, use:
To create a local parameter file, use:
And, pass that parameter file with:
When you create a template spec, you provide a version name for it. As you iterate on the template code, you can either update an existing version (for hotfixes) or publish a new version. The version is a text string. You can choose to follow any versioning system, including semantic versioning. Users of the template spec can provide the version name they want to use when deploying it.
Tags help you logically organize your resources. You can add tags to template specs by using Azure PowerShell and Azure CLI:
When creating or modifying a template spec with the version parameter specified, but without the tag/tags parameter:
- 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.
When creating or modifying a template spec with both the tag/tags parameter and the version parameter specified:
- 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.
- If the template spec exists, but the version doesn't exist, the tags are only added to the new version.
- If both the template spec and the version exist, the tags only apply to the version.
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.
Create a template spec with linked templates
If the main template for your template spec references linked templates, the PowerShell and CLI commands can automatically find and package the linked templates from your local drive. You don't need to manually configure storage accounts or repositories to host the template specs - everything is self-contained in the template spec resource.
The following example consists of a main template with two linked templates. The example is only an excerpt of the template. Notice that it uses a property named
relativePath to link to the other templates. You must use
2020-06-01 or later for the deployments resource.
When the PowerShell or CLI command to create the template spec is executed for the preceding example, the command finds three files - the main template, the web app template (
webapp.json), and the database template (
database.json) - and packages them into the template spec.
For more information, see Tutorial: Create a template spec with linked templates.
Deploy template spec as a linked template
Once you've created a template spec, it's easy to reuse it from an ARM template or another template spec. You link to a template spec by adding its resource ID to your template. The linked template spec is automatically deployed when you deploy the main template. This behavior lets you develop modular template specs, and reuse them as needed.
For example, you can create a template spec that deploys networking resources, and another template spec that deploys storage resources. In ARM templates, you link to these two template specs anytime you need to configure networking or storage resources.
Template Of About Us
The following example is similar to the earlier example, but you use the
id property to link to a template spec rather than the
relativePath property to link to a local template. Use
2020-06-01 for API version for the deployments resource. In the example, the template specs are in a resource group named templateSpecsRG.
For more information about linking template specs, see Tutorial: Deploy a template spec as a linked template.
Template About Us Html
Ecommerce About Us Template
To create and deploy a template spec, see Quickstart: Create and deploy template spec.
For more information about linking templates in template specs, see Tutorial: Create a template spec with linked templates.
For more information about deploying a template spec as a linked template, see Tutorial: Deploy a template spec as a linked template.