Infrastructure as Code is a DevOps practice that you can enable using Azure Resource Manager templates with Visual Studio Team Services.
There is a great resource on GitHub of quick start ARM templates. However, I could not find one that showed me how to use ARM to provision a Web app with Java 8 and Tomcat 8 enabled. So, in this post I will show how using Visual Studio 2015 with Azure SDK 2.8. To reduce any confusion, I am going to delete all optional resources.
We are going to begin by creating a new project in Visual Studio.
- Start Visual Studio
- From the File menu, select New > Project…
- Select Azure Resource Group
- Click OK
- Select Web app
- Click OK
- From Solution Explorer, select WebSite.json
- From the JSON Outline, delete the following resources:
- Copy and paste the code below into WebSite.json under the Website properties
"dependsOn": [ "[concat('Microsoft.Web/sites/', variables('webSiteName'))]" ],
- From Solution Explorer, right-click your project
- Select Deploy > New Deployment…
- Select or create a new Resource group
- Click Edit Parameters…
- Click Save
- Click Deploy
- You can monitor the status of your deployment from the Output window
- Once complete, you will have a new Java enabled Web app
Visual Studio Team Services enables the use of this template in your DevOps pipeline via the Azure Resource Group Deployment task.