- Basics about Visual Studio Team Services
- Committing code to VSTS using Git and Visual Studio
- Setting up automated build
- Connecting VSTS and Azure
- Setting up VSTS Release Management
-
Discussion points:
- Brief overview about Visual Studio Team Services (high-level features, relation to TFS, pricing models, etc.)
-
Navigate to Visual Studio Team Services (VSTS) and create a new subscription if you do not already have one.
-
Navigate to your VSTS subscription. In my case the URL is
https://rainerdemotfs-westeu.visualstudio.com/
. Replace this URL with your personal VSTS URL. -
Create a new VSTS project
PracticalDevOps
. Make sure you select Git for Version control.
-
Navigate to your new project.
-
In Visual Studio's Team Explorer, select Connect to Team Project.
-
Add your VSTS server and select the
PracticalDevOps
project. -
Copy the code your created in the previous exercises into the new local directory.
-
Copy the
.gitignore
file from Exercise-6-VSTS-Source-Control into the new local directory. -
Discussion points:
- Overview about functionality of Visual Studio's Team Explorer
- Point out that VSTS works with any Git client (e.g. demo git CLI or Git Extensions)
-
In Visual Studio's Team Explorer, goto Changes, review the changes that Visual Studio has detected (see image below), and commit your changes.
-
Accept the suggestions of the Build Setup Wizard.
-
Discussion points:
- Speak about how branches, build processes and deployment slots can be used for dev/test/prod
- Build process walk-through
- Overview about additional build steps that would be possible
- Describe concept of cross-platform build agents
-
Add the following arguments to MSBuild in step Visual Studio Build (necessary for creating the Web Deploy package):
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.stagingDirectory)"
-
Save the generated build definition with the name
PracticalDevOps Build
-
Watch how the hosted build controller builds your code. You should not get any errors.
-
For testing purposes, screw up tests (e.g. by removing the
Ignore
attribute from testIgnoredTest
), check your changes in, and see the build failing. Remember to fix your code again so that you can continue with the rest of the exercise.
-
In VSTS project options, goto Services area. Add a service endpoint for Azure
-
Select Certificate Based and follow the link download publish settings file. Open the publish settings file and copy the required data into VSTS.
-
Discussion points:
- Point out security-related issues with handling publish settings files (again)
-
Discussion points:
- Describe concepts of VSTS's release management
- Release process walk-through
- Overview about additional steps that would be possible
-
In order to automate deployment, create a Deployment Condition.
-
Trigger deployment automatically whenever a release has been created.
-
Now you can test the entire pipeline. Change someting in your code (e.g. appending a
!
to the title) and check your code in. The build should be triggered automatically. The release should be created after the successful build. The release should be immediately published to Azure App Services.
-
Discussion points:
- Describe advantages of load testing in the cloud
-
Right-click on solution and add new Test Settings named Cloud.
-
Change load test from Test Iterations to Run Duration as VSTS does not support test iteration setting.
-
Select the test location you want to use (ideally the location where you deployed you web app to).
-
Watch load test running in the cloud. Analyze load test results in Visual Studio and in Visual Studio Online (web report). Test test will probably fail.
-
Discussion points:
- Discuss the consequences of this result (our app has a scalability problem)
- Use Application Insights (see also exercise 4) to detect the source of the problem (requests to Blob Storage start to fail after a certain period of time).
- How could we gather more detailed exception information?
Add OWIN unhandled exception handler that logs to Application Insights.
Here is the necessary code (only recommended in a rather dev-oriented audience):namespace Books { public class Startup { private class AiExceptionLogger : ExceptionLogger { public override void Log(ExceptionLoggerContext context) { if (context != null && context.Exception != null) { var ai = new TelemetryClient(); ai.TrackException(context.Exception); } base.Log(context); } } public void Configuration(IAppBuilder app) { // Configure and add Web API var configuration = new HttpConfiguration(); ... configuration.Services.Add(typeof(IExceptionLogger), new AiExceptionLogger()); app.UseWebApi(configuration); } ... } }
-
In the web test's request properties, set think time to five seconds.
If you have time left, you could additionally cover topics like:
- Setup an additional build agent in a VM