Load Testing in VSTS using self-provisioned agents

Recently we had some customer work which required us to do some simple URL-based load testing of several of their services. For this work we proposed to use the load testing facilities within VSTS to run the tests and gather the relevant statistics.

Initially the issue which we faced was that due to the nature of the application, these services deployed within Azure had IP restrictions to ensure they were locked down and secure. Meaning that these services can only accessed from within the client / our own company network. One of the main requirements of using the VSTS load testing facility is that the application under test is accessible over the internet, which typically isn’t the case for an application that has critical security requirements. When you create a load test within VSTS you can select for the load agent to be automatically provisioned and select the geo-location of where this load agent would be deployed. However due to the IP restrictions on the services this wasn’t going to work as these servers wouldn’t be able to connect to the services.

To resolve this, we configured our own self-provisioned load agent located on our company network. This self-provision agent can be selected when setting up the load test and due to it being on our company network, it can see the services under test.

More Information – https://blogs.msdn.microsoft.com/devops/2016/08/22/use-cloud-load-agents-on-your-infrastructure/

  1. On the machine we had set-up I downloaded the PowerShell script ManageVSTSCloudLoadAgent.ps1
  2. Set up a PATToken within VSTS so that it has the required authentication to connect into our VSTS account. https://docs.microsoft.com/en-gb/vsts/accounts/use-personal-access-tokens-to-authenticate?view=vst
  3. Run a command like below replacing the parameters to point to your VSTS instance.

    .\ManageVSTSCloudLoadAgent.ps1 -TeamServicesAccountName https://xyz.visualstudio.com -PATToken olxpldk2xcdfp5bt2ruemetwrmv7xyzk23l4cnnewi3rbaq -ConfigureAgent -AgentGroupName ‘trial’

  4. Once the script has completed you should see a service running on your machine using Task Manager called VSTSLoadAgentService
  5. On creating a load test within VSTS you can select “Use self-provisioned agents” and selected the Load Agent which you have configured.
    SelfProvisionLoadAgent
  6. Export from the load test ran within VSTS.
    LoadTestSummary

About the author