Creating a Virtual Network using Azure Resource Manager – Part 1

A few weeks ago I wondered why in the Azure Portal some of the resources where flagged as “classic”. The article Understanding Resource Manager deployment and classic deployment provided the answer I was looking for and was the start of an interesting journey into Azure Resource Manager.

If you haven’t heard of Azure Resource Manager yet, I highly recommend reading the Azure Resource Manager overview or watch the Introduction to Azure Resource Manager video available on Channel9 or Deep Dive into Azure Resource Manager Scenarios and Patterns on MVA.

Before I start with my tutorial, let’s make sure you have all the required tools available. Here’s what you need beside an Azure Subscription that allows you to deploy resources.

  • Azure PowerShell 1.0 or great, download and installation details can be found here
  • Microsoft Visual Studio Community edition (FREE), unless you prefer to create / edit JSON files in notepad. You can download VS2015 Community edition from here
  • Microsoft Azure SDK for .NET. You can download this from here (select VS2015).

 

Open Visual Studio 2015 and select New Project. then select VisualC# / Cloud / Azure Resource Group

2016-02-29_22h02_33

Next Select “Blank Template

2016-02-29_22h31_11

Next select the azuredeploy.json file.

2016-02-29_23h05_40

Select Resources, Add New Resource.

2016-02-29_22h32_24

Enter a name for the virtual network

2016-02-29_22h33_42

We now have a template file to deploy a virtual network using Azure Resource Manager.

2016-02-29_23h08_24

Next we add the following content into the parameters section

"vnetName": {
    "type": "string",
    "defaultValue": "VNet1",
    "metadata": {
      "description": "VNet name"
    }
  }

 

So now it should look as shown below.

image

and we replace the hardcoded names shown below with

image

with

"[parameters(‘vnetName’)]"

image

Now let’s deploy the Virtual network we just created using Visual Studio. From the Project Menu, select Deploy, New Deployment.

image

Select an existing Resource Group or create a new one. Optionally you can select “Edit parameters” , so that you can overwrite the default parameter value that is defined in the template file. For this demo, I edited the parameter and entered “vnetdemo” as the vnetname.

image

Next select “Deploy”  and wait for the deployment to complete.

image

Now let’s head over to the Azure Portal and see how things are there.

image

That’s it for today, In Part 2, we’ll take a closer look at using the parameter input file and how to run things directly with PowerShell.

Leave a Reply