The Visual Studio Azure Resource Group project allows developers to create and debug resources in Azure using the Azure Resource management templates. Included as part of the project is a PowerShell script that allows easy deployment with minimal work. With the advent of Azure DevTest labs and the benefits of using DevTest Labs how does one go about using all the excellent capabilities in Visual Studio within an Azure DevTest lab. Having the definition of the test machine that can be deployed, in the same Visual studio solution as the product being developed allows for a more consistent and effective environment. In this document the focus will be on using Visual Studio to deploy a DevTest Lab virtual machine. In Part 2 the focus will be on deploying other Azure resources within the DevTest Lab. The workflow will be to setup the Azure resources, then setup and configure Visual Studio.
Get your DevTest Lab
The first step will be to create a DevTest Lab in your Azure subscription, if you have a lab feel free to move to the next section. DevTest lab is a resource within Azure that allows for greater control and insight of machines, similar to what would be expected in a development group or a test lab. The simplest way to create a DevTest Lab is using the Azure Portal. Once you have created the lab take note of the Resource group name for the lab, this will be needed later.
The next step is to use the Azure Portal to help create the necessary ARM template for the VM to be created.
The DevTest Lab VM template
Using the ability to create a VM with all the customizations and have the ARM template generated is very useful, especially when the lab is setup with custom artifacts, custom images, or environments. The primary task here is to get the ARM template, not create the VM so cancelling out after will save time.
Create the Visual Studio Project
Start up Visual Studio and create a new Azure Resource group project, using a blank template. In the AzureDeploy.json file copy in the ARM template from the DevTest Lab VM. The JSON viewer will function on the azuredeploy.json and show the different resources, variables, and parameters.
Deploy the VS project for your DTL VM
Now to deploy, simply right click on the project and select Deploy / New. In the deployment dialog select the subscription that the DevTest lab resides in, then select the DevTest Lab resource group.
If the information for the different parameters isn’t in the azuredeploy.parameters.json then a second dialog will open to allow the information to be entered that is required for the parameters. The information from the deploy will show up in the Visual Studio output pane which will show the deployment status and success. After the first deployment the Lab resource group will show up in the deploy MRU list to allow easier deployment.
If you have any questions about DevTest Labs, please check out the MSDN forum.
Hope this helps.