In the past I always deployed with Powershell, with the new Azure Resource Manager I started to investigate deploying with Visual Studio.
To start building your projects in Visual Studio, you’ll need the following:
- Visual Studio (I’ll use the Enterprise 2015 version)
- Microsoft Azure Tools for Visual Studio
So where to start now I have all of the software needed? Well, Visual Studio has different project templates, so let’s start with one. I used the “Azure Resource Group – Windows Server Virtual Machines with Loadbalancer”.
Visual Studio will now create the project, when it is created you will see a Powershell script (Deploy-AzureResourceGroup.ps1), 2 json files (LoadBalancedVirtualMachine.json & LoadBalancedVirtualMachine.parameters.json) and AzCopy.exe.
The Powershell script uploads all the files needed for the deployment and deploys it, the JSON file LoadBalancedVirtualMachine.json is the template and the file LoadBalancedVirtualMachine.parameters.json contains the parameters you’ll enter before the deploy starts. AzCopy copies the files for DSC to the Azure Storage account.
Great, so now we have a JSON. But this ‘just’ deploys a StorageAccount, AvailabilitySet, VNET with 1 subnet, 2 NetworkInterfaces, 1 LoadBalancer and 2 VirtualMachines. Nice, but understand how the JSON is built, what is in it, how it works and I would like to extend it.
As I work at a large ISP, I just took a design of a customer to build in Azure. The design consists of a firewall cluster, a web frontend and a database cluster in the backend.
Extending the VNET with extra subnets wasn’t that hard. An extra AvailabilitySet was also a piece of cake. Getting the LoadBalancer, NetworkInterfaces and Subnets to work was a little bit more tricky, as you need to keep everything in sync between those. After having those in place putting the backend servers in the script wasn’t that hard.
During the first few deployment, I received different errors. All of them regarding to the LoadBalancer, NetworkInterfaces and Subnets, because of mixing up some stuff there. Stuff I mixed up had to do with: attaching NetworkInterfaces to wrong BackendPools, linked LoadBalancers to other Subnets then the NetworkInterfaces, etc.
Finaly, my first deployment with Visual Studio
Tips, Tricks & Links
- If you would like to know what the Powershell script included in the Visual Studio project template does (like me). After some Googling around I found the complete documentation of it on the Microsoft website: https://azure.microsoft.com/en-us/documentation/articles/vs-azure-tools-resource-groups-how-script-works/
- Keep an eye on the red underlined words in Visual Studio. The red underlined words indicates that the parameter / variable is missing.
- If you do not know how to build a resource, try to search for a template at the official repository at GitHub: https://github.com/Azure/azure-quickstart-templates/
- Keep calm and drink some tea (or coffee)