Publish from TFS to Windows Azure Pack: Web Sites

 

Applies To: Windows Azure Pack

This topic provides an overview of the tasks that are required to publish (deploy) a Visual Studio web project to a web site on Windows Azure Pack: Web Sites so that others can access the application over the Internet. It also explains how to enable automated publishing from a build definition within Visual Studio Team Foundation Server (TFS) to simplify the application lifecycle management of web projects that target Windows Azure Pack: Web Sites.

Typical Deployment Scenarios

You can deploy a web project by using either one-click publish or a web deployment package.

  • One-click publish is a feature in Visual Studio that lets you deploy directly from the Visual Studio IDE by clicking a button. Visual Studio connects to a destination server, copies project files to it, and performs other deployment tasks.

  • A web deployment package is a .zip file that contains all the information needed for deployment. You create the package from the command line or in Visual Studio, and you install it on the destination server by using the command line or IIS Manager.

The method you use depends on your scenario and your personal preference, as explained in the following sections.

One-click Publish

One-click publish is typically the best choice for smaller organizations that do not implement a continuous integration (CI) development process. Typically, a web site is deployed to a hosting company where the application runs in a shared hosting environment or on a dedicated server. In a shared hosting environment, a single server could be used to host sites for multiple hosting company clients.

Typical Third Party Scenarios

Package Deployment

In an enterprise environment, a web site is deployed to a company's servers, which are in turn connected to the Internet. Typically, the deployment uses a CI process. The application is promoted through testing and staging environments before it is deployed to production. In these scenarios, you can use one-click publish to deploy to a testing environment, but for a progression through a series of different environments to production, a deployment package is typically used.

Typical Enterprise Scenarios

Deployment packages are more appropriate for enterprise scenarios because they can be integrated into the CI process by using the command line to create and install the packages.

Visual Studio Publishing

This section describes how to deploy a web site to a test server from a developer computer that uses Visual Studio. The sample deployment uses Web Deploy packages, which are supported by both Visual Studio and Windows Azure Pack: Web Sites. Team Foundation Server (TFS) and MSBuild work together as an integrated source control and build system.

Download Publish settings from the Windows Azure Pack: Web Sites portal

Under the Quick Glance section of the portal, click the Download the publish profile link to download the web site publishing profile. Save the file in a local folder.

Download Publish Profile

Import the Publishing Profile

In order to publish from Visual Studio, you must first import the publish settings from the web site so that Visual Studio can create its own per-protocol publishing profiles. To have Visual Studio create the publishing profiles, perform the following steps.

  1. In Visual Studio, open your Web Project.

  2. Right click the Web Project node from Solution Explorer and choose Publish.

  3. On the Profile tab of the Publish Web dialog, click Import to import the publish settings file.

    Import Publish Settings File

  4. Test that you are able to deploy from Visual Studio.

    Test Deploy from Visual Studio

  5. The Publish Web wizard creates a separate publishing profile for each publishing method described in the publish settings file (.publishsettings). In this case, there is one for Web Deploy, and one for FTP, as you can see in Solution Explorer.

    Publish Profiles in Solution Explorer

Important

In a team environment, check the publishing profile files (.pubxml) into TFS source control so that everyone on the team can publish interactively.

TFS Publishing

Now you will use the publishing files to configure publishing as part of the Build definition. The Build definition enables TFS to deploy after a build is complete.

Create a Build Definition with publishing support to Windows Azure Pack: Web Sites

Add the following MSBuild arguments to the build definition:

/p:CreatePackageOnPublish=true /p:DeployOnBuild=true;PublishProfile="mysite - Web Deploy" /P:Password=******** /p:AllowUntrustedCertificate=True

Important

  1. The Publish profile name needs to match the name of the checked-in publishing profile file (.pubxml).

  2. The password is not included in the .pubxml file and needs to be copied from the .PublishSettings file that you downloaded from the Windows Azure Pack: Web Sites portal.

  3. Note that you must add /p:AllowUntrustedCertificate for Windows Azure Pack installations if the Web Deploy endpoint in the Publisher role has not been configured with a proper certificate. By default, the Web Deploy endpoint is protected with self-signed certificate.

  4. The following picture shows where the MSBuild arguments can be configured. Choose Process in the left pane. In the Build process parameters window, expand Build, expand Advanced, and then select MSBuild arguments, which you can modify in the right side of the window.

    MSBuild arguments

Publish to Windows Azure Pack: Web Sites

  1. To perform a test publish, modify something on the default.aspx page so that you can see the difference in the browser. In the example shown, the text that displays the version number has been modified:

    Change the default.aspx file

  2. Queue a new build. Under Build definition, choose DeployToWAP.

    Queue Build

  3. Wait for the build to complete. When it finishes, a Build succeeded message appears.

    Build succeeded

  4. Test browse to your site.

    Test Browse to Site