This is Part 2 of a Blog Post Series:
- Part 1 – Introduction/Pre-Requirements
- Part 2 – Export ARM Template from Azure Portal
- Part 3 – Use QuickStart Template in Visual Studio Code
- Part 4 – Use Azure CLI to deploy your Azure Template.
Generate ARM Template using Azure Portal
In this post we will see how to generate a Resource Manager template for a Storage Account using the Azure portal, and the process of editing and deploying the template from the portal.
As explained in the first post of this series, Resource Manager templates are JSON files that define the resources you need to deploy for your solution.
First thing to do is to sign in the Azure Portal and Select Create a resource > Storage > Storage account
Then enter the required information (Resource Group, Storage Account Name and Location)
Then move directly to the Review + create Tab and select Download a template for automation on the bottom of the screen. The portal shows the generated template that can be downloaded
Select Download from the top of the screen and you will have a ZIP file with 6 different files. The required ones are template.json and parameters.json
Modify the ARM Template
Now that you have your template.json downloaded you can open it in Visual Studio Code. the JSON schema is exactly what we saw in the Part 1 of this blog series.
Even if we are able to deploy the template as we downloaded it, we will change the name of the Storage Account and the location to be automatically calculated and not passed as parameter: to do this, we need to remove the StorageAccountName and Location parameters from the JSON and add them as variables.
So we are moving from this:
to this making Location and Storage Account name dependent from the Resource Group ID and location where the Storage Account is deployed into.
We have now our final ARM Template ready to be deployed in the Part 4 of this blog series