Deploying Java maven project in Microsoft Azure using Azure CLI
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:
Steps to be followed:
- 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