CI/CD pipeline using Jenkins with Azure

Firstly, we need to navigate to the active directory service, which you can see in the following screenshot:

Now we need to register our application, so, select the App registrations link in the left pane. You will see a screen similar to the next one, where you need to provide your application details:

  1. After this, you will be able to generate the key which will be needed to access your Jenkins job.
  2. You will see the following screen, which has the secret key's details, and you will also find other details such as the Object ID and Application ID on the same page:

Now we have the required information to configure the job in Jenkins. So, navigate to the Jenkins console, go to manage plugins in the Manage Jenkins section, and install the plugin, Azure VM agents.

Once the plugin is installed, go to Manage Jenkins, and click on Configure System, as shown in the next screenshot:

In the next screen, scroll to the bottom section called Cloud, click on the button Add cloud, and choose the new Microsoft Azure VM Agents option. This will generate a section on the same page.

You can read more about the MS Azure VM Agents plugin in its documentation (https://wiki.jenkins.io/display/JENKINS/Azure+VM+Agents+plugin).

In the last screen, you need to add your Azure credentials that we had generated previously. If you click on the Add button, which you can see in the following screen, you can add values such as Subscription ID, and so on:

In the next part of the same section, you need to provide the configuration of the VM's details such as the template, VM type, and others:

In the preceding screenshot, Labels is the most important attribute, which we will be using in Jenkins jobs to identify the group.

Now you need to provide the operation you want to perform, that is, if you want to deploy your application, you can provide the command to download the code and run the application.

Click on Save to apply the settings.

Now, create a new job in Jenkins. Also, in the GitBucket section, where you generally provide the repository details, you will find a new checkbox saying Restrict where this project can be run and asking you to provide the Label Expression name. In our case, it is msubuntu. That's it!

Now we are all set to run our Jenkins job to deploy our application on the VM (that is, the app server).

Finally, we are able to deploy our application on the Azure platform.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.36.72