Skip to main content

Provisioning Resources with ARM Templates-Azure

Hands-On Lab

 

Photo of

Training Architect

Length

00:30:00

Difficulty

Intermediate

In this hands-on lab, you will learn how to create a storage account using an ARM template. An ARM template is useful because you can deploy resources as many times as necessary. You can also reuse templates or modify them to include multiple resources in the same template.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Provisioning Resources with ARM Templates-Azure

In this lab, we will create multiple temporary storage accounts for a large corporation. We will be creating a solution that can standardize the process. Remember, we are not creating the storage account in the Azure Portal, but downloading the template so we can modify it later.

Before We Begin

Before we can get started, we need to log into our Azure portal using the provided credentials.

Create a Storage Account and Download the Template

Once logged into the portal, we need to create our storage account. To do so, select Create a resource in the top left corner. Here, select Storage, then Storage account.

On the Create storage account page, set the Subscription and Resource group to the already existing ones. For the storage account's name, enter <your name>storage and today's date in <MMDDYYYY>. For example, our name is Gary McLeary and it is October 31st, 2019. We would enter garymclearystorage10312019. Leave everything else as the default.

Once everything is set, click the Review + Create tab to review the information, and then select Create.

On the next page, do not click Create. Instead, select Download a template for automation. Next, click Download. Save this file to our desktop for later use.

Edit the Template

With our template ready, go back to the Azure portal and select Create a resource again. This time, in the Search the Marketplace box, type in template deployment and then press ENTER. From the options, select Template deployment and then Create.

Here, we are given the option Build your own template in the editor. Select this option. On this page, load the file we saved. The template is populated with the information from the template. In this information, we need to find and remove the storageAccountName parameter.

Now, under the "variables" section, we need to add a new variable called StorageAccountName. This is the information that we need to enter for the variable:

"StorageAccountName": "[concat(uniquestring(subscription().subscriptionid), 'storage')]"

Then, in the "name" section for "resources", change it to:

"name": "[variables('storageAccountName')]"

Once we have everything entered, select Save.

Deploy the Template

With our template edited and ready, we can deploy our template. To get started, we need to set the Subscription to the default, the Resource group to the already created group, and the Location to (US) West US.

In the SETTINGS section, we need to fill it out as follows:

  • Location: West US
  • Account Type: Standard_LRS
  • Kind: StorageV2
  • Access Tier: Hot
  • Supports Https Traffic Only: True

Once we're done filling everything out, click on the checkbox Agree to the terms and conditions then select Purchase.

At the top of the page, we see a notification. Select the notification. We will either see Deployment in progress... or Deployment successful. Here, select Go to resource group. On the page we're taken to, we see the storage account that we deployed.

Conclusion

Upon completing this lab, we are now able to create a storage account to store our template, and then edit and deploy that template. Congratulations on finishing the lab!