Check out the end-to-end Java DevOps video on YouTube

ON THIS PAGE we will show you how to deploy a Visual Studio Team Services Java team project to an Azure Web App (free trial).


  • You have read the Create a Git Repo page and performed the steps on that page to create a Team Services project and Git repository for the DeepSpace sample code.
  • You have read the Build a Web App page and performed the steps on that page to build a Team Services project for the DeepSpace sample code.

Deploy the Web Application

Throughout all of the pages in this walkthrough, we will consistently use some sample code written in Java and AngularJS. The project is called DeepSpace. All of our instructions in the walkthough pages and screenshots will assume you are using this same sample code, but would also apply if you had your own code (with names changed appropriately).

Following the instructions on this page below, you will deploy a Java project (web application with a WAR file) to a free Azure Web App. We will lead you through the steps to: 1) Create an Azure Web App; 2) Configure the Web App to run Java and Tomcat; 3) Download the Web App profile to your local host; 4) Add and Configure a cURL deployment task to an existing build task; 5) Build and Deploy the sample app WAR file to the Azure Web App; 6) Run the web application.

Create an Azure Web App

Log in to the Azure account you created on the Introduction page of this Getting Started walkthrough at the Azure Management Portal. Once in the Management Portal, click on Web Apps in the left panel menu, then click on the Create a Web App in the right panel. You will see a screen similar to the image below.

If you don't have an option for "Create a Web App" as shown above, you can still create one by selecting the +NEW option at the bottom-left portion of the window.

Click through to select the Compute->Web App->Quick Create option, then enter a name for your Web site application in the URL text box. We recommend choosing something easy to remember. We are using "raisajavademo" for our example, but the name needs to be unique and not already in use. Then select a geographical Region close to you and click on Create Web App (bottom-right). It may take a few minutes for your Web App to be created. Watch for the status message.

Configure Java on Web App

Once the Web App is created, click on the Web App in the list to open it and then click on the Configure menu option. Within the configure window, click on the Java Version number so that Java is no longer off but now on. This action will also cause the Web Container to automatically choose "Tomcat". You should see a screen similar to the image below. If all looks correct, click `Save' at the bottom of the screen. Watch and wait for the configuration to take effect.

Download Web App Profile

Now you need to download the connection and security information necessary for Team Services to deploy to the Web App you just created. Click the Dashboard menu option for your Web App. You should see a screen similar to the image below.

Click on the Download the publish profile option (listed on the right side) to download and save the text file containing the connection and security information for your Web App.

Configure cURL Deployment Task

You are now done creating and configuring your Java Web App on Azure. So open a web browser window to your Visual Studio Team Services account and open the DeepSpace project. Once in the project, click on the Build menu option. Click on the build definition you created on the previous page and then click Edit. You should see the Maven task you created previously. Click on Add build step which will display the list of available build tasks. In the "Add Tasks" window, click on the All qualifier to see all of the available tasks. Scroll down and locate the cURL Upload Files task. Click Add once and then click Close. You will now need to enter some of the cURL configuration data as shown in the image below.

Enter the following data in the fields for the cURL task (cut-and-paste highlighted data exactly as-is):

  • Files: target/*.war
  • Username: <copy/paste the userName from the text file containing your Azure Web App profile - use the second occurrence in the file>. It will be of the form raisajavademo$raisajavademo (as shown in the image above).
  • Password: $(azureftpsitepw)
  • URL: <copy/paste the publishURL from the Azure Web App profile> and append /webapps/ROOT.war to the end of this URL. The final value will look similar to ftp://waws-prod-blu-031.ftp.azurewebsites/windows/net/site/wwwroot/webapps/ROOT.war
  • Optional Arguments: -v -Q "+*RNFR ROOT" -Q "+*RNTO ROOT$(Build.BuildId)"

Click Save and then OK. The above cURL configuration information tells cURL where to find your application WAR file on the build server and where to copy this WAR file on your new Azure Java Web App.

Now click on the Variables menu item under in the Build window. Click on Add Variable and then type azureftpsitepw into the "Name" column. Copy and paste the userPWD value from the Azure Web App profile under the "Value" column (don't include the double quotes). Click on the small lock icon to the right of the box so that this data becomes locked and securely stored. Then click Save and OK.

Build and Deploy the Web App

To build and deploy your DeepSpace web application, click on Queue build..., then click OK and wait for the build to succeed (which may take a few minutes). When it completes, you should see a screen similar to the one below indicating the build succeeded:

If you see any errors or the build otherwise fails, trace your steps above to make sure you copied all required data elements from the downloaded Web Application Profile into the appropriate fields.

Run the Web App

To run the now-built and deployed copy of your DeepSpace project, open a web browser and copy-and-paste the destinatonAppUrl from the Web Application Profile into your web browser's address field. This URL should look something like http://<name_you_selected>

After a few seconds (while your Web App is being loaded/configured), your copy of DeepSpace should run in your browser's window and look similar to the image below.

Congratulations! You have completed the Getting Started section of the Team Services Java walkthrough. You created your first Java project web app using Team Services and Git, built your web app while configuring your build for continuous integration, and created and deployed your web app to a Azure.

Next Steps

Frequently Asked Questions (FAQ)

Q: Where can I learn more about the Azure Web Apps and VMs for Linux?

A: This Azure article provides more details.

Q: Where can I learn more about the Azure and Java in general?

A: Azure Java Developer Center