Deploying to azure websites while having multiple web projects in a single solution is challenging with TFS 2013 builds.
The new VSO build allows this to be done very easily.
Inspired with below two articles, deploying to azure websites with TFS build 2013 and VS Release Management 2013, is explained in this post.
First requirement is getting the the build to package the website. For this right click on the Web Project and click on publish.
Click on Custom and provide a name to the publish profile.
Select webDeployPackage as publish method. Package name should be ProjectName.Zip.
Set site name with __ as prefix and suffix for RM server to understand it as a token (parameter).
Set the configuration to Release.
Click publish and this will create package files in the project folder and add publish profile to the Project.
Publish profile contains site name value with prefix and suffix __ as DeployIisAppPath.
Published package in project folder contains required files to deploy the web site.
In SetParameters file the site name with __ available.
Setup a TFS Build to package the solution. Use build arguments to package the web site with publish profile.
This will create the package and copy to build drop location.
Next step required is to setup a Release Management tool to deploy the package created. Collin’s ALM Corner post here shared the irmsdeploy.exe required to create the tool.
__WebAppName__.deploy.cmd /y /m:"https://__PublishUrl__/MsDeploy.axd" -allowUntrusted /u:"__PublishUser__" /p:"__PublishPassword__" /a:Basic
Create environment to deploy from is the next requirement. For this setup RM Agent in a machine with VS 2013 is available. Setting up RM Agent explained here.
Register the RM Agent machine with the RM server create environment and a release path.
In the environment add the server and allow for all stages. All stages allow here since deployments to all azure environments in all stages can be done via same agent machine.
Acceptance step set to Automated to trigger a release from the build.
Next create a new release template. Select the build created earlier.
For the release template add a new agent based component.
Provide the build drop location for the component (Web site package path in the build drop).
Select the tool created in the deployment tab.
In the configuration variables tab set the AzureWebAppName parameter for SetParameters file and click Save&Close.
Link the component to current template.
Add the component to template and set the parameters. The values should be obtained from the publish profile of the target Azure web site.
Using below steps Azure Web Site can be created in Azure Management portal and obtain the publish profile.
Parameter values for publishing available in publish profile.
It is possible to add more web projects to Visual Studio solution and add them with a publish profile with the same name.
It is possible to add components using the tool and create a template to deploy multiple azure websites like shown below.
Sites can be deployed with release template.
Resolve MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found or Unable to start the process. No executable found matching command "dotnet-projectmodel-server"You might encounter compilation error in Visual Studio 2015 when a new .NET Core 1 web app is created, if you have installed Visual Studio 2...
It is great if the latest updates to TFS can be applied as and when they are released. But for a large organization it might not be sometime...
TFS 2018 RC1 is now available and you can download it from https://www.visualstudio.com/downloads/ . Release note here explains the new fea...
This extension “ Chamindac.vsts.release.task.download-artifacts ” for VSTS and TFS 2015.2.1 upwards, can be used to filter for build artifac...
You needed to setup dedicated machines for testing when using Run Functional Tests and you had to execute, Deploy Test Agent step and Copy...