abr 05

Provisining PaaS workloads in DevTest Labs

DevTest Lab is a great Azure feature to create environments on the cloud for developers and testers quickly provision resources with minimum waste, security, and cost control. You can pre-configure the lab to accelerate the dev and test, including virtual machine images, artifacts, formulas, and others. One hidden ability on DevTest Labs is the support for PaaS workloads. The standard templates to provision resources encompass different flavors of virtual machines, but there are no PaaS options. You can provision any type of PaaS workload available on Azure by adding external repositories. This article guides you to add PaaS workloads in addition to IaaS.

First things first

An important concept on DevTest Labs is the External Repositories. All resources you can add on DevTest Labs are based on repositories. For instance, you can open Configuration and Policies and click on Repositories under External Resources to see the Public Repo. This Repo contains an URI to GitHub and, if you are curious enough to open it, you will see all resources you can add to DevTest Lab are available there!


To include PaaS workloads options, all you must do is create a new repository with PaaS ARM templates and include as external repository. Let’s see how to do it.

Straight to the point: How include PaaS resources to DevTest Lab

To allow developers and testers provision PaaS workloads on DevTest Labs, you will need two things:

  • External Repository (VSTS Git or Github, for instance)
  • ARM Templates

In this example, we will use a VSTS repository, but you can follow these steps for Github. First, create a new project repository on VSTS, or select an existent based on Git.


Next, clone the new repository on Visual Studio and start to create the new PaaS ARM template. Create a new Templates folder to store you PaaS Azure template.


Now, click on Team Explorer tab, go to Home view and select New… under Solutions. On New Project, select Cloud and then Azure Resource Group, specify a Name and click OK to create the new project.


Visual Studio has a set of quick starts templates that you can use to provision different workloads. For Web App, there is a simple Web app template you can use to start.


Now, you have a solution with three files: WebSite.json, WebSite.parameters.json, and Deploy-AzureResourceGroup.ps1. We are interested in the first two files which are the base for our solution.


Open WebSite.json for a second and analyze the JSON template. The first element is parameters, where you can see different settings that will appear to the developers and testers when they create new PaaS workloads. The first three parameters are hostingPlanName, skuName, and skuCapacity, all related to App Service Plan. Under variables section, you can see the webSiteName. Note you can’t choose the website name, it is hardcoded with a concatenation of the word ‘webSite’ and a unique string based on Resource Group Id. This template is ready to go, but you can customize if necessary.


Finally, we need to include an additional file called metadata.json which is used to specify the template display name and description during provisioning. Just add a new item to the project and select JSON File and specify the name. You need to include two values: itemDisplayName, representing the template name, and description.


Now, let’s open the file explorer and copy the three JSON files to Templates folder created on the beginning. Remember to create a new folder inside Templates. In our example, the folder name is webapp-basic. Next, rename the both file that start with WebSite to azuredeploy, as in the image below.


Note that the filenames must be exactly as in the picture, or DevTest Lab will not be able to find the template. Push the changes to repository and we are ready to add to DevTest Labs. Go back to Azure Portal, open DevTest Labs, select Configuration and Policies, and select Repositories under External Resources. Click in Add button.


Specify the name of your repository, the Git clone URI (you can get that on VSTS portal, on upper-right corner of Code area), specify the Branch, the Personal access token (see how to get that here), and specify Azure Resource Manager template folder with /Templates.


/dl>Click Save. Azure will validate the repository and populate ARM template cache with the new template you just created. Now, go back to DevTest Lab view and select Add button to see the new template you just imported.


Select Simple Web App, fill the values and click Add. Note that Environment Name is the name you will see under resources you have on DevTest Labs.


The PaaS will be created, and you are ready to start to develop and test your application using PaaS, with all level of control and security of DevTest Labs. You can add the number of PaaS workloads you need to your repository, or other combination of IaaS infrastructure.