We have some good resources on how you can configure your TFS build server to be able to build SharePoint Apps. Here are few references:

1- To get your TFS build server ready for building SP apps:

How to Build Office Developer Tools Projects with TFS Team Build 2012

2- Download the deployment and build process templates from codeplex. Use the PowerShell script ‘TfsBuildServerPrerequisites.ps1’ to prepare your build server. It has an option to collect required files for you, then install everything for you.

After everything is setup correctly and you have queued your first build but got errors, here are few things that can help:

1- Getting the following error: “Only one project can be specified”

Resolution: Make sure that your build definition name doesn’t have any spaces

2- Getting the following error: “Import-Module: The specified module ‘Microsoft.Online.SharePoint.PowerShell’ was not loaded because no valid module

Resolution: Make sure that you have installed the ‘Microsoft SharePoint Online Management Shell’. If you haven’t go to this link to download it and install it. After it’s installed you need to restart the TFS build services so the PowerShell modules become visible to TFS, go to services.msc and restart the following services:

    • Visual Studio Team Foundation Build Service Host 201X
    • Visual Studio Team Foundation Background Job Agent

That’s all for now. Let me know if you can across other know issues to share with the crowd. Thanks.