Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / load-testing

Part 2–Load Testing In The Cloud

0.00/5 (No votes)
2 Dec 2011CPOL18 min read 7.2K  
  Welcome to Part 2, In Part 1 we discussed the advantages of creating a Test Rig in the cloud, the Azure edge and the Test Rig Topology we want to get to.
<iframe src="http://www.facebook.com/widgets/like.php?href=http://geekswithblogs.net/TarunArora/archive/2011/11/27/part-2ndashload-testing-in-the-cloud.aspx" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe>

 

Welcome to Part 2, In Part 1 we discussed the advantages of creating a Test Rig in the cloud, the Azure edge and the Test Rig Topology we want to get to. In Part 2, Let’s start by understanding the components of Azure we’ll be making use of followed by manually putting them together to create the test rig, so… let’s get down dirty start setting up the Test Rig. 

What Components of Azure will I be using for building the Test Rig in the Cloud?

To run the Test Agents we’ll make use of Windows Azure Compute and to enable communication between Test Controller and Test Agents we’ll make use of Windows Azure Connect. 

image

Azure Connect

The Test Controller is on premise and the Test Agents are in the cloud (How will they talk?). To enable communication between the two, we’ll make use of Windows Azure Connect. With Windows Azure Connect, you can use a simple user interface to configure IPsec protected connections between computers or virtual machines (VMs) in your organization’s network, and roles running in Windows Azure. With this you can now join Windows Azure role instances to your domain, so that you can use your existing methods for domain authentication, name resolution, or other domain-wide maintenance actions. For more details refer to an overview of Windows Azure connect. A very useful video explaining everything you wanted to know about Windows Azure connect. 

Azure Compute

Windows Azure compute provides developers a platform to host and manage applications in Microsoft’s data centres across the globe. A Windows Azure application is built from one or more components called ‘roles.’ Roles come in three different types: Web role, Worker role, and Virtual Machine (VM) role, we’ll be using the Worker role to set up the Test Agents. A very nice blog post discussing the difference between the 3 role types.

Developers are free to use the .NET framework or other software that runs on Windows with the Worker role or Web role. Developers can also create applications using languages such as PHP and Java. More on Windows Azure Compute.

Each Windows Azure compute instance represents a virtual server...

Virtual Machine Size CPU Cores Memory Cost Per Hour
Extra Small Shared 768 MB $0.04
Small 1 1.75 GB $0.12
Medium 2 3.50 GB $0.24
Large 4 7.00 GB $0.48
Extra Large 8 14.00 GB $0.96

 

You might want to review the Windows Azure Pricing FAQ.

Let’s Get Started building the Test Rig…

image

Configuration

Machine Role Comments
VM – 1 Domain Controller for Playpit.com On Premise
VM – 2 TFS, Test Controller On Premise
VM – 3 Test Agent Cloud

 

In this blog post I would assume that you have the domain, Team Foundation Server and Test Controller Installed and set up already. If not, please refer to the TFS 2010 Installation Guide and this walkthrough on MSDN to set up your Test Controller. You can also download a preconfigured TFS 2010 VM from Brian Keller's blog, Brian also has some great hands on Labs on TFS 2010 that you may want to explore.

I. Lets start building VM – 3: The Test Agent

  • Download the Windows Azure SDK and Tools
  • Open Visual Studio and create a new Windows Azure Project using the Cloud Template

        image 

        Choose the Worker Role for reasons explained in the earlier post

        image

  • The WorkerRole.cs implements the Run() and OnStart() methods, no code changes required. You should be able to compile the project and run it in the compute emulator (The compute emulator should have been installed as part of the Windows Azure Toolkit) on your local machine.

         image

         image

  • We will only be making changes to WindowsAzureProject, open ServiceDefinition.csdef. Ensure that the vmsize is small (remember the cost chart above). Import the “Connect” module. I am importing the Connect module because I need to join the Worker role VM to the Playpit domain.
<span style="color: blue"><?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>"<span style="color: blue">?>
<</span><span style="color: #a31515">ServiceDefinition </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WindowsAzureProject2</span>" 
                    <span style="color: red">xmlns</span><span style="color: blue">=</span>"<span style="color: blue">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition</span>"<span style="color: blue">>
  <</span><span style="color: #a31515">WorkerRole </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WorkerRole1</span>" <font style="background-color: #ffff00"><span style="color: red">vmsize</span><span style="color: blue">=</span>"<span style="color: blue">Small</span>"</font><span style="color: blue">>
    <</span><span style="color: #a31515">Imports</span><span style="color: blue">>
      <</span><span style="color: #a31515">Import </span><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">Diagnostics</span>" <span style="color: blue">/>
      <font style="background-color: #ffff00"><</font></span><font style="background-color: #ffff00"><span style="color: #a31515">Import </span><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">Connect</span>"</font><span style="color: blue"><font style="background-color: #ffff00">/>
</font>    </</span><span style="color: #a31515">Imports</span><span style="color: blue">>
  </</span><span style="color: #a31515">WorkerRole</span><span style="color: blue">>
</</span><span style="color: #a31515">ServiceDefinition</span><span style="color: blue">>
</span>
  • Go to the ServiceConfiguration.Cloud.cscfg and note that settings with key ‘Microsoft.WindowsAzure.Plugins.Connect.%%%%’ have been added to the configuration file. This is because you decided to import the connect module. See the config below.
<span style="color: blue"><?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>"<span style="color: blue">?>
<</span><span style="color: #a31515">ServiceConfiguration </span><span style="color: red">serviceName</span><span style="color: blue">=</span>"<span style="color: blue">WindowsAzureProject2</span>" 
              <span style="color: red">xmlns</span><span style="color: blue">=</span>"<span style="color: blue">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration</span>" <font style="background-color: #ffff00"><span style="color: red">osFamily</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"</font> <span style="color: red">osVersion</span><span style="color: blue">=</span>"<span style="color: blue">*</span>"<span style="color: blue">>
  <</span><span style="color: #a31515">Role </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WorkerRole1</span>"<span style="color: blue">>
    <</span><span style="color: #a31515">Instances </span><font style="background-color: #ffff00"><span style="color: red">count</span><span style="color: blue">=</span>"<span style="color: blue">1</span>"</font> <span style="color: blue">/>
    <</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">UseDevelopmentStorage=true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">ActivationToken</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00"></font></span><span style="color: blue">Refresh</span><span style="color: blue"><font style="background-color: #ffff00"></font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00"></font></span><span style="color: blue">WaitForConnectivity</span><span style="color: blue"><font style="background-color: #ffff00"></font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00"></font></span><span style="color: blue">Upgrade</span><span style="color: blue"><font style="background-color: #ffff00"></font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">EnableDomainJoin</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">DomainFQDN</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">DomainControllerFQDN</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">DomainAccountName</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">DomainPassword</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">DomainOU</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00">Administrators</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffff00"></font></span><span style="color: blue">DomainSiteName</span><span style="color: blue"><font style="background-color: #ffff00"></font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
    </</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
  </</span><span style="color: #a31515">Role</span><span style="color: blue">>
</</span><span style="color: #a31515">ServiceConfiguration</span><span style="color: blue">>
</span>

     

      Let’s go step by step and understand all the highlighted parameters and where you can find the values for them.

    •       osFamily – By default this is set to 1 (Windows Server 2008 SP2). Change this to 2 if you want the Windows Server 2008 R2 operating system. The Advantage of using osFamily = “2” is that you get Powershell 2.0 rather than Powershell 1.0. In Powershell 2.0 you could simply use “powershell -ExecutionPolicy Unrestricted ./myscript.ps1” and it will work while in Powershell 1.0 you will have to change the registry key by including the following in your command file “reg add HKLM\Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell /v ExecutionPolicy /d Unrestricted /f” before you can execute any power shell. The other reason you might want to move to os2 is if you wanted IIS 7.5.
    •       Activation Token – To enable communication between the on premise machine and the Windows Azure Worker role VM both need to have the same token. Log on to Windows Azure Management Portal, click on Connect, click on Get Activation Token, this should give you the activation token, copy the activation token to the clipboard and paste it in the configuration file. Note – Later in the blog I’ll be showing you how to install connect on the on premise machine.

                image

    •       EnableDomainJoin – Set the value to true, ofcourse we want to join the on windows azure worker role VM to the domain.
    •       DomainFQDN, DomainControllerFQDN, DomainAccountName, DomainPassword, DomainOU, Administrators – This information is specific to your domain. I have extracted this information from the ‘service manager’ and ‘Active Directory Users and Computers’. Also, i created a new Domain-OU namely ‘CloudInstances’ so all my cloud instances joined to my domain show up here, this is optional. You can encrypt the DomainPassword – refer to the instructions here. Or hold fire, I’ll be covering that when i come to certificates and encryption in the coming section. 

     Now once you have filled all this information up, the configuration file should look something like below,

<span style="color: blue"><?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>"<span style="color: blue">?>
<</span><span style="color: #a31515">ServiceConfiguration </span><span style="color: red">serviceName</span><span style="color: blue">=</span>"<span style="color: blue">WindowsAzureProject2</span>" 
              <span style="color: red">xmlns</span><span style="color: blue">=</span>"<span style="color: blue">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration</span>" <span style="color: red">osFamily</span><span style="color: blue">=</span>"2" <span style="color: red">osVersion</span><span style="color: blue">=</span>"<span style="color: blue">*</span>"<span style="color: blue">>
  <</span><span style="color: #a31515">Role </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WorkerRole1</span>"<span style="color: blue">>
    <</span><span style="color: #a31515">Instances </span><span style="color: red">count</span><span style="color: blue">=</span>"<span style="color: blue">1</span>" <span style="color: blue">/>
    <</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">UseDevelopmentStorage=true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.ActivationToken</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">45f55fea-f194-4fbc-b36e-25604faac784</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Refresh</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Upgrade</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.EnableDomainJoin</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainFQDN</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">play.pit.com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainControllerFQDN</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">WIN-KUDQMQFGQOL.play.pit.com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainAccountName</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">playpit\Administrator</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainPassword</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">************************</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainOU</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">OU=CloudInstances, DC=Play, DC=Pit, DC=com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Administrators</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">Playpit\Administrator</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainSiteName</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
    </</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
  </</span><span style="color: #a31515">Role</span><span style="color: blue">>
</</span><span style="color: #a31515">ServiceConfiguration</span><span style="color: blue">>
</span>
  • Next we will be enabling the Remote Desktop module in to the ServiceDefinition.csdef, we could make changes manually or allow a beautiful wizard to help us make changes. I prefer the second option. So right click on the Windows Azure project and choose Publish

      image

  • Now once you get the publish wizard, if you haven’t already you would be asked to import your Windows Azure subscription, this is simply the Msdn subscription activation key xml. Once you have done click Next to go to the Settings page and check ‘Enable Remote Desktop for all roles’.

      image

  • As soon as you do that you get another pop up asking you the details for the user that you would be logging in with (make sure you enter a reasonable expiry date, you do not want the user account to expire today). Notice the more information tag at the bottom, click that to get access to the certificate section. See screen shot below.

      image

  • From the drop down select the option to create a new certificate

       image

  • In the pop up window enter the friendly name for your certificate. In my case I entered ‘WAC – Test Rig’ and click ok. This will create a new certificate for you. Click on the view button to see the certificate details. Do you see the Thumbprint, this is the value that will go in the config file (very important). Now click on the Copy to File button to copy the certificate, we will need to import the certificate to the windows Azure Management portal later. So, make sure you save it a safe location.

       image

       image  image  image 

       image  image  image

  • Click Finish and enter details of the user you would like to create with permissions for remote desktop access, once you have entered the details on the ‘Remote desktop configuration’ screen click on Ok. From the Publish Windows Azure Wizard screen press Cancel. Cancel because we don’t want to publish the role just yet and Yes because we want to save all the changes in the config file.

      image

  • Now if you go to the ServiceDefinition.csdef file you will see that the RemoteAccess and RemoteForwarder roles have been imported for you.
<span style="color: blue"><?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>"<span style="color: blue">?>
<</span><span style="color: #a31515">ServiceDefinition </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WindowsAzureProject2</span>" 
                   <span style="color: red">xmlns</span><span style="color: blue">=</span>"<span style="color: blue">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition</span>"<span style="color: blue">>
  <</span><span style="color: #a31515">WorkerRole </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WorkerRole1</span>" <span style="color: red">vmsize</span><span style="color: blue">=</span>"<span style="color: blue">Small</span>"<span style="color: blue">>
    <</span><span style="color: #a31515">Imports</span><span style="color: blue">>
      <</span><span style="color: #a31515">Import </span><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">Diagnostics</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Import </span><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">Connect</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Import </span><font style="background-color: #ffff00"><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">RemoteAccess</span>" </font><span style="color: blue">/>
      <</span><span style="color: #a31515">Import </span><font style="background-color: #ffff00"><span style="color: red">moduleName</span><span style="color: blue">=</span>"<span style="color: blue">RemoteForwarder</span>"</font> <span style="color: blue">/>
    </</span><span style="color: #a31515">Imports</span><span style="color: blue">>
  </</span><span style="color: #a31515">WorkerRole</span><span style="color: blue">>
</</span><span style="color: #a31515">ServiceDefinition</span><span style="color: blue">>
</span>
  • Now go to the ServiceConfiguration.Cloud.cscfg file and you see a whole bunch for setting “Microsoft.WindowsAzure.Plugins.RemoteAccess.%%%” values added for you.
<span style="color: blue"><?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>"<span style="color: blue">1.0</span>" <span style="color: red">encoding</span><span style="color: blue">=</span>"<span style="color: blue">utf-8</span>"<span style="color: blue">?>
<</span><span style="color: #a31515">ServiceConfiguration </span><span style="color: red">serviceName</span><span style="color: blue">=</span>"<span style="color: blue">WindowsAzureProject2</span>" 
                      <span style="color: red">xmlns</span><span style="color: blue">=</span>"<span style="color: blue">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration</span>" <span style="color: red">osFamily</span><span style="color: blue">=</span>"<span style="color: blue">2</span>" <span style="color: red">osVersion</span><span style="color: blue">=</span>"<span style="color: blue">*</span>"<span style="color: blue">>
  <</span><span style="color: #a31515">Role </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">WorkerRole1</span>"<span style="color: blue">>
    <</span><span style="color: #a31515">Instances </span><span style="color: red">count</span><span style="color: blue">=</span>"<span style="color: blue">1</span>" <span style="color: blue">/>
    <</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">UseDevelopmentStorage=true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.ActivationToken</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">45f55fea-f194-4fbc-b36e-25604faac784</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Refresh</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Upgrade</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.EnableDomainJoin</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainFQDN</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">play.pit.com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainControllerFQDN</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">WIN-KUDQMQFGQOL.play.pit.com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainAccountName</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">playpit\Administrator</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.<font style="background-color: #ffc000">DomainPassword</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">************************</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainOU</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">OU=CloudInstances, DC=Play, DC=Pit, DC=com</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.Administrators</span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">Playpit\Administrator</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.Connect.DomainSiteName</span>" <span style="color: red">value</span><span style="color: blue">=</span>"" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteAccess.<font style="background-color: #ffff00">Enabled</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">true</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteAccess.<font style="background-color: #ffff00">AccountUsername</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">Administrator</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteAccess.<font style="background-color: #ffff00">AccountEncryptedPassword</font></span>" 
                <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">MIIBnQYJKoZIhvcNAQcDoIIBjjCCAYoCAQAxggFOMIIBSgIBADAyMB4xHDAaBgNVBAMME1dpbmRvd
                3MgQXp1cmUgVG9vbHMCEGa+B46voeO5T305N7TSG9QwDQYJKoZIhvcNAQEBBQAEggEABg4ol5Xol66Ip6QKLbAPWdmD4ae
                ADZ7aKj6fg4D+ATr0DXBllZHG5Umwf+84Sj2nsPeCyrg3ZDQuxrfhSbdnJwuChKV6ukXdGjX0hlowJu/4dfH4jTJC7sBWS
                AKaEFU7CxvqYEAL1Hf9VPL5fW6HZVmq1z+qmm4ecGKSTOJ20Fptb463wcXgR8CWGa+1w9xqJ7UmmfGeGeCHQ4QGW0IDSBU6ccg
                vzF2ug8/FY60K1vrWaCYOhKkxD3YBs8U9X/kOB0yQm2Git0d5tFlIPCBT2AC57bgsAYncXfHvPesI0qs7VZyghk8LVa9g5IqaM
                Cp6cQ7rmY/dLsKBMkDcdBHuCTAzBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECDRVifSXbA43gBApNrp40L1VTVZ1iGag+3O1</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteAccess.<font style="background-color: #ffff00">AccountExpiration</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">2012-11-27T23:59:59.0000000+00:00</span>" <span style="color: blue">/>
      <</span><span style="color: #a31515">Setting </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteForwarder.<font style="background-color: #ffff00">Enabled</font></span>" <span style="color: red">value</span><span style="color: blue">=</span>"<span style="color: blue">true</span>" <span style="color: blue">/>
    </</span><span style="color: #a31515">ConfigurationSettings</span><span style="color: blue">>
    <</span><span style="color: #a31515">Certificates</span><span style="color: blue">>
      <</span><span style="color: #a31515"><font style="background-color: #ffff00">Certificate</font> </span><span style="color: red">name</span><span style="color: blue">=</span>"<span style="color: blue">Microsoft.WindowsAzure.Plugins.RemoteAccess.<font style="background-color: #ffff00">PasswordEncryption</font></span>" 
                   <font style="background-color: #ffff00"><span style="color: red">thumbprint</span><span style="color: blue">=</span>"<span style="color: blue">AA23016CF0BDFC344400B5B82706B608B92E4217</span>"</font> <span style="color: red">thumbprintAlgorithm</span><span style="color: blue">=</span>"<span style="color: blue">sha1</span>" <span style="color: blue">/>
    </</span><span style="color: #a31515">Certificates</span><span style="color: blue">>
  </</span><span style="color: #a31515">Role</span><span style="color: blue">>
</</span><span style="color: #a31515">ServiceConfiguration</span><span style="color: blue">>
</span>

   

     Okay let’s look at them one at a time,

    •       Enabled - Yes, we would like to enable Remote Access.
    •       AccountUserName – This is the user name you entered while you were on the publish windows azure role screen, as detailed above.
    •       AccountEncrytedPassword – Try and decode that, the certificate is used to encrypt the password you specified for the user account. Remember earlier i said, either use the instructions or wait and i’ll be showing you encryption, now the user account i am using for rdp has the same password as my domain password, so i can simply copy the value of the AccountEncryptedPassword to the DomainPassword as well.
    •       AccountExpiration – This is the expiration as you specified in the wizard earlier, make sure your account does not expire today.
    •       Remote Forwarder – Check out the documentation, below is how I understand it,

      -- One role in an application that implements a remote desktop connection must import the RemoteForwarder module. The two modules work together to enable the remote desktop connections to role instances.

      -- If you have multiple roles defined in the service model, it does not matter which role you add the RemoteForwarder module to, but you must add it to only one of the role definitions.

    •       Certificate – Remember the certificate thumbprint from the wizard, the on premise machine and windows azure role machine that need to speak to each other must have the same thumbprint. More on that when we install Windows Azure connect Endpoints on the on premise machine.
  • As i said earlier, in this blog post, I’ll be showing you the manual process so i won’t be scripting any star up tasks to install the test agent or register the test agent with the TFS Server. I’ll be showing you all this cool stuff in the next blog post, that’s because it’s important to understand the manual side of it, it becomes easier for you to troubleshoot in case something fails.

Having said that, the changes we have made are sufficient to spin up the Windows Azure Worker Role aka Test Agent VM, have it connected with the play.pit.com domain and have remote access enabled on it. Before we deploy the Test Agent VM we need to set up Windows Azure Connect on the TFS Server.

II. Windows Azure Connect: Setting up Connect on VM – 2 i.e. TFS & Test Controller

Glad you made it so far, now to enable communication between the on premise TFS/Test Controller and Azure-ed Test Agent we need to enable communication. We have set up the Azure connect module in the Test Agent configuration, now the connect end points need to be enabled on the on premise machines, let’s have a look at how we can do this.

  • Log on to VM – 2 running the TFS Server and Test Controller
  • Log on to the Windows Azure Management Portal and click on Virtual Network
  • Click on Virtual Network, if you already have a subscription you should see the below screen shot, if not, you would be asked to complete the subscription first

       image

  • Click on Install Local Endpoints from the top left on the panel and you get a url appended with a token id in it, remember the token i showed you earlier, in theory the token you get here should match the token you added to the Test Agent config file.

       image

  • Copy the url to the clip board and paste it in IE explorer (important, the installation at present only works out of IE and you need to have cookies enabled in order to complete the installation). As stated in the pop up, you can NOT download and run the software later, you need to run it as is, since it contains a token. Once the installation completes you should see the Windows Azure connect icon in the system tray.

        image

        image

        Right click the Azure Connect icon, choose Diagnostics and refer to this link for diagnostic detail terminology.

    • NOTE – Unfortunately I could not see the Windows Azure connect icon in the system tray, a bit of binging with Google revealed that the azure connect icon is only shown when the ‘Windows Azure Connect Endpoint’ Service is started. So go to services.msc and make sure that the service is started, if not start it, unfortunately again, the service did not start for me on a manual start and i realised that one of the dependant services was disabled, you can look at the service dependencies and start them and then start windows azure connect. Bottom line, you need to start Windows Azure connect service before you can proceed. Please refer here on MSDN for more on Troubleshooting Windows Azure connect. (Follow the next step as well)

 

  • Now go back to the Windows Azure Management Portal and from Groups and Roles create a new group, lets call it ‘Test Rig’. Make sure you add the VM – 2 (the TFS Server VM where you just installed the endpoint).

      image

  • Now if you go back to the Azure Connect icon in the system tray and click ‘Refresh Policy’ you will notice that the disconnected status of the icon should change to ready for connection.

III. Importing Certificate in to Windows Azure Management Portal

But before that you need to import the certificate you created in Step I in to the Windows Azure Management Portal.

  • Log on to the Windows Azure Management Portal and click on ‘Hosted Services, Storage Accounts & CDN’ and then ‘Management Certificates’ followed by Add Certificates as shown in the screen shot below

       image

  • Browse to the location where you saved the certificate earlier, remember… Refer to Step I in case you forgot.

       image

  • Now you should be able to see the imported certificate here, make sure the thumbprint of the certificate matches the one you inserted in the config files

       image

IV. Publish Windows Azure Worker Role aka Test Agent

Having completed I, II and III, you are ready to publish the Test Agent VM – 3 to the cloud.

  • Go to Visual Studio and right click the Windows Azure project and select Publish. Verify the infomration in the wizard, from the advanced settings tab, you can also enabled capture of intellitrace or profiling information.

      image  image

  • Click Next and Click Publish! From the view menu bar select the Windows Azure Activity Log window.

      image

  • Now you should be able to see the deployment progress in real time.

      image

      In the Windows Azure Management Portal, you should also be able to see the progress of creation of a new Worker Role.

      image

  • Once the deployment is complete you should be able to RDP (go to run prompt type mstsc and in the pop up the machine name) in to the Test Agent Worker Role VM from the Playpit network using the domain admin user account. In case you are unable to log in to the Test Agent using the domain admin user account it means the process of joining the Test Agent to the domain has failed! But the good news is, because you imported the connect module, you can connect to the Test Agent machine using Windows Azure Management Portal and troubleshoot the reason for failure, you will be able to log in with the user name and password you specified in the config file for the keys ‘RemoteAccess.AccountUsername, RemoteAccess.EncryptedPassword (just that enter the password unencrypted)’, fix it or manually join the machine to the domain. Once you have managed to Join the Test Agent VM to the Domain move to the next step.

     image

  • So, log in to the Test Agent Worker Role VM with the Playpit Domain Administrator and verify that you can log in, the machine is connected to the domain and the connect service is successfully running. If yes, give your self a pat on the back, you are 80% mission accomplished!

      image 

  • Go to the Windows Azure Management Portal and click on Virtual Network, click on Groups and Roles and click on Test Rig, click Edit Group, the edit the Test Rig group you created earlier. In the Connect to section, click on Add to select the worker role you have just deployed. Also, check the ‘Allow connections between endpoints in the group’ with this you will enable to communication between test controller and test agents and test agents/test agents. Click Save.

     image

Now, you are ready to deploy the Test Agent software on the Worker Role Test Agent VM and configure it to work with the Test Controller.

V. Configuring VM – 3: Installing Test Agent and Associating Test Agent to Controller

Log in to the Worker Role Test Agent VM that you have just successfully deployed, make sure you log in with the domain administrator account.

  • Download the All Agents software from MSDN, ‘en_visual_studio_agents_2010_x86_x64_dvd_509679.iso’, extract the iso and navigate to where you have extracted the iso. In my case, i have extracted the iso to “C:\Resources\Temp\VsAgentSetup”. Open the Test Agent folder and double click on setup.exe. Once you have installed the Test Agent you should reach the configuration window. If you face any issues installing TFS Test Agent on the VM, refer to the walkthrough on MSDN.

      image

  • Once you have successfully installed the Test Agent software you will need to configure the test agent. Right click the test agent configuration tool and run as a different user. i.e. an Administrator. This is really to run the configuration wizard with elevated privileges (you might have UAC block something's otherwise).

       image

  • In the run options, you can select ‘service’ you do not need to run the agent as interactive un less you are running coded UI tests. I have specified the domain administrator to connect to the TFS Test Controller. In real life, i would never do that, i would create a separate test user service account for this purpose. But for the blog post, we are using the most powerful user so that any policies or restrictions don’t block you.

       image

  • Click the Apply Settings button and you should be all green! If not, the summary usually gives helpful error messages that you can resolve and proceed. As per my experience, you may run in to either a permission or a firewall blocking communication issue.

       image

  • And now the moment of truth! Go to VM –2 open up Visual Studio and from the Test Menu select Manage Test Controller

      image

  • Mission Accomplished! You should be able to see the Test Agent that you have just configured here,

      image

 

VI. Creating and Running Load Tests on your brand new Azure-ed Test Rig

I have various blog posts on Performance Testing with Visual Studio Ultimate, you can follow the links and videos below,

Blog Posts:

- Part 1 – Performance Testing using Visual Studio 2010 Ultimate

- Part 2 – Performance Testing using Visual Studio 2010 Ultimate

- Part 3 – Performance Testing using Visual Studio 2010 Ultimate

Videos:

- Test Tools Configuration & Settings in Visual Studio

- Why & How to Record Web Performance Tests in Visual Studio Ultimate

- Goal Driven Load Testing using Visual Studio Ultimate

Now that you have created your load tests, there is one last change you need to make before you can run the tests on your Azure Test Rig, create a new Test settings file, and change the Test Execution method to ‘Remote Execution’ and select the test controller you have configured the Worker Role Test Agent against in our case VM – 2

image

So, go on, fire off a test run and see the results of the test being executed on the Azur-ed Test Rig. In love

Review and What’s next?

A quick recap of the benefits of running the Test Rig in the cloud and what i will be covering in the next blog post AND I would love to hear your feedback!

Advantages

  • Utilizing the power of Azure compute to run a heavy virtual user load.
  • Benefiting from the Azure flexibility, destroy Test Agents when not in use, takes < 25 minutes to spin up a new Test Agent.
  • Most important test Network Latency, (network latency and speed of connection are two different things – usually network latency is very hard to test), by placing the Test Agents in Microsoft Data centres around the globe, one can actually test the lag in transferring the bytes not because of a slow connection but because the page has been requested from the other side of the globe.

Next Steps

The process of spinning up the Test Agents in windows Azure is not 100% automated. I am working on the Worker process and power shell scripts to make the role deployment, unattended install of test agent software and registration of the test agent to the test controller automated. In the next blog post I will show you how to make the complete process unattended and automated.

Remember to subscribe to http://feeds.feedburner.com/TarunArora. Hope you enjoyed this post, I would love to hear your feedback! If you have any recommendations on things that I should consider or any questions or feedback, feel free to leave a comment.

See you in Part III.

 

Share this post :

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)