Team Services | TFS 2017 | TFS 2015 | Previous versions (XAML builds)
In just a few steps you can build and deploy your Java app to Azure. This works from both the Visual Studio Team Services service and your on-premises Team Foundation Server.
Upload your code
Upload your code to Visual Studio Team Services or your on-premises Team Foundation Server. Either push your code to Git or check in your code to TFVC.
If you don't have any code, you can download our Hello world Java web app.
Enable Java, Apache Tomcat, and FTP for your Azure web app
Sign in to the Azure portal.
Edit or create a Java web app and enable Apache Tomcat.
Click the deployment credentials part (outlined in red below). Create a user name and password. Click Save. If you previously enabled publishing for a web app, you don't need to do this step.
Create the definition
(If you don't see your team project listed on the home page, select Browse.)
- On-premises TFS:
- Visual Studio Team Services:
- On-premises TFS:
- Click Empty to start with an empty definition.
Define variables to store Azure FTP authentication data
On the Variables tab, store the data needed to copy files to Azure via FTP. Copy this data from the Azure portal. There is nothing special about the variable names we suggest below, so you can make them whatever you prefer.
|azure.ftp.userName||Take this value from your Azure web app essentials. For example if the name of your Azure web app is FabrikamJava, then the value would be :
|azure.ftp.password||Take this value from your Azure subscription deployment settings. In your build definition variables, make sure to click secret to avoid exposing this password value. I don't want to use my Azure subscription FTP credentials. Can I use credentials scoped to my Azure web app?|
Add build steps
On the Build tab, add these steps:
Build the app.
|Utility: cURL Upload Files||
Copy the .war file to Azure.
|Build: Publish Build Artifacts||
(Optional) Drop some of the build outputs, such as the .war file as we do in the example below.
Finish and test the definition
On the Repository tab:
Git: Make sure the repository and branch containing your application are selected. (By default the repository with the same name as the team project is selected.)
TFVC: Make sure the folder that contains your app is mapped.
On the Triggers tab select continuous integration (CI). If your code is in Git, specify the branches you want to build.
Save your definition and queue the build.
After a successful build, check your site:
What code is in the sample app?
|-- .gitignore `-- helloworld |-- .classpath |-- .project |-- pom.xml `-- src `-- main `-- webapp |-- WEB-INF | `-- web.xml `-- index.jsp
The pom.xml file enables you to build with Maven. The .gitignore file keeps build artifacts on your dev machine from getting into your Git repo.
I don't want to use my Azure subscription FTP credentials. Can I use credentials scoped to my Azure web app?
Sign in to the Azure portal.
Open your web app and download the publish profile.
Open your .PublishSettings file and copy some of the data from the
publishMethod="FTP"section into your build variables.
|Name||Value from .PublishSettings file attribute||Notes|
|azure.ftp.password||userPWD||In your build definition variables, make sure to click secret to avoid exposing this password value.|
How do I continually deliver my app and manage my releases?
What other kinds of apps can I build?
What other kinds of build steps are available?
How do we protect our codebase from build breaks?
Git: Improve code quality with branch policies with an option to require that code builds before it can be merged to a branch. This option is not available for GitHub repos.
TFVC: Use gated check-in.
How do I modify other parts of my build definition?
Specify your build steps to run tests, scripts, and a wide range of other processes.
Specify build options such as specifying how completed builds are named, building multiple configurations, creating work items on failure.
Specify the repository to pick the source of the build and modify options such as how the agent workspace is cleaned.
Set build triggers to modify how your CI builds run and to specify scheduled builds.
Specify build retention policies to automatically delete old builds.
I selected parallel multi-configuration, but only one build is running at a time.
If you're using Team Services, you might need more concurrent pipelines. See Concurrent build and release pipelines in Visual Studio Team Services.
How do I see what has changed in my build definition?
Do I need a build agent?
You need at least one agent to run your build. Get an agent.
I can't select a default agent queue and I can't queue my build. How do I fix this?