Effortless CI/CD for Spring Boot Apps on Azure App Service with GitHub Action

Effortless CI/CD for Spring Boot Apps on Azure App Service with GitHub Action

A step-by-step guide to setting up CI/CD for your Spring Boot apps on Azure App Service using GitHub Actions.

In this article, we will go through the process of hosting Spring Boot Java application on Microsoft Azure App Service. Azure App Service allows you to quickly and easily create enterprise-ready web and mobile apps for any platform or device, and deploy them on a scalable and reliable cloud infrastructure.


  • Azure Account. (Create for free here) (You will need a debit/credit card for sign-up but won't be charged until you move to a pay-as-you-go plan post-exhaustion of the Free plan. Free Trial plan gives enough credit to run side-projects before you can scale out pricing plan.)

  • Spring Boot App. (We will bootstrap one quickly!)

Bootstrap Spring Boot App

We will quickly Bootstrap Spring Boot via Spring IO Initialzr.

Visit https://start.spring.io/.

Just change the Build tool to Maven and add Spring Web dependency.

Rest keep as default and generate the artifact. We are going with JDK17 and Spring Boot v3, won't matter in terms of how this article pans out.

Just adding a basic web controller to Spring Boot Project to hit the HTTP endpoint once deployed on Azure Cloud.

We will test locally once, to see if we get an HTTP response on the exposed Controller /greet.

The next step involves pushing our locally written code to Github.

We are pushing to the below repository named spring-boot-greet-azure. Post push it's time to deploy our code to Azure App Service.

Setup Azure App Service

  1. Visit Microsoft Azure Cloud Portal.

  2. Click on App Services and then on Create app Service. This will take us to Create Web app information page.

  3. Select Free Trial as Subscription and Create a new Resource group if required in the same step.

    A resource group is a collection of resources that share the same lifecycle, permissions, and policies. A resource group is a container with related resources for an Azure solution. The resource group can include all the resources for the solution, or only those resources that you want to manage as a group.

  4. Give a meaningful name to the Instance. We are naming it spring-boot-greet-azure, and selecting Publish method as Code. (We will have one via Docker soon using Private Azure Registry.)

  5. Select Runtime Stack as Java 17, and OS as Linux. Keep Region of East US as default.

  6. Select the Free F1 pricing plan which is shared infrastructure for demo purposes.

  7. Click on Review + Create. Then review the information once, and click Create.

  8. Wait for some time, before App and Resources will be created. Then click on Go to resource.

Setup GitHub Actions for CI/CD

  1. Here click on Deployment Center, here we will try to set up CI/CD with GitHub Actions.

  2. Select Source as GitHub and then Authorize GitHub with MS Azure.

  3. Select the required organization, Repository in our case is spring-boot-greet-azure, and the branch is main. You can preview the Github workflow.yml file too, which will trigger our CI/CD process.

  4. Click on Save in Top Left Corner. As soon as you save, and with no issues this will create and commit workflow file for GitHub action against our repository and also trigger Build and deployment for same.

    Wait for Workflow Run to be successful, which Builds and Triggers deployment on Azure.

  5. Once the build is successful, you can view deployment logs in Azure App Service itself or GitHub Workflow run for the same.

  6. You can now click on HTTP URL create based on your web app name inputted, you can find in the Overview page of the Azure App Service you created below

  7. We can now hit our /greet endpoint deployed on Azure App Service by visiting https://spring-boot-greet-azure.azurewebsites.net/greet

    Voila! We have successfully deployed Spring Boot v3 Application running with JDK17 on Azure App Service with CI/CD via GitHub Action with ease.

  8. We can integrate SONAR/Quality COde coverage along with other pipeline features to make it end to end SDLC pipeline.

404 Gotcha

Sometimes, you may get 404 errors on accessing the endpoint.

It may be due to the Application Insights Agent's interference with the tomcat version. Github Comment Issue on same highlights that.

In that case, we need to override the version for the Application Insight agent to use 3.4.9 as below.

Go to your Azure App Service --> Configuration --> Update Value for ApplicationInsightsAgent_EXTENSION_VERSION to 3.4.9


Thank you for reading, If you have reached it so far, please like the article, It will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback and suggestions!

I would love to connect with you on Twitter | LinkedIn

Did you find this article valuable?

Support Virendra Oswal by becoming a sponsor. Any amount is appreciated!