WEBSITE 1: I had a single ASP.NET MVC site in Visual Studio online and was building and then releasing from the Visual Studio Online to that Virtual machine.
WEBSITE 2: I decided to create another Solution/Project in Visual Studio online and run it off the same Virtual Machine (with continuous integration, etc). As part of setting up Deployment Groups for that project, I wanted to add the same virtual machine as for project 1 (I believe I cannot share Deployment Groups between projects).
When I executed the VSTS Agent script for site 2 on the virtual machine, the first website's target went "offline", and the machine lit up in the SITE 2 Deployment Group, disappearing from SITE 1 Deployment Group.
There seems to be only one VSTS Agent that can be set up to receive website deployments:
Question: How can I set up the same virtual machine with IIS to receive deployments for two separate websites within the same VS Online account? Is there a way to set up multiple VSTS Agents on a Azure Virtual machine?
It is possible to deploy multiple agents for VSTS in a machine. You can use steps below to achieve this in azure VM or any single machine, when setting up deployment groups.
Copy the target registration PowerShell script to a notepad. Then replace the
$env:SystemDrive\'vstsagent'
with a local path of your preference for agent for example
'g:\vstsagentprojX'
This will make the agent installed for project X deployment group setup in g:\vstsagentprojX.
Replace
--agent $env:COMPUTERNAME
in the script with project specific name for example
--agent chamindac.projx
and with a unique service name since you have provided a project specific name for agent.
Follow steps similar to the other project and change its PowerShell script to have the
$env:SystemDrive\'vstsagent'
replace with project specific path for local folder say
'g:\vstsagentprojQ'
Then change --agent $env:COMPUTERNAME to a project specific name such as
--agent chamindac.projq
Then run the script to create the deployment group agent for the second project.
This will create two agent services with unique names in the same machine.
You should have two targets in two team project deployment groups, online.