Here is one of the simplest ways to deploy a Spring Boot application (JAR with embedded Tomcat) to Azure WebApp (Windows)
Steps:
- Create zip file which contains the JAR file and a web.config
- Here is a sample web.config which you can use:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\app.jar""
startupRetryCount='10'>
</httpPlatform>
</system.webServer>
</configuration>
-
When using zip deploy, the contents of the zip gets transferred to
D:\home\site\wwwroot
of the WebApp -
Now, just call the Zip Deploy API to deploy your app.
Example (using cURL):
curl -X POST -u <deployment_user> --data-binary @"<zip_file_path>" https://<app_name>.scm.azurewebsites.net/api/zipdeploy
Documentation:: https://docs.microsoft.com/en-us/azure/app-service/deploy-zip#rest
UPDATE:
Now, you can simple rename your Spring Boot JAR file as app.jar and push it to D:\home\site\wwwroot. No web.config required.