Tuesday, June 28, 2016

Building a developer test lab with Test Controllers and Agents in VSTS

Microsoft has recently released their DevTest Lab resources to production in Azure. This great functionality can let you quickly build up a lab where you can test your products and tear it down.

Steps:

  1. Create an Azure Resource Group project in Visual Studio for managing your DTL.
  2. Add a Virtual Network resource to the template
  3. Add a DevTest Lab resource to the template
  4. In the portal, bind the virtual network to the DTL in the Settings tab of the DTL
  5. Create a Virtual Machine to host your software. Use a Formula to install any pre-requisites that you want on the machine: e.g. Chrome, Notepad++, etc.
    1. As a pre-requisite for connecting to a vNext workflow, you **MUST** have the Azure PowerShell cmdlets installed on the machine as part of the Formula for the VM
  6. On the virtual machine, open a PowerShell console and enable remoting along with adding a corresponding firewall rule to remove the local-subnet-access-only restriction that's set by default:
    1. PS> Enable-PSRemoting
    2. PS> Set-NetFirewallRule –Name "WINRM-HTTP-In-TCP-PUBLIC" –RemoteAddress Any -LocalPort 5986
    3. PS> Set-ExecutionPolicy RemoteSigned
    4. PS> dir WSMan:\localhost\listener\*\Port # show the port on which WSMan is currently listening
    5. PS> winrm set winrm/config/Listener?Address=*+Transport=HTTP '@{Port="5986"}' # Change the port on which WSMan runs, option 1
    6. PS> Set-Item WSMan:\localhost\listener\*\Port 5986 # Change the port on which WSMan runs, option 2
    7. Configure the machine as per the tools here, which is essentially the same as the above steps, with some extra ones as well: https://github.com/Azure/azure-quickstart-templates/tree/master/201-vm-winrm-windows
  7. From another machine, run the following to ensure that your machine is connectable:
    1. Test-WSMan -ComputerName mymachinedns.westus.cloudapp.azure.com -Port 5986
    2. $sessionOpt = New-PSSessionOption -SkipCACheck
    3. $session = New-PSSession -ComputerName [myvmname].westus.cloudapp.azure.com -Credential (Get-Credential) -Port 5986 -UseSSL -SessionOption $sessionOpt

No comments:

Post a Comment