Azure Template Specs - Part 2 - Scripting
Last time we explored Azure Template Specs from the user interface, today let’s check the PowerShell commandlets that will allow you to automate provisioning.
The bicep template
Bicep templates are becoming very popular1, so let’s use a template for a Storage Account. Same as on Part 1, this is a sample of an Azure Storage V22 which accepts 3 parameters storageAccountType, location and storageAccountName. All of the parameters have default values:
File: storage.bicep
| |
Create a Template Spec via scripting
Assuming we already have a Resource Group template-specs, available in Part 1, then we can run the following PowerShell3 or Azure CLI4:
| |
| |
Provisioning is straightforward. The resource is created on Resource Group.
Create a resource from a Template Spec via scripting
To be able to create any resource from the template spec, we need to retrieve the Template Spec Id:
| |
Then we can use it to provision the resource we need. Let’s change a default parameter as well:
| |
Azure Template Specs can help you to streamline your infrastructure management process, reduce errors, and improve collaboration among teams. Reusable components make IaC modular, organizing infrastructure as a software implementation.
Full Series
Azure Template Specs - Part 1 - Introduction
Azure Template Specs - Part 2 - Scripting

Join the conversation! Share your thoughts and connect with other readers.