<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>VSTS</title><link>http://www.ralbu.com:80/tags/vsts</link><description>VSTS</description><item><title>Running Unit Tests as part of Continuous Integration of VSTS / VSO</title><link>http://www.ralbu.com:80/running-unit-tests-as-part-of-continuous-integration-of-vsts-vso</link><description>&lt;p&gt;In my &lt;a href="continuous-integration-and-deployment-of-azure-web-app-using-vsts-vso"&gt;previous blog&lt;/a&gt; I explained how to setup from scratch and deploy to Azure using VSTS. As I mentioned in the blog I left the configuration of Unit Testing for another time.&lt;/p&gt;
&lt;p&gt;In this article I will explain how you set up and run your Unit Tests as part of CI/CD process using VSTS.&lt;/p&gt;
&lt;p&gt;There are a few ways to setup Unit Tests depending on what you want to achieve. We can run the Unit Tests from a PowerShell script or we can use the &lt;em&gt;Visual Studio Test &lt;/em&gt;build step which VSTS team created for us. Let&amp;rsquo;s start with PowerShell first.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll use the same project as in the previous post &amp;ndash; &lt;em&gt;OfficeInventory.&lt;/em&gt; The Unit Test project is a standard .NET library using xUnit library. The process will be similar if you use a different Unit Test library, like NUnit.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Configuring PowerShell&lt;/h1&gt;
&lt;p&gt;When using xUnit you should make sure that the console runner is added as package so it will be restored during the build. We will use the console application to run the Unit Tests.&lt;/p&gt;
&lt;p&gt;At the root folder of the project &amp;ndash; the same level with &lt;em&gt;.sln&lt;/em&gt; I added the &lt;em&gt;Scripts &lt;/em&gt;folder. The folder will contain &lt;em&gt;run-unittests.ps1&lt;/em&gt; PowerShell script.&lt;/p&gt;
&lt;p&gt;We provide two input parameters to the script, the xunit console application path and the path we want to search for the tests projects.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;param (
    [Parameter(Mandatory=$true)][String] $xunitConsole,
    [Parameter(Mandatory=$true)][String] $sourceDirectory
)
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next we&amp;rsquo;ll search for all the Unit Tests files we want to test excluding Java Script projects.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;$assembliesToTest = (Get-ChildItem "$sourceDirectory" -Recurse -Include "*Test*.dll" -Exclude "*JavaScript*" -Name | Select-String "bin")&lt;/pre&gt;
&lt;pre class="brush: bash;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;Now that we have all the Unit Test files we want to run let&amp;rsquo;s execute them.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;foreach ($testFile in $assembliesToTest) {

  $fileNameOnly = Split-Path $testFile -Leaf
  $unitTestFileName = Join-Path $sourceDirectory ($fileNameOnly + "-XunitTestResult.xml")

  $fullNameTestFile = Join-Path $sourceDirectory $testFile

  &amp;amp; $xunitConsole $fullNameTestFile -xml $unitTestFileName
}
&lt;/pre&gt;
&lt;p&gt;In the &lt;em&gt;$unitTestFileName&lt;/em&gt; we store the result of our Unit Test execution. We&amp;rsquo;ll use this in the &lt;em&gt;Publish Test Result&lt;/em&gt; build step.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the full PowerShell script&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;param (
    [Parameter(Mandatory=$true)][String] $xunitConsole,
    [Parameter(Mandatory=$true)][String] $sourceDirectory
)

if (!(Test-Path $xunitConsole))
{
    throw "xunit.console.exe does not exist. Please check $xunitConsole file."
}

$assembliesToTest = (Get-ChildItem "$sourceDirectory" -Recurse -Include "*Test*.dll" -Exclude "*JavaScript*" -Name | Select-String "bin")

$atLeastOneTestRun = $false

Write-Host "[Debug] ************* Running Unit Tests *************"

foreach ($testFile in $assembliesToTest) {
    Write-Host "[Debug] *************** Testing $testFile ***************"

  $fileNameOnly = Split-Path $testFile -Leaf
  $unitTestFileName = Join-Path $sourceDirectory ($fileNameOnly + "-XunitTestResult.xml")

  $fullNameTestFile = Join-Path $sourceDirectory $testFile

  &amp;amp; $xunitConsole $fullNameTestFile -xml $unitTestFileName
  $atLeastOneTestRun = $true
}

if ($atLeastOneTestRun -eq $false) {
    Write-Output "Unit Tests didn't run!"
	exit(1)
}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The script is ready, lets add the build steps. Edit the configuration build and in the &lt;em&gt;Add tasks&lt;/em&gt; select PowerShell Scripts.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/powershell%20task_2.png"&gt;&lt;img title="powershell task" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="powershell task" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/powershell%20task_thumb.png" width="754" height="768" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And after that add &lt;em&gt;Publish Test Results.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/publish%20test%20results_2.png"&gt;&lt;img title="publish test results" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="publish test results" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/publish%20test%20results_thumb.png" width="749" height="768" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Close the dialog and make sure both tasks are added after the B&lt;em&gt;uild &lt;/em&gt;task and before the &lt;em&gt;Publish Artifact &lt;/em&gt;task.&lt;/p&gt;
&lt;p&gt;Select the &lt;em&gt;PowerShell &lt;/em&gt;tasks and configure the following&lt;/p&gt;
&lt;p&gt;- &lt;em&gt;&lt;strong&gt;Type&lt;/strong&gt;: File Path&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;- &lt;em&gt;&lt;strong&gt;Script filename&lt;/strong&gt;: scripts/run-unittests.ps1&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;- &lt;em&gt;&lt;strong&gt;Arguments&lt;/strong&gt;: -xunitConsole "$(Build.Repository.LocalPath)\packages\xunit.runner.console.2.1.0\tools\xunit.console.exe" -sourceDirectory "$(Build.Repository.LocalPath)"&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Select the &lt;em&gt;Publish Test Results &lt;/em&gt;and configure these parameters&lt;/p&gt;
&lt;p&gt;- &lt;em&gt;&lt;strong&gt;Test Result Format&lt;/strong&gt;: XUnit&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;- &lt;/em&gt;&lt;strong&gt;Test Results Files&lt;/strong&gt;&lt;em&gt;: **/*-XunitTestResult.xml&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now it&amp;rsquo;s time to run the build. You can see the Tests Results in the Summary page.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/build%20success_2.png"&gt;&lt;img title="build success" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="build success" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/build%20success_thumb.png" width="640" height="150" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Configuring the Visual Studio Test step&lt;/h1&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For this configuration we will use a &lt;em&gt;Visual Studio Test&lt;/em&gt; task. First of all, make sure that the Unit Test project has &lt;em&gt;xunit.runner.visualstudio &lt;/em&gt;package if you are using the &lt;em&gt;xUnit&lt;/em&gt; framework.&lt;/p&gt;
&lt;p&gt;Add a new build step as in the below image. That will be a &lt;em&gt;Visual Studio Test&lt;/em&gt; step&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/VS%20Test_4.png"&gt;&lt;img title="VS Test" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" border="0" alt="VS Test" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/146dcc60e4d0_10199/VS%20Test_thumb_1.png" width="753" height="768" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You don&amp;rsquo;t have to do anything in this step, the default parameters will work ok, unless you need more features, like code coverage, running JavaScript, etc.&lt;/p&gt;
&lt;p&gt;The default configuration will include all the projects containing the name &lt;em&gt;tests &lt;/em&gt;and exclude the &lt;em&gt;obj&lt;/em&gt; folder.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;In this post I explained two ways you can run your Unit Tests during the build process using VSTS / VSO.&lt;/p&gt;
&lt;p&gt;First way is to execute a PowerShell script which will find all the tests you want to run and using a &lt;em&gt;Publish Tests Results&lt;/em&gt; to publish the tests. If you&amp;rsquo;re using &lt;em&gt;xUnit &lt;/em&gt;you need to make sure you have &lt;em&gt;xunit.runner.console&lt;/em&gt;&amp;nbsp; included as a NuGet package.&lt;/p&gt;
&lt;p&gt;The second option is easier but is not as flexible. In this case you need to have &lt;em&gt;xunit.runner.visualstudio&lt;/em&gt; NuGet package.&lt;/p&gt;</description><pubDate>Tue, 05 Jul 2016 09:00:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/running-unit-tests-as-part-of-continuous-integration-of-vsts-vso</guid></item><item><title>Continuous Integration and Deployment of Azure Web App using VSTS / VSO</title><link>http://www.ralbu.com:80/continuous-integration-and-deployment-of-azure-web-app-using-vsts-vso</link><description>&lt;p&gt;A new addition to the Microsoft&amp;rsquo;s Visual Studio Team Services (former VSO) continuous integration and deployment is the Release tool. The CI/CD process I&amp;rsquo;m describing here applies to VSTS but at some point it will be released to TFS as well. Microsoft invested its effort into building a nice continuous integration and deployment pipeline. The new online VSTS build and release tools are much better than the old XAML builds. I have been working with &lt;a href="https://www.jetbrains.com/teamcity/" target="_blank"&gt;TeamCity&lt;/a&gt; for a very good number of years and I was surprised with Microsoft&amp;rsquo;s new addition. I started working with Build and Release tools very earlier for one of our clients -&amp;nbsp; since private previews. It was called Visual Studio Online at that time. My experience is that they are moving very fast. I ported a few of our TeamCity builds and deployment configurations over to VSTS and it was easier than I expected. Taking into the account that I almost had zero documentation I progressed very quickly.&lt;/p&gt;
&lt;p&gt;In this article I will explain how you can build and deploy a Web site into Azure Web App. VSTS contains a template for Azure Web Sites which makes our life easier. It contains Cloud Services and IIS Web Applications also. And if there&amp;rsquo;s anything you need which is missing you can always use PowerShell.&lt;/p&gt;
&lt;p&gt;The solution we&amp;rsquo;re going to deploy represents an ASP.NET MVC Application but a WebForms application will have the same approach. For the sake of simplicity I created an ASP.NET MVC Application and named it &lt;strong&gt;OfficeInventory&lt;/strong&gt;.&lt;/p&gt;
&lt;h1&gt;Create a build configuration&lt;/h1&gt;
&lt;p&gt;Open Build tab in VSTS and click the plus button:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/add-build_2.png"&gt;&lt;img title="add-build" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="add-build" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/add-build_thumb.png" height="364" border="0" width="392" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select an Empty template in the popup windows and click Next. There is a &lt;strong&gt;Visual Studio&lt;/strong&gt; Template but it will add build steps which we don&amp;rsquo;t need, like Visual Studio Test and Index Sources.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/select-empty-template_2.png"&gt;&lt;img title="select-empty-template" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="select-empty-template" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/select-empty-template_thumb.png" height="484" border="0" width="483" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the next step select the source settings. Default agent in this case will be Hosted, unless you&amp;rsquo;ve installed your own agent. With the hosted agent you have 240 free minutes per month. Check Continuous Integration check box and click Create.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/configure-source-control_2.png"&gt;&lt;img title="configure-source-control" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="configure-source-control" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/configure-source-control_thumb.png" height="484" border="0" width="486" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First we&amp;rsquo;ll configure the build and after that we&amp;rsquo;ll add build steps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Repository configuration&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll come back and update the build and publish build steps but for the moment open the &lt;strong&gt;Repository&lt;/strong&gt; tab. You should have already source settings in place. The settings I&amp;rsquo;m explaining below refer to a Git repository. If you want the build process to download all the source code every time it builds select true for the&amp;nbsp; &lt;strong&gt;Clean&lt;/strong&gt; dropdown. Depending how big your project is this may slow down the build process. If you want to tag your source code then select the appropriate value in the &lt;strong&gt;Label sources&lt;/strong&gt;. Adding tags to you build will make sense when you create NuGet packages but it will provide less information for normal builds. By default &lt;strong&gt;Label format&lt;/strong&gt; contains the build number. I will explain later how to set it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Variables configuration&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Variables &lt;/strong&gt;tab contains our variables definition we can use during the build process. We can use them in the following format:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;$(VariableName)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add the following variables:&lt;/p&gt;
&lt;table border="0" cellpadding="2" cellspacing="0" width="400"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="200"&gt;BuildConfiguration&lt;/td&gt;
&lt;td valign="top" width="200"&gt;Release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="200"&gt;BuildPlatform&lt;/td&gt;
&lt;td valign="top" width="200"&gt;Any CPU&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Triggers configuration&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;Triggers &lt;/strong&gt;tab we can configure when to run the build. You can set it up to run as &lt;strong&gt;Continuous integration&lt;/strong&gt; and include filters based on branch names. When you check &lt;strong&gt;Batch changes&lt;/strong&gt; option it will include several check-ins if they are from the same committer. You can run the build on a schedule as well. Adding the schedule will help when you want to run builds which takes more time, like testing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;General&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;General &lt;/strong&gt;tab you can change the Agent Queue, build authorisation, badge displayed on external web site etc. We&amp;rsquo;re interested in setting the &lt;strong&gt;Build Number&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I like setting the build number following the classic approach: &lt;em&gt;major.minor.build.revision&lt;/em&gt;. In this case, if I want the build number to be &lt;em&gt;1.0.3.[RevisionNo]&lt;/em&gt; then I use the format &lt;em&gt;1.0.3.$(Rev:r)&lt;/em&gt;. If you prefer to use a different system to name your builds, like using date, then find more information online at this &lt;a href="https://msdn.microsoft.com/en-us/library/hh190719%28v=vs.120%29.aspx" target="_blank"&gt;MSDN link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Retention&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Retention &lt;/strong&gt;tab allows to specify for how many days you can keep the build details, including test results. The default value is 30 days and at the moment you can&amp;rsquo;t change that.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Build steps&lt;/h2&gt;
&lt;p&gt;We have created an empty build, now lets add the configuration we need. Click &lt;strong&gt;Add build step&amp;hellip;&lt;/strong&gt; in the list of &lt;strong&gt;Tasks&lt;/strong&gt; select &lt;strong&gt;Build &lt;/strong&gt;on the left hand side and search for Visual Studio Build. Click the &lt;strong&gt;Add&lt;/strong&gt; button. Next select &lt;strong&gt;Utility&lt;/strong&gt; on the left hand side and click the &lt;strong&gt;Add &lt;/strong&gt;button of the &lt;strong&gt;Publish Build Artifacts&lt;/strong&gt;. Now you can close the popup.&lt;/p&gt;
&lt;h3&gt;Build solution&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s go back to the &lt;strong&gt;Build &lt;/strong&gt;tab and select &lt;strong&gt;Visual Studio Build.&lt;/strong&gt; We need to provide settings on the right hand side. First of all, you may want to add a meaningful name to this step, so click on the pencil in the right hand side, above all the settings and enter the name you want.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Solution&lt;/strong&gt; text box contains **\*.sln &amp;ndash; you can leave it like that or click on the ellipsis button and select the solution file from the tree.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MSBuild Arguments &amp;ndash; &lt;/strong&gt;we need to create a package which we&amp;rsquo;ll deploy later in Azure Web App. In order to do this we&amp;rsquo;ll use the command line&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=$(Build.StagingDirectory)\OfficeInventory&lt;/pre&gt;
&lt;p&gt;Pay attention to the &lt;strong&gt;PackageLocation&lt;/strong&gt; parameter. This is where our package will be copied. We&amp;rsquo;ll use this path in the next step to publish the package. We use &lt;em&gt;Build.Staging&lt;/em&gt; variable which is a predefined build variable. The package will be copied to staging directory of our build and in the &lt;em&gt;OfficeInventory &lt;/em&gt;folder. The staging folder is generated by the build agent.&amp;nbsp; Find more information about build and release variables at &lt;a title="Use variables" href="https://msdn.microsoft.com/en-us/Library/vs/alm/Build/scripts/variables" target="_blank"&gt;Use variables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the &lt;strong&gt;Platform &lt;/strong&gt;and &lt;strong&gt;Configuration &lt;/strong&gt;provide the variables we&amp;rsquo;ve created before: &lt;em&gt;$(BuildPlatform)&lt;/em&gt; and &lt;em&gt;$(BuildConfiguration)&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Check the &lt;strong&gt;Clean &lt;/strong&gt;checkbox if you want to start the build with all the files removed from previous builds.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-vs-settings_2.png"&gt;&lt;img title="build-vs-settings" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="build-vs-settings" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-vs-settings_thumb.png" height="351" border="0" width="804" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Publish package&lt;/h3&gt;
&lt;p&gt;The next step is to publish the package so we can use it during the Release process. Select the &lt;strong&gt;Publish Build Artifacts &lt;/strong&gt;step. In the &lt;strong&gt;Path to Publish &lt;/strong&gt;enter &lt;em&gt;$(Build.StagingDirectory)\OfficeInventory. &lt;/em&gt;For the &lt;strong&gt;Artifact Name &lt;/strong&gt;provide a name you want. In my case it&amp;rsquo;s &lt;strong&gt;OfficeInventory&lt;/strong&gt;. In the &lt;strong&gt;Artifact Type &lt;/strong&gt;select &lt;strong&gt;Server&lt;/strong&gt; unless you want to copy the package to a shared folder.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-publish-settings_2.png"&gt;&lt;img title="build-publish-settings" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="build-publish-settings" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-publish-settings_thumb.png" height="307" border="0" width="814" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now it&amp;rsquo;s time to save if you haven&amp;rsquo;t yet and run the build.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Release&lt;/h1&gt;
&lt;p&gt;Open the Release tab. As I&amp;rsquo;m writing this blog the Release is in public preview.&lt;/p&gt;
&lt;p&gt;Click on the &lt;strong&gt;Plus &lt;/strong&gt;button and select &lt;strong&gt;Azure Website Deployment&lt;/strong&gt;. It will add a new environment with &lt;strong&gt;Azure Deployment &lt;/strong&gt;and &lt;strong&gt;Visual Studio Test&lt;/strong&gt; tasks for that environment.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-website_2.png"&gt;&lt;img title="release-website" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-website" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-website_thumb.png" height="484" border="0" width="381" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Delete the &lt;strong&gt;Visual Studio Test &lt;/strong&gt;because we&amp;rsquo;re not going to configure it &amp;ndash; I will post another article about configuring Unit Testing.&lt;/p&gt;
&lt;p&gt;You can rename the environment if you want to. Usually you&amp;rsquo;ll create a few environments, like Dev, Testing, Staging, etc.&lt;/p&gt;
&lt;p&gt;Click on the &lt;strong&gt;Artifacts&lt;/strong&gt; tab then click on the &lt;strong&gt;Link an artifact source.&lt;/strong&gt; Select the build you want to link to. There is nothing to add on the &lt;strong&gt;Configuration &lt;/strong&gt;tab so click on the &lt;strong&gt;Triggers &lt;/strong&gt;tab. Check the &lt;strong&gt;Continuous deployment &lt;/strong&gt;and select the artifact and the environment. In the &lt;strong&gt;General &lt;/strong&gt;tab I will change the default name format to &lt;em&gt;Office Inventory - 1.0.0.$(rev:r)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-artifact_2.png"&gt;&lt;img title="release-artifact" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-artifact" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-artifact_thumb.png" height="353" border="0" width="644" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In order to deploy to Azure you need to configure the Azure subscription first. Click on the &lt;strong&gt;Manage&lt;/strong&gt; link on &lt;strong&gt;Azure Subscription&lt;/strong&gt; of the &lt;strong&gt;Azure Web App Deployment &lt;/strong&gt;task. This will open a new page. On that page click on the &lt;strong&gt;New Service Endpoint&lt;/strong&gt; and Select &lt;strong&gt;Azure&lt;/strong&gt; from the list. This will open a modal windows where you need to enter Azure details. The easiest way to get that information is hovering you mouse on the exclamation icon and click on the &lt;strong&gt;publish settings file &lt;/strong&gt;link. That will download the Azure publish settings file. That file is an XML file so open it in your favourite editor. I prefer to use &lt;strong&gt;Certificate Based&lt;/strong&gt; instead the &lt;strong&gt;Credentials&lt;/strong&gt; type because I don&amp;rsquo;t want people to enter their credentials. In any case, extract the information you need from the &lt;strong&gt;publish settings&lt;/strong&gt; file, like &lt;strong&gt;Subscription Id, Name&lt;/strong&gt;, etc. and click OK.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-add-azure-connection_2.png"&gt;&lt;img title="release-add-azure-connection" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-add-azure-connection" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-add-azure-connection_thumb.png" height="377" border="0" width="644" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go back to the &lt;strong&gt;Environments&lt;/strong&gt; page and click on the Refresh button on the right hand side of the &lt;strong&gt;Azure Subscription.&lt;/strong&gt; Enter the name of your &lt;strong&gt;Azure Web App&lt;/strong&gt;, select the location and the slot (Production or Staging). Click on the Ellipses button select the package.&lt;/p&gt;
&lt;p&gt;Now we&amp;rsquo;re ready to deploy. Save the release and click on the &lt;strong&gt;Release&lt;/strong&gt; button and next &lt;strong&gt;Create Release.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-webapp_5.png"&gt;&lt;img title="release-webapp" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-webapp" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-webapp_thumb_1.png" height="281" border="0" width="804" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NOTE: You can rename the Tasks if you click the pencil on the right hand side of the task Title.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-rename-task_2.png"&gt;&lt;img title="release-rename-task" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-rename-task" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-rename-task_thumb.png" height="66" border="0" width="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now you can add multiple environments and continuously deploy to them.&lt;/p&gt;</description><pubDate>Thu, 25 Feb 2016 14:02:31 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/continuous-integration-and-deployment-of-azure-web-app-using-vsts-vso</guid></item></channel></rss>