Title: How to create azure vm using Jenkins pipeline
Rushikesh Bhor
Certified Cloud Engineer/DevOps Engineer @TheMaverics Technologies Pvt Ltd || AWS || Azure || Git/GitHub || Docker || Kubernetes || Jenkins || CI/CD || Linux Administration || Ansible/Chef || Terraform || Bicep
? Why Should i Write a Technical Blog:
When my manager asked me to do this task, after reading many documentations and searching on many different websites, I did not find complete information about this task anywhere, for that I also took the support of YouTube, but I did not get complete information there, but on the basis of the information received, I completed each part of the task under the guidance of the senior. Completed the entire hour well .After finishing today I felt to help many people by writing documentation about this in a good complete form so I am writing this complete blog which will surely benefit many people.
? Task description:?
In this task we are going to learn how to create vm through the jenkins Pipeline, we can create one or more vms at a time with help of azure CLI code.
? Prerequisite:
?1.You should have installed Azure cli on your system.
?2.You should have azure account with permission owner or contributor.
?3 You should have installed and configure jenkins on your system.
?After all installation & configuration now you are ready to go…!!
? Stepwise performance:
1.To start jenkins and install Azure CLI & Azure credential plugins.
2. Login your azure account open azure CLI create a service principal perform following command in??azure cli
az ad sp create-for-rbac - -name “serviceapp” --role contributor –scope “paste resource group location”
you get resource group location click on resource group -> select resource group -> properties ->Resource ID copy path then paste to above command
We get output in following form?
Appid = client id
Displayname??
Password = secret
领英推荐
Tenant = tenant id
???????
? Information about output term:?
Subscription ID: This is the unique identifier for your Azure subscription. It can be found in the Azure portal under "Subscriptions".
Tenant ID: This is the unique identifier for your Azure Active Directory (AAD) tenant. It can be found in the Azure portal under "Azure Active Directory" -> "Properties".
Client ID: This is the application ID for the service principal that will be used to authenticate with Azure.?
Client Secret: This is the secret that is associated with the client ID.?
3. Again go to jenkins?go to manage jenkins ->manage credential ->system ->global credential ->add credential fill some detail we get from after creation of service principal in azure cli?
4. In jenkins dashboard select new project then select freestyle project?
5. Then under build environment ->user secret text or file -> add ->Microsoft azure service principal
6. Next select build step ->add build step -> select last option azure cli
?7. In service principal select key of credential and add azure cli script of vm in command section?
?8. last step save all these steps and run job
After completing all these steps, you should go to your azure account in the virtual machine section, you will see a virtual machine created in the azure account with the same name as the machine created in it Jenkins pipeline.
That's how I completed my task successfully.
I would like to thanks to?Sir for giving this challenging task. While doing this task, I learnt a lot of things related to Azure, jenkins.
If you have any doubt or suggestions you're most welcome, just DM me or can ask in Comments.
Looking for a job in fields of Linux System, Cloud, DevOps, VMWare, Networking, Network security
9 个月Oo ook j
Lead Auditor at EXTECH CERTIFICATIONS AND TECHNOLOGY SERVICES PVT LTD
2 年Good
Senior Cloud Engineer - Nagarro | Google Cloud Certified {"CDI, ACE , PCA, PDE}|Cloud DevOps Specialist | 5x GCP , Azure Certified | Devops | Linux | Docker | Terraform | Jenkins CI/CD | Kubernetes
2 年Beautifully explained ?? Rushikesh Bhor
Associate Consultant | Java | Struts| Spring| Spring MVC | Spring boot| Microservices
2 年Congratulations keep it up ??
Assistant Manager at Maruti Suzuki || Automotive R&D || Ex-ARAI
2 年??????? ????