Skip to content

Latest commit

 

History

History
 
 

101-jenkins-with-ssh-public-key

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Jenkins on Azure (SSH key) Build Status

This template allows you to host an instance of Jenkins on a DS1_v2 size Linux Ubuntu 14.04 LTS VM in Azure. For more information regarding this template and how it secures Jenkins on Azure, refer to http:https://aka.ms/secure-jenkins.

A. Deploy Azure Jenkins VM

  1. Click "Deploy to Azure" button. If you haven't got an Azure subscription, it will guide you on how to signup for a free trial.
  2. Enter a valid name for the VM, as well as a user name and ssh public key that you will use to login remotely to the VM via SSH.
  3. Remember these. You will need this to access the VM next.

B. Setup SSH port forwarding

By default the Jenkins instance is using the http protocol and listens on port 8080. Users shouldn't authenticate over unsecured protocols!

You need to setup port forwarding to view the Jenkins UI on your local machine. If you do not know the full DNS name of your instance, go to the Portal and find it in the deployment outputs here: Resource Groups > {Resource Group Name} > Deployments > {Deployment Name, usually 'Microsoft.Template'} > Outputs

If you are using Windows:

Install Putty or use any bash shell for Windows (if using a bash shell, follow the instructions for Linux or Mac).

Run this command:

putty.exe -ssh -i <path to private key file> -L 8080:localhost:8080 <User name>@<Public DNS name of instance you just created>

Or follow these manual steps:

  1. Launch Putty and navigate to 'Connection > SSH > Tunnels'
  2. In the Options controlling SSH port forwarding window, enter 8080 for Source port. Then enter 127.0.0.1:8080 for the Destination. Click Add.
  3. Navigate to 'Connection > SSH > Auth' and enter your private key file for authentication. For more information on using ssh keys with Putty, see here.
  4. Click Open to establish the connection.

If you are using Linux or Mac:

Run this command:

ssh -i <path to private key file> -L 8080:localhost:8080 <User name>@<Public DNS name of instance you just created>

C. Connect to Jenkins

  1. After you have started your tunnel, navigate to http:https://localhost:8080/ on your local machine.
  2. Unlock the Jenkins dashboard for the first time with the initial admin password. To get this token, SSH into the VM and run sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  3. Your Jenkins instance is now ready to use! You can access a read-only view by going to http:https://< Public DNS name of instance you just created >.
  4. Go to http:https://aka.ms/azjenkinsagents if you want to build/CI from this Jenkins master using Azure VM agents.

Questions/Comments? [email protected]