By mow you already know you can use ARM (Azure Resource Manager) templates to deploy resources on Azure in automated and consistent way.
Well, you can now define template specs, a new resource type for storing Azure template for future use.
This also allows you sharing templates with other users in your organization, fixing known issues and challenges when your templates are save in GitHub repo or storage account which requires to have public access to the repo or storage account (not really secure as you can imagine).
The new resource type is identified with Microsoft.Resources/templateSpecs.
To be able to use Azure ARM template specs you need to do the following:
New-AzTemplateSpec –Name <name of your spec> -Version 1.0 –ResourceGroupName <resource group to save the spec –TemplateJsonFile <path to your ARM template JSON file>
$id = “/subscriptions/<ID of your subscription>/resourceGroups/<resource group where your spec is saved>/providers/Microsoft.Resources/templateSpecs/storageSpec/versions/1.0”
New-AzResourceGroupDeployment -TemplateSpecId $id –ResourceGroupName <resource group where you deploy the spec>
or you can also get the $id using the below
$id = (Get-AzTemplateSpec –Name <name of your spec –ResourceGroupName <resource group where your template is saved> -Version 1.0).Version.Id