Deploying Java maven project in Microsoft Azure using Azure CLI

Ramu Vudugula
2 min readJun 30, 2020

Prerequisites: Windows Command Prompt, Azure CLI, Azure Portal and Java maven project

Reference Links:

Download Azure CLI using below link

https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest

Blog:

https://docs.microsoft.com/en-us/azure/java/spring-framework/deploy-spring-boot-java-app-with-maven-plugin

Steps to be followed:

  1. After installing Azure CLI, open windows command prompt and enter az to check the installation of Azure CLI

2. If it is installed, then to find your installed version run az — version command

3. Sign into your Azure account by using the Azure CLI: az login. Azure portal will open in the browser and enter the credentials to access Azure portal

4. Now go to Java maven project folder using cd foldername in command prompt

5. To update the configuration settings like app name, app subscription, app resource group, app service plan name, app service plan resource group, location and run time settings like os and java version, then run the below command and enter the options

mvn azure-webapp:config

This command will update the properties in pom.xml file

<plugin>

<groupId>com.microsoft.azure</groupId>

<artifactId>azure-webapp-maven-plugin</artifactId>

<version>1.8.0</version>

<configuration>

<! — Specify v2 schema →

<schemaVersion>v2</schemaVersion>

<! — App information →

<subscriptionId>18b78924–605f-4cb9-a064–5545687</subscriptionId>

<resourceGroup>Test-Resource</resourceGroup>

<! — Deploy Web App to an existing Service Plan which pricing tier is not S3 →

<appServicePlanResourceGroup>Test-Resource</appServicePlanResourceGroup>

<appServicePlanName>Test-AppServicePlan</appServicePlanName>

<appName>webapp-java-test</appName>

<region>Central US</region>

<! — Java Runtime Stack for App Service on Windows →

<runtime>

<os>windows</os>

<javaVersion>1.8</javaVersion>

<webContainer>java 8</webContainer>

</runtime>

<! — Begin of App Settings →

<appSettings>

<property>

<name>JAVA_OPTS</name>

<value>-Dserver.port=80;DisplayMessage=Application</value>

</property>

</appSettings>

<! — End of App Settings →

<deployment>

<resources>

<resource>

<directory>${project.basedir}/target</directory>

<includes>

<include>*.jar</include>

</includes>

</resource>

</resources>

</deployment>

<pricingTier>B1</pricingTier>

</configuration>

</plugin>

6. Clean the project and build the new jar with the below command

mvn clean package

7. To deploy the application in Azure use the below command

mvn azure-webapp:deploy

8. After successful completion of deploying app service will be visible in the azure app

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Ramu Vudugula
Ramu Vudugula

Written by Ramu Vudugula

Engineer… Learning to move from B to A with Intelligence

No responses yet

Write a response