ARM Template Specs now GA!

Published 05-31-2021 09:14 PM 5,000 Views
Microsoft

Azure Resource Manager (ARM) Template Specs

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.

  • Sharing: ensuring the right teams within your organization have access becomes very tedious as you cannot leverage Azure RBAC on the ARM templates you want to share.
  • Management: providing teams with the latest ARM templates in a consistent and versioned way. 

Why Template Specs?

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.

  • Sharing: Who can access a Template Spec can be defined using Azure RBAC.
  • Management: Template Specs can be versioned within the same resource, ensuring users can always access the latest iterations of an ARM template (or templates) stored in a Template Spec.

What’s New Since Public Preview?

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:

apclouds_20-1622519784302.png

What’s Coming Soon Post-GA?

  • Bicep integration: ‘az ts create’ with bicep files.
  • Built-in template specs support.
  • Support for
  • GA version of Azure CLI and PowerShell with breaking changes being released by end of May.
    • Due to the property renames highlighted above, you will see new property names when you GET a Template Spec version. This could be a breaking change if you are dependent on querying these properties in a script. This will not change how Template Specs are created or updated when using Azure Portal, Azure CLI, and PowerShell, but it will change how they are created via REST/ARM Templates/Bicep.
    • If you’d like to test the latest Az PowerShell cmdlets early, they are available in PowerShell Gallery

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

Creating and Deploying a Template Spec Resource

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.

Required properties:

  • --name: The name for the Template Spec resource.
  • --version: The version number or name of the version being created.
  • --location: The Azure region for the Template Spec resource.
  • --template-file: The ARM template to be packaged into a template spec.

 

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:

  1. Create main template (e.g. azuredeploy.json) that deploys linked templates, to be passed into the az ts create command as a template file.
  2. Create N number of deployment resources with linked templates referenced using the relativePath property within the templateLink object.apclouds_22-1622519784334.png

     

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:

  • ./linkedTemplates/storagelinkedTemplate.json
  • /linkedTemplates/storagelinkedTemplate.json
  • linkedTemplates/storagelinkedTemplate.json

 

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.

 

  1. Run the az ts create command to create or update a template spec version. This command packages the linked templates added via templateLink as linked templates in your Template Spec version.

     

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.

 

  1. Deploy the Template Spec by passing in its resource ID using the  az deployment group create command.

 

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.

Required properties:

  • --name: The name for the Template Spec resource
  • --version: The version number or name of the version being created.
  • --resource-group: The name of the resource group to be used for deployment.
  • --query: The property name to query for in the template spec object.

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 

Required properties:

  • --resource-group: The name of the resource group to be used for deployment.
  • --template-spec: The ID of the template spec resource to be deployed.

 

This command deploys the Template Spec and its linked templates into the specified resource group.

 

  1. Verify the contents of a Template Spec by running the az ts export command that downloads a specified Template Spec version into an --output-folder in your local file system.

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.

apclouds_28-1622519784350.png

 

 

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:

apclouds_29-1622519784375.png

 

References

%3CLINGO-SUB%20id%3D%22lingo-sub-2402618%22%20slang%3D%22en-US%22%3EARM%20Template%20Specs%20now%20GA!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2402618%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22toc-hId-1353941496%22%20id%3D%22toc-hId-1353941496%22%3EAzure%20Resource%20Manager%20(ARM)%20Template%20Specs%3C%2FH1%3E%0A%3CP%3ETemplate%20Specs%20is%20a%20new%20resource%20type%20for%20storing%20ARM%20templates%20in%20your%20resource%20groups%20for%20faster%20sharing%2C%20deployment%2C%20and%20role-based%20access%20control%20(RBAC)%20on%20those%20Templates%20shared%20within%20an%20organization.%20Template%20Specs%20addresses%20today's%20biggest%20challenges%20around%20ARM%20template%20management%2C%20storage%2C%20and%20access.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EThe%20Problem%3A%20%3C%2FSTRONG%3ESharing%20ARM%20templates%20across%20an%20organization%20is%20challenging%2C%20requiring%20more%20management%20steps%20of%20the%20external%20or%20internal%20storage%20from%20which%20they%20are%20shared.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ESharing%3A%20%3C%2FSTRONG%3Eensuring%20the%20right%20teams%20within%20your%20organization%20have%20access%20becomes%20very%20tedious%20as%20you%20cannot%20leverage%20Azure%20RBAC%20on%20the%20ARM%20templates%20you%20want%20to%20share.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EManagement%3A%20%3C%2FSTRONG%3Eproviding%20teams%20with%20the%20latest%20ARM%20templates%20in%20a%20consistent%20and%20versioned%20way.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-2044502970%22%20id%3D%22toc-hId-2044502970%22%3EWhy%20Template%20Specs%3F%3C%2FH2%3E%0A%3CP%3EAs%20a%20native%20solution%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-specs%3Ftabs%3Dazure-cli%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Specs%3C%2FA%3E%20will%20enable%20users%20to%20bring%20all%20their%20ARM%20templates%20to%20Azure%20as%20a%20resource%20and%20securely%20store%20and%20share%20them%20within%20an%20Azure%20tenant.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EThe%20Solution%3A%20%3C%2FSTRONG%3E1%3CSUP%3Est%3C%2FSUP%3E%20Party%20secure%20storage%20and%20management%20of%20ARM%20templates%20within%20Azure.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ESharing%3A%20%3C%2FSTRONG%3EWho%20can%20access%20a%20Template%20Spec%20can%20be%20defined%20using%20Azure%20RBAC.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EManagement%3A%20%3C%2FSTRONG%3ETemplate%20Specs%20can%20be%20versioned%20within%20the%20same%20resource%2C%20ensuring%20users%20can%20always%20access%20the%20latest%20iterations%20of%20an%20ARM%20template%20(or%20templates)%20stored%20in%20a%20Template%20Spec.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId-237048507%22%20id%3D%22toc-hId-237048507%22%3EWhat%E2%80%99s%20New%20Since%20Public%20Preview%3F%3C%2FH2%3E%0A%3CP%3ENew%20API%20version%202021-05-01.%20Thanks%20to%20all%20the%20customer%20feedback%20during%20our%20public%20preview%2C%20we%20were%20able%20to%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Ftemplate-specs%2Fissues%3Fq%3Dis%253Aissue%2Bis%253Aclosed%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eclose%203%20issues%3C%2FA%3E%2C%20fix%205%20bugs%2C%20and%20make%20the%20decision%20to%20change%20the%20names%20of%20the%20%E2%80%98template%E2%80%99%20and%20%E2%80%98artifacts%E2%80%99%20properties%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22apclouds_20-1622519784302.png%22%20style%3D%22width%3A%20595px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F285227i4F618FAEB645F7CC%2Fimage-dimensions%2F595x256%3Fv%3Dv2%22%20width%3D%22595%22%20height%3D%22256%22%20role%3D%22button%22%20title%3D%22apclouds_20-1622519784302.png%22%20alt%3D%22apclouds_20-1622519784302.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1570405956%22%20id%3D%22toc-hId--1570405956%22%3EWhat%E2%80%99s%20Coming%20Soon%20Post-GA%3F%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3EBicep%20integration%3A%20%E2%80%98az%20ts%20create%E2%80%99%20with%20bicep%20files.%3C%2FLI%3E%0A%3CLI%3EBuilt-in%20template%20specs%20support.%3C%2FLI%3E%0A%3CLI%3ESupport%20for%3C%2FLI%3E%0A%3CLI%3EGA%20version%20of%20Azure%20CLI%20and%20PowerShell%20with%20breaking%20changes%20being%20released%20by%20end%20of%20May.%3CUL%3E%0A%3CLI%3EDue%20to%20the%20property%20renames%20highlighted%20above%2C%20you%20will%20see%20new%20property%20names%20when%20you%20GET%20a%20Template%20Spec%20version.%20This%20could%20be%20a%20breaking%20change%20if%20you%20are%20dependent%20on%20querying%20these%20properties%20in%20a%20script.%20This%20will%20not%20change%20how%20Template%20Specs%20are%20created%20or%20updated%20when%20using%20Azure%20Portal%2C%20Azure%20CLI%2C%20and%20PowerShell%2C%20but%20it%20will%20change%20how%20they%20are%20created%20via%20REST%2FARM%20Templates%2FBicep.%3C%2FLI%3E%0A%3CLI%3EIf%20you%E2%80%99d%20like%20to%20test%20the%20latest%20Az%20PowerShell%20cmdlets%20early%2C%20they%20are%20available%20in%20%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fwww.powershellgallery.com%252Fpackages%252FAz.Resources%252F3.5.1-preview%26amp%3Bdata%3D04%257C01%257CGokul.Premraj%2540microsoft.com%257C09e6ad0ddff64beff66a08d90ed8b644%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637557146219288644%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3Dnxz7r15TPWmwtvyA%252BzEmBN1R%252FsSW%252FcJBB2rLaImwX5k%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EPowerShell%20Gallery%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3ETemplate%20Spec%20Reference%20and%20Docs%3A%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-specs%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20specs%20overview%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-specs-create-linked%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ECreate%20a%20template%20spec%20with%20linked%20templates%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Ftemplate-specs-deploy-linked-template%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20a%20template%20spec%20as%20a%20linked%20template%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Flinked-templates%3Ftabs%3Dazure-powershell%23use-relative-path-for-linked-templates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELink%20templates%20for%20deployment%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Fconvert-to-template-spec%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EConvert%20portal%20template%20to%20template%20spec%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%20%26nbsp%3BTemplate%20Specs%20can%20be%20created%20with%20an%20ARM%20template%2C%20but%20we%20strongly%20recommend%20using%20Portal%2C%20PowerShell%20or%20CLI%20for%20creating%20Template%20Specs.%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Ftemplates%2Fmicrosoft.resources%2Ftemplatespecs%2Fversions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft.Resources%2FtemplateSpecs%2Fversions%20-%20ARM%20template%20reference%20%7C%20Microsoft%20Docs%3C%2FA%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-917106877%22%20id%3D%22toc-hId-917106877%22%3ECreating%20and%20Deploying%20a%20Template%20Spec%20Resource%3C%2FH2%3E%0A%3CP%3EA%20Template%20Spec%20is%20a%20resource%20that%20contains%20an%20array%20of%20Template%20Spec%20versions%20which%20consists%20of%20a%20%3CSTRONG%3Eroot%20template%20and%20any%20number%20of%20linked%20templates%3C%2FSTRONG%3E.%20A%20Template%20Spec%20can%20be%20created%20using%20the%20Portal%2C%20PowerShell%2C%20Azure%20CLI%2C%20REST%20API%2C%20or%20ARM%20Template.%20To%20help%20visualize%20a%20Template%20Spec%20create%2C%20here%20are%20some%20examples%20of%20what%20it%20would%20look%20like%20in%20the%20Azure%20CLI%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECreating%20a%20Template%20Spec%20using%20Azure%20CLI%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20Template%20Spec%2C%20use%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fts%3Fview%3Dazure-cli-latest%23az_ts_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20ts%20create%3C%2FSTRONG%3E%3C%2FA%3E%20command%20to%20package%20an%20ARM%20into%20the%20Template%20Spec%20resource.%3C%2FP%3E%0A%3CP%3ERequired%20properties%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E--name%3A%20The%20name%20for%20the%20Template%20Spec%20resource.%3C%2FLI%3E%0A%3CLI%3E--version%3A%20The%20version%20number%20or%20name%20of%20the%20version%20being%20created.%3C%2FLI%3E%0A%3CLI%3E--location%3A%20The%20Azure%20region%20for%20the%20Template%20Spec%20resource.%3C%2FLI%3E%0A%3CLI%3E--template-file%3A%20The%20ARM%20template%20to%20be%20packaged%20into%20a%20template%20spec.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ECreating%20and%20Deploying%20a%20Template%20Spec%20with%20Linked%20Templates%20using%20Azure%20CLI%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20Template%20Spec%20with%20linked%20templates%20inside%20it%2C%20we%20need%20the%20following%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ECreate%20main%20template%20(e.g.%20%3CEM%3Eazuredeploy.json%3C%2FEM%3E)%20that%20deploys%20linked%20templates%2C%20to%20be%20passed%20into%20the%20%3CSTRONG%3Eaz%20ts%20create%3C%2FSTRONG%3E%20command%20as%20a%20template%20file.%3C%2FLI%3E%0A%3CLI%3ECreate%20N%20number%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Ftemplates%2Fmicrosoft.resources%2Fdeployments%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Edeployment%20resources%3C%2FA%3E%20with%20linked%20templates%20referenced%20using%20the%20%3CSTRONG%3ErelativePath%3C%2FSTRONG%3E%20property%20within%20the%20%3CSTRONG%3EtemplateLink%3C%2FSTRONG%3E%20object.%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22apclouds_22-1622519784334.png%22%20style%3D%22width%3A%20471px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F285228i405D673CB9D36EC9%2Fimage-dimensions%2F471x371%3Fv%3Dv2%22%20width%3D%22471%22%20height%3D%22371%22%20role%3D%22button%22%20title%3D%22apclouds_22-1622519784334.png%22%20alt%3D%22apclouds_22-1622519784334.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EIn%20this%20example%20the%20linked%20templates%20are%20stored%20in%20a%20subfolder%20called%20%3CSTRONG%3ElinkedTemplates%3C%2FSTRONG%3E%2C%20which%20is%20in%20the%20same%20path%20as%20the%20main%20template%20file.%20The%20relativePath%20property%20is%20relative%20to%20the%20template%20file%20where%20relativePath%20is%20declared.%20The%20relativePath%20property%20can%20take%20any%20of%20the%20following%20values%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E.%2FlinkedTemplates%2FstoragelinkedTemplate.json%3C%2FLI%3E%0A%3CLI%3E%2FlinkedTemplates%2FstoragelinkedTemplate.json%3C%2FLI%3E%0A%3CLI%3ElinkedTemplates%2FstoragelinkedTemplate.json%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20relativePath%20can%20also%20be%20used%20deploy%20remote%20linked%20templates%20given%20all%20template%20files%20are%20staged%20together%20and%20available%20via%20remote%20URI%2C%20such%20as%20GitHub%20or%20Azure%20storage.%20The%20main%20template%20is%20called%20by%20using%20URI%20and%20all%20linked%20templates%20referenced%20as%20relative%20to%20that%20main%20template%20will%20have%20a%20URI%20constructed%20using%20the%20main%20template%20URI%20and%20the%20relativePath%20specified.%20This%20feature%20requires%20api%20version%202020-10-01%20or%20greater.%20To%20learn%20more%20about%20this%20feature%2C%20please%20refer%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Flinked-templates%3Ftabs%3Dazure-powershell%23use-relative-path-for-linked-templates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELink%20templates%20for%20deployment%20-%20Azure%20Resource%20Manager%20%7C%20Microsoft%20Docs%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3ERun%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fts%3Fview%3Dazure-cli-latest%23az_ts_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20ts%20create%3C%2FSTRONG%3E%3C%2FA%3E%20command%20to%20create%20or%20update%20a%20template%20spec%20version.%20This%20command%20packages%20the%20linked%20templates%20added%20via%20templateLink%20as%20linked%20templates%20in%20your%20Template%20Spec%20version.%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThis%20command%20packages%20the%20template%20file%20azuredeploy.json%20into%20the%20main%20template%20of%20the%20Template%20Spec%20version%20webAppSpec-1.0%20and%20all%20linked%20templates%20specified%20into%20the%20linkedTemplates%5B%5D%20array%20of%20the%20Template%20Spec%20object.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3EDeploy%20the%20Template%20Spec%20by%20passing%20in%20its%20resource%20ID%20using%20the%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fdeployment%2Fgroup%3Fview%3Dazure-cli-latest%23az_deployment_group_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20deployment%20group%20create%3C%2FSTRONG%3E%3C%2FA%3E%20command.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20we%20need%20to%20get%20the%20ID%20of%20the%20Template%20Spec%20resource%20created%2C%20and%20this%20can%20be%20done%20easily%20in%20the%20Azure%20CLI%20by%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fts%3Fview%3Dazure-cli-latest%23az_ts_show%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20ts%20show%3C%2FSTRONG%3E%3C%2FA%3E%20command.%3C%2FP%3E%0A%3CP%3ERequired%20properties%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E--name%3A%20The%20name%20for%20the%20Template%20Spec%20resource%3C%2FLI%3E%0A%3CLI%3E--version%3A%20The%20version%20number%20or%20name%20of%20the%20version%20being%20created.%3C%2FLI%3E%0A%3CLI%3E--resource-group%3A%20The%20name%20of%20the%20resource%20group%20to%20be%20used%20for%20deployment.%3C%2FLI%3E%0A%3CLI%3E--query%3A%20The%20property%20name%20to%20query%20for%20in%20the%20template%20spec%20object.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAfter%20storing%20the%20resource%20ID%20of%20the%20template%20spec%20into%20a%20variable%2C%20run%20the%20command%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fdeployment%2Fgroup%3Fview%3Dazure-cli-latest%23az_deployment_group_create%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20deployment%20group%20create%3C%2FSTRONG%3E%3C%2FA%3E%20and%20pass%20in%20the%20variable%20into%20the%20%3CSTRONG%3E--template-spec%3C%2FSTRONG%3E%20parameter%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERequired%20properties%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E--resource-group%3A%20The%20name%20of%20the%20resource%20group%20to%20be%20used%20for%20deployment.%3C%2FLI%3E%0A%3CLI%3E--template-spec%3A%20The%20ID%20of%20the%20template%20spec%20resource%20to%20be%20deployed.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20command%20deploys%20the%20Template%20Spec%20and%20its%20linked%20templates%20into%20the%20specified%20resource%20group.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%225%22%3E%0A%3CLI%3EVerify%20the%20contents%20of%20a%20Template%20Spec%20by%20running%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fts%3Fview%3Dazure-cli-latest%23az_ts_export%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E%3CSTRONG%3Eaz%20ts%20export%3C%2FSTRONG%3E%3C%2FA%3E%20command%20that%20downloads%20a%20specified%20Template%20Spec%20version%20into%20an%20%3CSTRONG%3E--output-folder%3C%2FSTRONG%3E%20in%20your%20local%20file%20system.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThis%20command%20exports%20the%20specified%20Template%20Spec%E2%80%99s%20main%20template%20(e.g.%20webAppSpec.JSON)%20and%20a%20linked%20templates%20folder%20with%20all%20its%20corresponding%20linked%20templates.%20The%20contents%20of%20a%20Template%20Spec%20version%20can%20also%20be%20seen%20using%20the%20Azure%20Portal.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22apclouds_28-1622519784350.png%22%20style%3D%22width%3A%20522px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F285234i3B74D3A1B38D6E30%2Fimage-dimensions%2F522x241%3Fv%3Dv2%22%20width%3D%22522%22%20height%3D%22241%22%20role%3D%22button%22%20title%3D%22apclouds_28-1622519784350.png%22%20alt%3D%22apclouds_28-1622519784350.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EDeploying%20a%20Template%20Spec%20as%20Linked%20Template%20using%20ARM%20Template%20with%20ID%20Reference%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EA%20Template%20Spec%20resource%20can%20also%20be%20referenced%20using%20the%20%3CSTRONG%3EtemplateLink%3C%2FSTRONG%3E%20property%20and%20specifying%20the%20%3CSTRONG%3Eid%3C%2FSTRONG%3E%20of%20the%20template%20spec%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22apclouds_29-1622519784375.png%22%20style%3D%22width%3A%20518px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F285235iE39CFC779B3517BF%2Fimage-dimensions%2F518x346%3Fv%3Dv2%22%20width%3D%22518%22%20height%3D%22346%22%20role%3D%22button%22%20title%3D%22apclouds_29-1622519784375.png%22%20alt%3D%22apclouds_29-1622519784375.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--890347586%22%20id%3D%22toc-hId--890347586%22%3EReferences%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcli%2Fazure%2Fts%3Fview%3Dazure-cli-latest%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Spec%20CLI%20reference%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Ftemplates%2Fmicrosoft.resources%2Ftemplatespecs%2Fversions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Spec%20ARM%20reference%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Faz.resources%2F%3Fview%3Dazps-5.4.0%23resources%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Spec%20PowerShell%20reference%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Frest%2Fapi%2Fresources%2Ftemplatespecversions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Spec%20REST%20API%20reference%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-resource-manager%2Ftemplates%2Fquickstart-create-template-specs%3Ftabs%3Dazure-powershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETemplate%20Spec%20Quick%20Start%20Tutorial%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2402618%22%20slang%3D%22en-US%22%3E%3CDIV%3E%0A%3CDIV%3E%3CSPAN%3ETemplate%26nbsp%3BSpecs%26nbsp%3Bis%26nbsp%3Ba%26nbsp%3Bnew%26nbsp%3Bresource%26nbsp%3Btype%26nbsp%3Bfor%26nbsp%3Bstoring%26nbsp%3BARM%26nbsp%3Btemplates%26nbsp%3Bin%26nbsp%3Byour%26nbsp%3Bresource%26nbsp%3Bgroups%26nbsp%3Bfor%26nbsp%3Bfaster%26nbsp%3Bsharing%2C%26nbsp%3Bdeployment%2C%26nbsp%3Band%26nbsp%3Brole-based%26nbsp%3Baccess%26nbsp%3Bcontrol%26nbsp%3B(RBAC)%26nbsp%3Bon%26nbsp%3Bthose%26nbsp%3BTemplates%26nbsp%3Bshared%26nbsp%3Bwithin%26nbsp%3Ban%26nbsp%3Borganization.%26nbsp%3BTemplate%26nbsp%3BSpecs%26nbsp%3Baddresses%26nbsp%3Btoday's%26nbsp%3Bbiggest%26nbsp%3Bchallenges%26nbsp%3Baround%26nbsp%3BARM%26nbsp%3Btemplate%26nbsp%3Bmanagement%2C%26nbsp%3Bstorage%2C%26nbsp%3Band%26nbsp%3Baccess.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-TEASER%3E
Co-Authors
Version history
Last update:
‎May 31 2021 09:14 PM
Updated by: