In this article we will learn how to create an Azure Resource (Storage Account) from scratch without using any built in templates.

Here are the steps:

Open Visual Studio (I’m using Visual Studio 2013) and create a New Project, select Cloud, then click Azure Resource Group.

Once you click OK in the previous step, Visual Studio displays all the available templates as shown below.

Now, select “Blank Template” and click on “OK”.

Visual Studio will create a couple of files which are described in my previous article.

In the left hand side of the azuredeply.json in Visual Studio, you will see a window with the title “JSON OutLine” which could be used to navigate across the ARM .JSON template file.

Expand the JSON Outline window and right click on “resources” element and select “Add New Resource”.

Clicking on the “Add New Resource” will open a new popup which displays the list of all resources which could be created using ARM template as shown below.

For this article, I have selected “Storage Account” as shown above. Now, provide a valid name and click on “Add” button.

As shown in the above screen capture, Visual Studio has created the following items that are required for creating the new resource “Storage Account”.

  • A New Parameter named “armstorageaccountType” in the “parameters” node.
  • A new Variable named “armstorageaccountname” in the “variables” node
  • A new resource in the “resources” node.

Replace the following line of code (I will explain the reason in the upcoming article)

“armstorageaccountName”: “[concat(‘armstorageaccount’, uniqueString(resourceGroup().id))]”

With the following:

The updated view of the JSON template should be something like this.

The updated ARM template file has a good amount of JSON now. I will explain about all the nodes in my next article.

OK, let’s deploy the file to Azure by right clicking on the project and selecting  “Deploy” -> “New Deployment”

Currently there are no resource groups in my subscription. Let’s create a new Resource Group by clicking on “<Create New…>” in the “Resource group” dropdown.

Please provide a name for the new Resource Group in the “Resource group name:” field and also select a location in the “Resource group location” as shown in the above screen shot. Before clicking on the “Create” button, go to “Resource Groups” tab in the Azure Management Portal as shown below.

Currently, there are no resource groups in my subscription and so the above list is empty. Let’s go and click on “Create” button in the Visual Studio.

Clicking on the “Create” button has created the new Resource Group in the selected location as shown below.

Now, click on the “Deploy” button of the “Deploy to Resource Group” window as shown below in the below screen capture.

Below is the screen capture of the “Output” window of the Visual Studio.

That’s it, the storage account named “armstorageaccount” is now successfully created using the ARM template.

You can reuse this ARM template in any of your environments.