How to Install Jenkins in an Azure Web App

I have been writing a lot lately on Jenkins and how to integrate it with Visual Studio Team Services.  The Jenkins server I used for those blog post was installed on a Azure Windows Server VM.  Today I was curious if I could install Jenkins using an Azure Web App instead.  This blog post will describe what I had to do to install Jenkins in an Azure Web App.

The first thing you need to do is create the Azure Web App in the Azure portal.

  1. Sign in to https://portal.azure.com/
  2. Click New
  3. Click Web + Mobile
  4. Click Web App
  5. Fill in the required values
  6. Click Create

Once the Web App is created, we have to configure it to support Java.

  1. Click Resource groups
  2. Click the resource group used when you created the Web App
  3. From the Resources list click the Web App
  4. From the Settings blade click Application settings
    Field Value
    Java version Java 8
    Java Minor version Newest
    Web container Newest Tomcat 8.0
    Platform 64-bit
  5. Add App setting 
    Field Value
    Key JENKINS_HOME
    Value d:\home\site\wwwroot\webapps\ROOT
  6. Click Save

If you browse to the Web App, you should see the following:

image

Now that the Web App is configured, we need to download the Jenkins War file from http://jenkins-ci.org/.  Once you have the file downloaded, change the extension to .zip and extract the contents.

image

Now we simply need to FTP the files to the Azure Web App.

  1. Return to the Azure Portal and locate the Web App
  2. In the Essentials section, copy the FTP hostname
    SNAGHTML172a5bff
  3. Open Windows Explorer
  4. Paste the value in the address bar
    SNAGHTML1731668c
    Field Value
    User name: {FTP/Deployment username} from Azure
    Password: {FTP/Deployment password} from Azure
  5. Double-click site
  6. Double-click wwwroot
  7. Double-click webapps
  8. Double-click ROOT
  9. Delete all files in this folder
  10. Drag and Drop the extracted files into this folder

If you browse to the site after the files are uploaded, you will see the text below as Jenkins configures itself.

image

Once the configuration is done, you will have a fully functional Jenkins server running in an Azure Web App.

image

Now simply follow the instructions from the Jenkins site to configure security.  I used the “Jenkins’ Own User Database” option.

Comments (6) -

  • Thank you for great tutorial, it helped a lot. I wonder if there is a way to enforce web app to use https only ? I tried changing the web.config but that didn't work.
  • jay
    Thanks so much for posting this Donovan.  I've used this as a starting point and now have Jenkins, Artifactory, & GitBlit deployed to an app service.  Things seem to be working well at the moment, but I'm having an issue with the app service suspending when its not in use over night.  I've turned the "Always on" flag to "On", but this doesn't change the behavior.  Do you have any thoughts?
  • Thanks . Its great tutorial.
  • Sid
    I am getting an error -

    Unable to create the home directory ‘C:\.jenkins’. This is most likely a permission problem.

    To change the home directory, use JENKINS_HOME environment variable or set the JENKINS_HOME system property. See Container-specific documentation for more details of how to do this.

Pingbacks and trackbacks (2)+

Add comment

Loading