This is 5 part blog series, on how to “Cost Optimization for On-demand Private Build Server for SharePoint”. Although I specifically write this for SharePoint’s build server, however the concept and ideas is also applicable for anyone looking for optimizing their cost running private CI/CD (Continuous Integration/Continuous Delivery) in Visual Studio online. The series in these articles are:
- Part 1, Introduction to Visual Studio Online Build and Release Agent
- Part 2, Cost Analysis and Optimizing Cost
- Part 3, Step-by-Step Creation Private Build Server for SharePoint
- Part 4, Azure Automation Service
- Part 5, Integrates Azure Automation Service in Build Pipeline
In Part 2, we know that the cost will be much cheaper if we choose Azure VM RI (Reserved Instance) compared to Pay As You Go. However this options is not match one-to-one with Hosted Pipeline options. At the end of Part 2, I presented the usage pattern of build/release pipeline, and turned out that we need just a fraction of monthly VM uptime to serve our build/release hours requirement. Based on the calculation using Pay As You Go price, our actual fraction needs for build server in Azure using B2S VM is USD 1.04 / month.
Step-by-Step Creation Private Build Server for SharePoint
We are going to create B2S Azure VM running Windows Server 2016 OS and some additional software to serve as our private build server. This part, will provide step-by-step guidance on how to prepare the private build server.
- Azure subscription (start for free here, https://azure.microsoft.com/en-us/)
- Visual Studio Team Service (start for free here, https://www.visualstudio.com/team-services/)
- SharePoint Server 2016 installer
Step-1, Create VM using Visual Studio Enterprise 2017 template
- After you login to Azure Portal, click + Create a resource
- Type “Visual Studio Enterprise 2017” in search box, and select “Visual Studio Enterprise 2017 (latest release) on Windows Server…”
- Select “Resource Manager” in the deployment model, and click “Create”
- Complete the VM creation wizard, most importantly choose “Virtual machine size” B2S.
Press “View all” when you are in step 2 Choose Virtual machine size, to show all available VM size.
- Select “I give Microsoft permission..”. And click “Create”, in the last wizard page.
Step-2, Install SharePoint and additional software
- Login to the new VM by click on “Connect” to launch Remote Desktop
- In order to use as SharePoint build machine, I install SharePoint 2016 without configuring. I will not cover SharePoint 2016 installation, since you can follow the normal SharePoint 2016 installation – and you just need to stop when the installer request to run “SharePoint Configuration Wizard”
- I also install other software in build server:
- NodeJS (https://nodejs.org/en/)
- Phyton2 build tools, run
- Yeoman, run
- @microsoft/generator-sharepoint, run
- I open Visual Studio 2017 desktop application, to check for updates.
Step-3, Install Build/Release Agent
- Login to VSTS using your tenant account, and Click Settings -> Agent Pool
Click Download agent, to download agent to the VM
- Once you click the “Download agent” it will show how to configure agent in different environment (Windows, OS X, or Linux). I select Windows, since our build server is Windows Server 2016.
- Follow the instruction, by extracting the zip file and run .\config.cmd.
For the server URL, enter your VSTS tenant url.
For authentication type, select PAT (just press enter)
Create PAT for your agent, and enter in the personal access token entry.
- If everything successful, you will see your private hosted agent will be shown in VSTS immediately.