«

»

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!

2017-04-04_11-40-12

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.

2017-04-04_11-59-56

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.

2017-04-04_12-13-43

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.

2017-04-04_12-16-49

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.

2017-04-04_13-25-18

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.

2017-04-04_13-27-48

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.

2017-04-04_13-52-34

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.

2017-04-04_14-06-12

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.

2017-04-04_14-15-46

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.

2017-04-04_14-24-50

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.

2017-04-04_14-29-40

/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.

2017-04-04_14-31-50

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.

2017-04-04_14-32-26

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.

2017-04-04_14-43-51

Comments

comments