Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Jenkins to Azure Container Registry Build Status

The template allows you to host an instance of Jenkins on a DS1_v2 size Linux Ubuntu 16.04 LTS VM in Azure. It will also create an Azure Container Registry and return the full registry URL.

You can optionally include a basic Jenkins pipeline that will checkout a user-provided git repository with a Dockerfile embedded and it will build and push the Docker container in the provisioned Azure Container Registry.

A. Deploy an Azure Container Registry and a Jenkins VM with an embedded Docker build and publish pipeline

  1. Click the "Deploy to Azure" button. If you don't have an Azure subscription, you can follow instructions to signup for a free trial.
  2. Enter the desired user name and password for the VM that's going to host the Jenkins instance. Also provide a DNS prefix for your VM.
  3. Enter the appId and appKey for your Service Principal (used by the Jenkins pipeline to push the built docker container). If you don't have a service principal, use the Azure CLI 2.0 to create one (see here for more details):
    az login
    az account set --subscription <Subscription ID>
    az ad sp create-for-rbac --name "Jenkins"

    NOTE: You can run az account list after you login to get a list of subscription IDs for your account.

  4. Enter a public git repository. The repository must have a Dockerfile in its root.

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 -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. Click Open to establish the connection.

If you are using Linux or Mac:

Run this command:

ssh -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://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://< Public DNS name of instance you just created >.
  4. Go to http://aka.ms/azjenkinsagents if you want to build/CI from this Jenkins master using Azure VM agents.

Questions/Comments? azdevopspub@microsoft.com