AUTHOR: Đorđe Karanović



In this tutorial, we'll explore the steps to deploy Spring Boot application integrated with a MySQL database on Azure.


  1. Create your spring boot application and include dependencies such as 'Spring Web', 'Spring Data JPA', 'Lombok' and 'MySQL Driver'

  2. Configure database connection. Modify or application.yml in your Spring Boot application to configure the database connection.

  1. spring.datasource.url=${AZURE_MYSQL_CONNECTIONSTRING}
  2. Push your spring boot application to a git. Execute this commands on command prompt:

    1. git init

    2. git branch -M main

    3. git remote add origin {name_of_your_repo}

    4. git push -u origin main


  1. Create MySQL Database: Go to the Azure Portal, and create an Azure Database for MySQL.

  2. Fill in the form with the required details:

    • Subscription: Select your Azure subscription.

    • Resource group: Create a new one or select an existing resource group.

    • Server name: Provide a unique name which will be part of the hostname.

    • Location: Choose the Azure region closest to your users.

    • Version: Select the MySQL server version.

    • Admin username: Enter a username for the database administrator.

    • Password: Create and confirm password.

    • Pricing tier: Choose the Basic pricing tier

  3. Configure Firewall Rules: Make sure to set the firewall rules to allow access to the database. You can allow access to Azure services and/or specify IP ranges that can access the database. This you will find in networking section:



  1. Create the Database for the application. Go to the database section and create new database



  1. Access database from the browser or locally. If you want to access db locally use you can connect to MySQL server with the following command:

mysql -h -u mhymkukmxx -p


  1. Access database from MySQL workbanch. To connect to workbench follow the steps bellow:

    • 1. Click the + symbol in the MySQL Connections tab to add a new connection.

      2. Enter a name for the connection in the Connection name field.

      3. Select Standard (TCP/IP) as the Connection Type.

      4. Enter hostname (ex: ).

      5. Enter username and then enter your Password.

      6. Go to the SSL tab and update the Use SSL field to Require.

      8. Click Test Connection to test the connection.

      9. If the connection is successful, click OK to save the connection.

  2. Connection string. You can find your connection string in connect section in connect your app part:


  1. Create a Web App on Azure: Create a Web App and choose your: subscription, resource group (if there is no, create one), name for your app web app and choose region.

  2. Deploy the Application:

    • You can deploy your application through continuous integration pipelines like GitHub Actions.

    • Deployment from github:

      1. Click on Deployment Center from the sidebar.

      2. Choose GitHub as the source.

      3. Authenticate and authorize Azure to access your GitHub account

      4. Select the repository where your application's code is located and the branch to deploy from.

      5. Azure will detect the build pipeline based on the project type and will start an initial deployment using the latest commit from the main branch.

  3. Obtain Database Application Settings: Add application settings to match your in the app from step 1.

In the Configuration section click new application settings and add name and values for username, password etc. and option "deployment slot setting" should be checked.




  1. After deploying your application, access it via the URL provided by Azure App Service .

  1. Check with swagger to ensure that your application is connecting to the MySQL database and functioning as expected.




Đorđe Karanović is an experienced software engineer specialized in developing applications for large enterprises using .NET, Java, React, etc. with a strong background in contributing robust solutions in numerous projects