Azure – Define ARM templates specs (preview)

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:

  • First create your JSON file defining your template (obviously Winking smile)
  • Then create the template spec using the PowerShell command

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>

  • You can then deploy the spec using the below command

$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

  • Then you just need to grant access to the resource group where you have deployed your specs to any users/groups which will use it
Benoit Hamet
Benoit Hamet
Benoit is working on Microsoft collaborative technologies He has been awarded as MVP for more than 12 years Currently MVP on Office 365 after being awarded on SharePoint (2011-2012) and Windows client & server (2002-2007) Speaker at various Microsoft events (TechDays, TechNet seminars) and Quest Software He works on on-premises (Active Directory, RADIUS/NPS, Exchange, Skype for Business, SharePoint, SQL, Terminal Server, Windows client and Windows Server) or online (Azure, Intune, Office 365, Exchange Online, SharePoint Online, Skype for Business Online, Teams) technologies