Installing Jenkins on Azure VM – Cloud Support

1. Create jenkin.txt file with below contents

#cloud-config

package_upgrade: true

write_files:

– path: /etc/systemd/system/docker.service.d/docker.conf

Content:

[Service]

ExecStart=

ExecuteStart=/usr/bin/dockerd

-path: /etc/docker/daemon.json

Content:

{ hosts”: {“fd://”,”tcp://localhost:2375″}

runcmd:

-wget -q -O – https://jenkins-ci.org/debian/jenkins-ci.org.key |apt-key add –

-sh -c ‘echo db http://pkg.jenkins-ci.org/debian-stable binary/> /etc/apt/source.list.d/jenkins.list’

-apt-get update && https://get.docker.com/ | sh

-usermod -aG docker jenkins

-service jenkins start

2. Login using azure cli using following command

az login

3. Create resource group using below command

az group create –name Jenkins –location eastus

4. Create azure cli to create vm with passing custom-data parameter and pass file created in step 1

az vm create –resource-group Jenkins \

–name \

–image UbuntuLTS \

–admin-username jenkins \

–generate-ssh-keys \

–custom-data jenkins.txt

5. To allow web traffic run the following commands

az vm open-port –resource-group Jenkins –name testvm –port 8080 –priority 1001

az vm open-port –resource-group Jenkins –name testvm –port 1337 –priority 1002

6. For configuring vm ssh to the VM and get the initial secrets

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

7. Connect using public ip and configure Jenkins use below url

https://<public-ip>:8080

You may need to wait if page is not showing up.

8. Jenkins is ready to use on Azure.

Leave a Reply

Your email address will not be published.