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 (9) -

  • bilge

    2/9/2017 11:45:10 AM | Reply

    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

    3/14/2017 2:21:39 PM | Reply

    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?

  • Kandarp

    3/31/2017 1:18:54 PM | Reply

    Thanks . Its great tutorial.

  • Sid

    4/25/2017 5:51:15 PM | Reply

    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.

  • Mac

    5/17/2018 10:49:10 AM | Reply

    I am trying to install using latest jenkins.war version 2.107.3. after installation it goes to create user. when i create user or continue as admin it throws an error "Unable to Connect to jenkins", when is further dig in it shows - "java.io.IOException: There is not enough space on the disk" actually it tries to create a file/folder in user's .jenkins folder. but unable to do so. i also went to this location i tried to create a test dir but shows same error "There is not enough space on the disk", i tried giving permissions also using "icacls" but  nothing seems to be working. Can you Please help?

  • John

    5/22/2018 10:34:54 AM | Reply

    Hi Donovan,

    Did you also try to connect any slave to this? i tried using all launch methods but unable to do so, as web app only expose 80/443 ports.

    • Donovan

      5/29/2018 11:17:23 PM | Reply

      I have never tried to do that sorry.

Pingbacks and trackbacks (2)+

Add comment

Loading