Setup Own/Custom Agent Pool And Run as Service Using Virtual Machine
(Neither Default Nor Microsoft Agent Pools)
Create Virtual Machine
To set up a self-hosted agent, we need a VM for that, a virtual machine
Open Portal.Azure.com
- Create a Virtual Machine
- Create Resource Group Name (devops-rg)
- Give VM name (devops-vm)
- Credentials
- Check both HTTP and SSH as inbound ports
- Other settings as
- IMP: So whatever resources you're creating on cloud, as soon as you're done with your practice, make sure you delete it.
Create Custom Agent Pool
- Agent pool can be created at the organization level and at the project level also
- If you create an organization level, the agent pool will be available to all the projects. If you create a project level it will be available to this project. Later, if you want to share it with some other project, even that is possible.
- We are creating at project level
- Go to Project Setting
- Show two type of agents
- Azure Pipelines - MS Hosted Pipelines
- Default- All Self Hosted Agent will be listed **
Add/Insert Custom Application Pool
- Don't click either option Azure pipelines and Default. lets create our own Agent Pool
- Click ‘New Pool’ Button
- Click Create button
- A new Pool is created and listed in Agent Pool
- Click linux-AP
- A pool is nothing, but it's a bucket in which you will be creating your agents. all your VMs will be added to these. These pool.
- The benefit of using this pool is you get multiple options. You can have your pool details, you can manage the security of your agent. From here you can add approvals directly at your agent. So if any any task is executing using this pool, you can have approvals added that needs to be approved. You can look for the analytics, how the pool is getting consumed and things like that.
Check your VM at your local
- Go to VM just created in protal.azure. copy Public Ip Address
- For Mac user SSH
- For windows use Git Shell
- Open Git shell (Use Public IP of your VM)
- ssh <vm_username>@<vm-public_ip>
- Ask for finger print type yes
- you are connected nos
- Check Host name
- Open Git shell (Use Public IP of your VM)
Add Agent
- click add new agent
- Download for your OS and follow instruction - See here
- follow all instructions
- select your Agent Pool
- This is the folder where the artifacts and everything will be created.
Run your local agent
Cross check Agent Pool Connection in DevOps