Deploy Java 8 Spring Boot API to Azure App Service

Spring is a popular framework for Java based application development.  Spring Boot makes Spring based application development easier by automate and encapsulate some complexity such as dependency and configuration management. 

Recently, I have a customer asking how to deploy a Spring Boot based Java API app to Azure.  While there are several articles on similar topics, I cannot point the customer to a complete process. This blog serves the purpose.

Local environment setup

I need to have a local environment to test and package the Spring Boot API application before I can deploy it to Azure.  I used Windows 2012R2 server for this walk through. 

First, I installed the latest versions of Java SDK and Maven tool from the links below:

Java SDK (8u112):

Install Maven (3.3.9):

There are 2 additional steps to complete the setup:

1.       Make sure both Java and Maven path are in PATH variable.


2.       Create a new environment variable JAVA_HOME so Maven will work.


To verify the installation, you can start a new command window and check the version installed and make sure the commands work. javamavenversions

Test API app locally

I used an existing tutorial app for this blog.  Follow the steps from this tutorial - and clone the code from the repo:

git clone

Build and test from local machine:


After validating the application, I created a jar package with the command below.  This jar file will be deployed to Azure:

mvnw clean package

The generated jar file is renamed to sbapi.jar and copied to this folder structure:


Create and Configure Azure API App

I can now move to Azure to create an Azure API App to host the greeting API app.  I followed the same steps as in:

The created app setting is configured as: apiappsettingh

You can use the API app console to verify the java path: azurejavahome

In addition to sbapi.jar file, we also need to add a web.config file to the deploy folder to tell API App Java home and command line to run the jar file.

Create a web.config file to the \deploy root (\deploy\web.config) and add the following content (modified from /en-us/azure/app-service-web/web-sites-java-custom-upload):

<?xml version="1.0" encoding="UTF-8"?>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments=" -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\webapps\sbapi.jar&quot;">

Follow the steps described at /en-us/azure/app-service-api/app-service-api-java-api-app to deploy the sbapi.jar file to the created Azure API Web site.

Below is the outcome of the git push: deploytoazure

We can now test the API and see that it works as expected:

I hope this blog showed you that you can easily deploy a Spring Boot based Java 8 API application to Azure API App.

This blog is the result of collaboration with my teammate Anand Raman.