# Azure: deployment using templates

The goal here is to get from an Azure subscription with no VMs etc, to a working VM to which we can immediately RDP and use.

Repeating some of the steps taking you from a bare (Windows) client machine to the working VM

• Install-Module AzureRM (Windows client)
• Set-AzureRmContext (vital for me as I have 2 subscriptions),
e.g. Set-AzureRmContext -SubscriptionName “Visual Studio Ultimate with MSDN”

Find this file (temp/templates / ref2.json) on Github and save it to your working location. It will be referenced in the next command. (I know it all needs tidying up)

Create a resource group by executing this command in a PowerShell admin prompt (altering Name and Location as you wish).

New-AzureRmResourceGroup -Name DWRG -Location "UK South"

Execute this command in a PowerShell admin prompt, which will generate your VM (with an assumption that [ref2.json] is in the current folder), and the supporting structure. It will still prompt for the admin password for the VM(s). Note that the storageAccountName value must be lower case.

New-AzureRmResourceGroupDeployment -Name DWDeploy -ResourceGroupName
DWRG -TemplateFile .\ref2.json -storageAccountName "dwstorage"
-virtualNetworkName "DWVnn" -networkInterfaceName "DWNin"


And this is the kind of output you can expect:

And finally proof I can jump onto that Windows Server 2012.

I intend to reduce the content of the ref2.json file to the bare minimum to get a set of VMs. I have already removed the load balancer references (this is just for functional testing purposes), and will remove the availability set references once I work out the dependencies.