Deploying Spring Boot Application with MySQL Database on Azure
Last Updated :
11 Apr, 2025
Microsoft Azure is a cloud computing platform through which we can use Microsoft’s resources. It works on different deployment models like Infrastructure as a Service(IaaS), Platform as a Service(PaaS), Software as a Service(SaaS), and Serverless Functions. Cloud Deployment is highly in demand nowadays as users love the concept of the Cloud over on-premise infrastructure.
In this article, we will explain the steps to deploy a Spring Boot application integrated with a MySQL database on the Azure cloud platform. Let us see how to deploy a Spring Boot application with a MySQL database on Azure:
- Start by deploying the MySQL database on Azure
- Getting ready with MySQL connections
- Configuring the Spring Boot application for deployment
Why Choose Azure for Spring Boot Deployment?
Setting up a large physical server will require a lot of money, effort, and physical space. But with Microsoft Azure, you don’t need to worry about this setup. Azure will provide us with virtual machines, fast processing of data, analytical and monitoring tools, and so on to make our work simpler. The pricing of Azure is also simple and cost-effective. Azure uses a “Pay As You Go” model, which means you have to pay only for what you use.
Prerequisites
You must have the following things in your system for the Deployment of the Spring Boot Application with the MySQL Database:
- Azure account
- MySQL Workbench installed locally
- Spring Boot application with Maven
- GitHub account with your project uploaded
Step-by-Step Guide to Deploying a Spring Boot App to Azure with MySQL Database
The following are the step-by-step instructions that you can follow to deploy a Spring Boot application integrated with a MySQL Database on Azure:
Step 1: Start by deploying the MySQL database on Azure
- Open the Azure Portal and Search for MySQL Server to create a resource section.
- Click creates a resource after providing some basic details like the zone and choosing a plan of your choice.

- Once the resource creation is done go to your dashboard and open the resource to view its details.
- Click on Connection security and add the current IP address.
- Click on Connection String and copy the JDBC connection string and store it for the meantime.
- Open MySQL Workbench in your local system.
- Click on the ‘+’ next to MySQL connections.

Step 2: Getting ready with MySQL connections
A dialog will open where give a connection name of your choice, provide the hostname as the server name present in the overview section of the Azure MySQL database. Finally, put the username and password which was generated at the time of resource creation.

- After successfully validating the details click on test connection, and if everything is perfect, then login to the workbench using the above-entered username and password.
- Create a database of your choice using the command ‘create database “name”‘, the execute ‘use database “name” ‘.
CREATE DATABASE springboot_db;
USE springboot_db;
Step 3: Configuring the Spring Boot Application for Deployment
Open application.properties file and add the following properties in it as provided below:
# Server and Database Config
server.port=8080
spring.datasource.url=jdbc:mysql://your-mysql-server.mysql.database.azure.com:3306/springboot_db?useSSL=true&requireSSL=true
spring.datasource.username=your-admin-user
spring.datasource.password=your-password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # Updated driver
# Hibernate/JPA Config
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
Step 4: Add MySQL Dependency in pom.xml
pom.xml should use the latest MySQL Connector:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
</dependency>
Step 5: Run the Spring Boot Application
Now run the application as a Spring-Boot app. Upon running hibernate automatically configures the table structure for your project on the Azure MySQL database.
Step 6: Deploy the App to Azure
- Create an app service on Azure.
- Link your GitHub account under the Deployment Center of the App Service. Select the repository and branch that contains your Spring Boot project.
- Finally hit the create button.
These steps can be used to deploy a Spring Boot app with MySQL database on the Azure cloud platform.

Note: To see the deployment cycle go to the Actions tab of your Git-hub account and you will find the aforementioned actions in progress. Finally, if the application is error-free then a deployment link will be generated.
Similar Reads
Spring Boot - Application Properties
Spring Boot is built on top of the Spring Framework and includes all its features while simplifying configuration and setup. It has become a favorite among developers because it provides a rapid, production-ready environment that allows them to focus on business logic instead of dealing with complex
3 min read
Spring Boot with H2 Database
H2 Database in Spring Boot is an embedded, open-source, and in-memory database. It is a relational database management system written in Java. It is a client/server application. It stores data in memory, not persist the data on disk. Here we will be discussing how can we configure and perform some b
6 min read
Spring Boot - CRUD Operations
CRUD stands for Create, Read/Retrieve, Update, and Delete and these are the four basic operations that we perform on persistence storage. CRUD is data-oriented and the standardized use of HTTP methods or there is a term for this called HTTP action verbs. HTTP has a few action verbs or methods that w
7 min read
Spring Boot - REST Example
In modern web development, most applications follow the Client-Server Architecture. The Client (frontend) interacts with the server (backend) to fetch or save data. This communication happens using the HTTP protocol. On the server, we expose a bunch of services that are accessible via the HTTP proto
5 min read
How to Change the Default Port in Spring Boot?
Spring Boot framework provides a default embedded server i.e. the Tomcat server for many configuration properties to run the Spring Boot application. The application runs on the default port which is 8080. As per the application need, we can also change this default port for the embedded server. In
4 min read
Spring Boot - Hello World
Spring Boot is built on top of the Spring Framework and contains all the features of Spring. It has become a favorite of developers these days because of its rapid production-ready environment, which enables the developers to directly focus on the logic instead of struggling with the configuration a
4 min read
What is Command Line Runner Interface in Spring Boot?
Spring Boot CLI (Command Line Interface) is a command line software or tool. This tool is provided by the Spring framework for quickly developing and testing Spring Boot applications from the command prompt. In this article, we will discuss the command line runner interface in the spring boot. Sprin
3 min read
How to Make a Simple RestController in Spring Boot?
A RestController in Spring Boot is a specialized controller that is used to develop RESTful web services. It is marked with the @RestController annotation, which combines @Controller and @ResponseBody. This ensures that the response is automatically converted into JSON or XML, eliminating the need f
2 min read
How to Implement Simple Authentication in Spring Boot?
In this article, we will learn how to set up and configure Basic Authentication with Spring. Authentication is one of the major steps in any kind of security. Spring provides dependencies i.e. Spring Security that helps to establish the Authentication on the API. There are so many ways to add Authen
4 min read
What is PathVariable in the Spring Boot?
Java language is one of the most popular languages among all programming languages. There are several advantages of using the java programming language, whether for security purposes or building large distribution projects. One of the advantages of using JAVA is that Java tries to connect every conc
3 min read