Sample Environment in Azure Cloud Platform based on the shared Cloud Architecture

R Karshan
5 min readAug 16, 2020

This Blog post article is written for an requirement of course SENG 41283 : Distributed and Cloud Computing.

From this article, I will explain each azure resources I have used and application development. The separate article links are listed at the end of this article.

Microsoft Azure
Azure is computing service created by Microsoft for building, testing, deploying, and managing applications and services through Microsoft-managed data centers.

Azure resources used in this azure sample environment are App Services, Function App, Azure Database For MySQL Server, Azure Cache For Redis, Storage Account, Application Insights, Web Application Firewall, Front Door, CDN, Azure Active Directory and Key Vault.

Application

This is a simple application that i created using Angular, Springboot & MySql database to show the azure resources.

Source codes: Frontend & Backend.

ARM templates for all created azure resources : Link.

I will explain according the azure resources that I have used.

  1. Deploy Service & Setup MySQL : Here below.
  2. Azure App Function, Azure CDN & FrontDoor : Link.
  3. Front End Application Deployment & Authenticate the Front End with Azure Active Directory : Link.

First we will see how to deploy our Simple-EMS-Backend Service with MySQL in Azure.

Setup MySQL in Azure

We are using MySQL database in our application.So first we need to setup the MySQL database server in Azure.

Setting up a MySQL server in Azure

  • First Login to your Azure Portal.
  • Search Azure Database for MySQL in search bar that in All services. Click Create

We need to provide some configuration to set up a MySQL server.

  • Resource Group- Select/Create a new Resource Group.
  • Server name- Give a unique name for your MySQL server.
  • Location- Select a region in which you need to spin up the server.
  • Compute Storage- Select the storage based on your application’s need and also keep a look at the costing as well.
  • Then give Admin username and password to access the database server.
    Then Click Review and Create.

We have created our Azure My SQL database server. Now in the portal we can see that our MySQL is up and running.So next will see how to create the database using the created database server.

To access the database server we need to setup the firewall. To access from your MySQL Workbench then give your machine IP. Your can setup your firewall for specific IP’s that need to access you server.Also we are accessing the database server from Azure App Service, so we need allow access to Azure services as well.

Go to the Connection Security and click on Add current client IP to access the database server from our local machine. Also enable YES to Allow access to Azure services, then only we can connect from Simple-EMS-Backend Service to access the Database.

Open your MySQL workbench from your machine and create a New Connection.

Add your server name, username and login to the server using the password of the created server.
Then create the database using the SQL command.

So next will see the steps to deploy the Backend Service.

Deploy Backend Service in Azure

Github repository of my project here.

Go to the application.properties file and change the following database configurations with the MySQL server you have created.

We will build the Simple-EMS-Backend JAR and deploy it to Azure App Service. So Open the Permanent-Product pom.xml and add the following maven dependency

<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.9.1</version>
</plugin>

We are deploying the JAR using Azure cli, So if you don’t have Azure cli installed then install it. Look Azure Cli installation here.

Open Azure cli and first login to the cli using the following command and it will prompt to the Azure login page in a browser.

az login

Provide your Azure account login credentials and log in. After a successful login you would see

Then to add the deployment configurations run the following code

mvn azure-webapp:config

After the Successful Build the configurations will be added to your pom.xml. Add this app settings to your configuartion as well.

<appSettings>           
<property>
<name>JAVA_OPTS</name>
<value>-Dserver.port=80</value>
</property>
</appSettings>

Then to deploy your app in Azure App Service first clean and then deploy .

mvn clean packagemvn 
azure-webapp:deploy

After successful deployment you can see this in your command line

We have deployed our Simple-EMS-Backend in Azure App Service.So in the Azure App Services we can view the deployed service.

My next article Azure App Function, Azure CDN & FrontDoor.

References:

--

--

R Karshan

Final Year Undergraduate | Software Engineering University of Kelaniya.