Provisioning a Java 8, Tomcat Web app in Azure using an ARM Template

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.

  1. Start Visual Studio
  2. From the File menu, select New > Project…
  3. Select Azure Resource Group
    image
  4. Click OK
  5. Select Web app
  6. Click OK
  7. From Solution Explorer, select WebSite.json
  8. From the JSON Outline, delete the following resources:
    1. AutoScaleSettings
    2. ServerErrorsAlertRule
    3. ForbiddenRequestsAlertRule
    4. CPUHighAlertRule
    5. LongHttpQueueAlertRule
    6. AppInsightsComponent
  9. Copy and paste the code below into WebSite.json under the Website properties
    "resources": [
       {
          "apiVersion": "2015-08-01",
          "name": "web",
          "type": "config",
          "dependsOn": [ "[concat('Microsoft.Web/sites/', variables('webSiteName'))]" ],
          "properties": {
             "javaVersion": "1.8",
             "javaContainer": "TOMCAT",
             "javaContainerVersion": "8.0"
          }
       }
    ]
  10. From Solution Explorer, right-click your project
  11. Select Deploy > New Deployment…
  12. Select or create a new Resource group
  13. Click Edit Parameters…

    Field Name

    Value

    hostingPlanName javahostingplan
    skuName F1
    skuCapacity 1
  14. Click Save
  15. Click Deploy
  16. You can monitor the status of your deployment from the Output window
    image
  17. Once complete, you will have a new Java enabled Web app
    image

Visual Studio Team Services enables the use of this template in your DevOps pipeline via the Azure Resource Group Deployment task.
image

Add comment

Loading