Quickstart: Produce a Coffee app along Bright blue App Service

Azure App Service provides a extremely scalable, self-patching web hosting service. This quickstart shows how to use the Azure Command line interface with the Azure Web App Plugin for Maven to deploy a .jar charge, Oregon .war charge. Use the tabs to switch between Java SE and Tomcat instructions.

  • Java SE
  • Tomcat
  • JBoss EAP

Spring app greetings in Azure App Service

If Maven isn't your preferred development tool, suss out out our similar tutorials for Coffee developers:

  • Gradle
  • IntelliJ IDEA
  • Eclipse
  • Visual Studio apartment Code

If you don't take an Azure subscription, create a free story before you begin.

Use Azure Cloud Shell

Azure hosts Chromatic Overcast Shell, an interactive trounce environment that you can use through your web browser. You tin can habit either Bash or PowerShell with Cloud Casing to work with Azure services. You can use the Obscure Shell preinstalled commands to run the code in this article without having to install anything on your local environment.

To start Azure Dapple Shell:

Option Example/Link
Select Essay It in the top-right tree of a computer code immobilize. Selecting Render It doesn't automatically transcript the inscribe to Obscure Shell. Example of Try It for Azure Cloud Shell
Go to https://shell.azure.com, or select the Launch Dapple Shell button to unfold Obscure Shell in your browser. Launch Cloud Shell in a new window
Select the Dapple Husk button on the carte du jour bar at the upper right hand in the Cerulean portal. Cloud Shell button in the Azure portal

To run the code in that article in Azure Cloud Shell:

  1. Set off Mist Shell.

  2. Select the Copy push button happening a inscribe block to copy the code.

  3. Spread the code into the Cloud Shell academic term aside selecting Ctrl+Shift+V on Windows and Linux or past selecting Cmd+Fracture+V connected macOS.

  4. Select Enter to go the inscribe.

Create a Java app

  • Java SE
  • Tom
  • JBoss EAP

Clone the Spring Charge Getting Started sample project.

                git clone https://github.com/leap-guides/gs-spring-boot                              

Change directory to the completed project.

                cd gs-spring-boot/complete                              

Configure the Hotshot plugin

The deployment process to Cerulean App Serving will use your Azure credentials from the Sapphire CLI mechanically. If the Azure CLI is not installed locally, then the Maven plugin will authenticate with Oauth or gimmick login. For more information, reckon authentication with Maven plugins.

Play the Maven command below to configure the deployment. This overtop will help you to set up the App Service in operation system, Java version, and Tomcat version.

            mvn com.microsoft.azure:azure-webapp-maven-plugin:2.2.3:config                      
  • Java SE
  • Tom
  • JBoss EAP
  1. If prompted with Subscription option, select the proper Subscription by incoming the number written at the line start.

  2. When prompted with Web App option, select the nonremittal alternative, <create>, aside urgent enter.

  3. When prompted with OS option, select Windows by entrance 1.

  4. When prompted with javaVersion option, pick out Java 11 aside entering 2.

  5. When prompted with Pricing Tier option, select P1v2 past incoming 10.

  6. Finally, press enter on the last prompt to confirm your selections.

    Your concise output will look similar to the snippet shown below.

                        Delight confirm webapp properties Subscription Id : ********-****-****-****-************ AppName : spring-reboot-1599007390755 ResourceGroup : spring-rush-1599007390755-rg Neighborhood : centralus PricingTier : P1v2 OS : Windows Java : Java 11 Web waiter stack : Java SE Deploy to slot : false Confirm (Y/N)? : Y [INFO] Saving configuration to pom. [Information] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [Information] Total time: 41.118 s [Information] Finished at: 2020-09-01T17:43:45-07:00 [Information] ------------------------------------------------------------------------                                      
  • Java SE
  • Tomcat
  • JBoss EAP
  1. When prompted with Subscription option, select the proper Subscription away entering the number printed at the line start.

  2. When prompted with Web App pick, select the default option, <create>, by pressing enter.

  3. When prompted with Osmium option, select Linux by pressing enter.

  4. When prompted with javaVersion option, superior Java 11 by entering 2.

  5. When prompted with Pricing Tier option, select P1v2 aside incoming 9.

  6. Finally, press enter on the death prompt to confirm your selections.

                        Please corroborate webapp properties Subscription Idaho : ********-****-****-****-************ AppName : bounce-boot-1599007116351 ResourceGroup : spring-boot-1599007116351-rg Region : centralus PricingTier : P1v2 OS : Linux Web host stack : Java SE Deploy to slot : false Support (Y/N)? : Y [Information] Saving configuration to pom. [INFO] ------------------------------------------------------------------------ [Information] BUILD SUCCESS [Information] ------------------------------------------------------------------------ [INFO] Total time: 20.925 s [Information] Finished at: 2020-09-01T17:38:51-07:00 [Information] ------------------------------------------------------------------------                                      

You can modify the configurations for App Religious service directly in your pom.xml if needful. Both common ones are listed down the stairs:

Property Required Description Version
<schemaVersion> false Specify the version of the configuration schema. Based on values are: v1, v2. 1.5.2
<subscriptionId> false Specify the subscription ID. 0.1.0+
<resourceGroup> true Azure Resource Group for your World Wide Web App. 0.1.0+
<appName> apodeictic The name of your World Wide Web App. 0.1.0+
<region> false Specifies the domain where your Network App will be hosted; the default value is centralus. All valid regions at Supported Regions section. 0.1.0+
<pricingTier> false The pricing grade for your Web App. The default value is P1v2 for production workload, spell B2 is the recommended minimum for Java dev/test. Learn much 0.1.0+
<runtime> wrong The runtime environment configuration, you could witness the detail Here. 0.1.0+
<deployment> off-key The deployment configuration, you could see the details here. 0.1.0+

Be careful about the values of <appName> and <resourceGroup> (helloworld-1590394316693 and helloworld-1590394316693-rg accordingly in the demonstrate), they will be used later.

Deploy the app

With all the shape ready in your pom file, you fire deploy your Java app to Sky-blue with one single command.

  • Java SE
  • Tomcat
  • JBoss EAP
                mvn package azure-webapp:deploy                              

Once deployment has completed, your application will atomic number 4 primed at http://<appName>.azurewebsites.net/ (http://helloworld-1590394316693.azurewebsites.nett in the demonstration). Open ai the url with your local web browser, you should see

  • Java SE
  • Tomcat
  • JBoss EAP

Spring app greetings in Azure App Service

Extolment! You've deployed your first Java app to App Service.

Clean up resources

In the preceding steps, you created Azure resources in a resource group. If you don't expect to need these resources in the prox, delete the imagination grouping from portal, or away running the shadowing command in the Cloud Shell:

            az group delete --name <your resource group name; for instance: helloworld-1558400876966-rg> --yes                      

This command may take a minute to pass.

Next steps