Build Agents and Pools
Configuring API Access
The course is part of this learning path
Azure DevOps has many great tools for implementing and managing your build infrastructure, and this course walks you through how to use them. With a mix of theory and real-life demonstrations from the Azure portal, you will learn how to create Azure pipelines, use them to integrate 3rd party build systems, utilize agent pools, and learn how to put it all together to set up an automated workflow that can potentially save you hundreds of man-hours. So, whether you’re here to learn more about DevOps, improve your development process, or learn more about Azure DevOps in particular, this course will help get you further along your path.
For any feedback, queries, or suggestions relating to this course, please contact us at email@example.com.
- Learn how to build an Azure DevOps pipeline and add automation tasks
- Use the visual designer for adding build tasks to a pipeline
- Create a pipeline that closely matches an existing build process
- Determine a pipeline strategy based on the information given to you during a discovery process
This course is intended for:
- IT professionals looking to become certified DevOps professionals
- IT professionals experienced with other cloud providers who want to gain a better understanding of Azure
- Anyone who wants a better understanding of Azure build infrastructure processes
To get the most from this course, you should have some understanding of the software development process, at least at a high level, as well as an understanding of what DevOps is and the terminology related to it.
In this demo, I'm going to show you how to create a Linux VM using cloud-init to spin up the virtual machine and install Jenkins. Jenkins is a build automation server that you can integrate with Azure to scale out your build capacity.
So, the first thing we need to do is create a working directory and a new text file. We'll call the text file cloud init Jenkins, cloud-init-jenkins.txt. And from there, we will copy the cloud-init contents from the Microsoft documentation located at this URL.
This is the file that will be used to download and install Jenkins to the Linux virtual machine using the cloud-init process. Let me just quickly create the cloud-init file here and copy the file contents from the URL I mentioned earlier.
Now that the file is ready, the next thing we need to do is make sure that we have the Azure CLI, or command-line interface installed. If you do not have Azure CLI installed, you can find here at this URL. I already have the Azure CLI installed, so I am not going to install it. But if you are working on Windows, then you can simply download and install the MSI package and that works just fine.
You can check to see if you already have the Azure CLI installed by opening a command prompt and typing
az --version. This will also tell you if Azure CLI is installed, which version of the Azure CLI it is, and if there is an update available or not.
The first thing that you might need to do if you do not already have a resource group is to create one, I will just quickly show you how to create a resource group for your Jenkins VM. The command is az, for the Azure CLI, group, for the resources group context, now we specify the create command and then we specify a name with the name attribute, and a location with the location attribute. That's all there is to create a resource group using the Azure CLI.
The next thing we need to do is to create a virtual machine that our Jenkins server will be installed on. Since we're using the Azure command line interface, all commands start with az, then we are working with a virtual machine context, so we type vm, now we specify the create command, and add the parameters. The first parameter is resource-group, and this tells Azure the name of the resource group we want to add the virtual machine to. The next attribute is name, this is the name you want to give your virtual machine. Then we need to specify the machine image using the image attribute, in our case, we want to use the latest version of Ubuntu, so we're going to enter UnbuntuLTS. Now we specify the initial admin username and use the generate-ssh-keys attribute to create the public and private encryption keys for our new virtual machine.
Finally, we use the custom-data attribute to specify our cloud-init file that tells the template which software to install on our new machine. If the cloud-init file is not in your current working directory, you need to specify the entire path to the file.
It will take a few minutes to install, once it's installed, make sure to take note of your public IP address, we're going to need it later.
Now that our virtual machine is created, we need to allow incoming communications with our Jenkins server on a specific port. So we will use the open port command to update our network security group and add an entry to our inbound port rules.
The command is
az vm, our resource group, our virtual machine name, what port we want to open, and what priority we want to use for the inbound port rule. We are going to use 8080 for the port and 1001 for the priority. If you are not sure what to use for the port and priority, check with your network administrator, they should be able to tell you what these values should be.
After we have opened the port to allow communication to our Jenkins server, we now need to remotely connect to our new VM over SSH. Once we have successfully connected, we can check to see if our Jenkins service is running by typing
service jenkins status and we should get a message telling us that the service is loaded.
Now that we know the service is running, we need to get the initial password that was created when the service was installed. We can do that by printing it out to the screen using
sudo cat command, along with the file path to the initial password file. The file is located at the following path: /var/lib/jenkins/secrets/initialAdminPassword
Once we have our password, it's time to open our browser and navigate to our Jenkins server. We can find it at the public IP address we got when we created our virtual machine, followed by a colon with the port number we opened in our firewall. If you need to find the public IP address again, you can go to the VM in Azure and it will show you the public IP address on the overview screen for the virtual machine.
This will bring us to a page where we can unlock our Jenkins server by using the password that we printed to the screen previously. I will just paste that here and click Continue. The next page is where we can decide if we want to just install the most common Jenkins plugins or if we want to select additional plugins to add. We need to add the GitHub plugin, so I will click on the select plugins option on the right.
This page shows all the plugins that will be installed, and this is where we can search for additional plugins and select them. I will search for the GitHub plugin, and check the checkbox and click Install.
Now Jenkins will install all the plugins that were selected. And I'll just speed up the time. So now that that's done, we need to create our first admin user.
I will just add the relevant information and create the user. Finally, the last thing we need to configure is a friendly URL for our Jenkins server. If you are going to use a DNS entry for your Jenkins server, then this is when you would add the friendly domain address. The root address is needed for almost everything that Jenkins does, so it is good to put the user-friendly address in now so that you can avoid confusion later.
Now our Jenkins server is installed and ready to use. I hope you enjoyed this demo, and I'll see you in our next module.
About the Author
As well being the owner and CTO of Sharp Solutions Group, a software development and IT staffing company based in the Philippines, Kelso is a Microsoft Certified professional and an avid knowledge seeker. His belief is that you need to learn something new each day to stay on top of the constantly changing IT world. He is an avid gamer (both video games and board games) and lives in the Philippines with his wife and soon-to-be-delivered son.