Steps:
- Create an Azure Resource Group project in Visual Studio for managing your DTL.
- Add a Virtual Network resource to the template
- Add a DevTest Lab resource to the template
- In the portal, bind the virtual network to the DTL in the Settings tab of the DTL
- 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.
- 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
- 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:
PS> Enable-PSRemoting
PS> Set-NetFirewallRule –Name "WINRM-HTTP-In-TCP-PUBLIC" –RemoteAddress Any -LocalPort 5986
PS> Set-ExecutionPolicy RemoteSigned
PS> dir WSMan:\localhost\listener\*\Port # show the port on which WSMan is currently listening
PS> winrm set winrm/config/Listener?Address=*+Transport=HTTP '@{Port="5986"}' # Change the port on which WSMan runs, option 1
PS> Set-Item WSMan:\localhost\listener\*\Port 5986 # Change the port on which WSMan runs, option 2
- 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
- From another machine, run the following to ensure that your machine is connectable:
Test-WSMan -ComputerName mymachinedns.westus.cloudapp.azure.com -Port 5986
$sessionOpt = New-PSSessionOption -SkipCACheck
$session = New-PSSession -ComputerName [myvmname].westus.cloudapp.azure.com -Credential (Get-Credential) -Port 5986 -UseSSL -SessionOption $sessionOpt