Skip to end of metadata
Go to start of metadata

Plugin Information

View Azure App Service on the plugin site for more information.

A Jenkins plugin to deploy an Azure App Service (currently supports only Web App).

How to Install

You can install/update this plugin in Jenkins update center (Manage Jenkins -> Manage Plugins, search Azure App Service Plugin).

You can also manually install the plugin if you want to try the latest feature before it's officially released. To manually install the plugin:

  1. Clone the repo and build:
    mvn package
  2. Open your Jenkins dashboard, go to Manage Jenkins -> Manage Plugins.
  3. Go to Advanced tab, under Upload Plugin section, click Choose File.
  4. Select azure-app-service.hpi in target folder of your repo, click Upload.
  5. Restart your Jenkins instance after install is completed.

Deploy to Azure Web App


To use this plugin to deploy to Azure Web App, first you need to have an Azure Service Principal in your Jenkins instance.

  1. Create an Azure Service Principal through Azure CLI or Azure portal.
  2. Open Jenkins dashboard, go to Credentials, add a new Microsoft Azure Service Principal with the credential information you just created.

Then create a Web App in Azure portal or through Azure CLI, we support both Web App (which is hosted on Windows) and Web App On Linux.

Deploy to Web App through File Upload

You can deploy your project to Azure Web App by uploading your build artifacts (for example, .war file in Java) using Git or WAR deploy.

  1. Create a new freestyle project in Jenkins, add necessary build steps to build your code.
  2. Add a post-build action 'Publish an Azure Web App'.
  3. Select your Azure credential in Azure Profile Configuration section.
  4. In App Configuration section, choose the resource group and web app in your subscription, and also fill in the files you want to deploy (for example, a war package if you're using Java).
  5. There are two optional parameters Source Directory and Target Directory that allows you to specify source and target folders when uploading files. For example, Java web app on Azure is actually running in a Tomcat server. So you should upload you war package to webapps folder. So in this case, set Target Directory to webapps.
  6. You can also set Slot Name if you want to deploy to a slot other than production.
  7. Save the project and build it, your web app will be deployed to Azure when build is completed.

Deploy to Web App on Linux using Docker

Web App on Linux supports a different way to do the deployment using Docker. To deploy using Docker, you need to provide a Dockerfile that packages your web app with service runtime into a docker image. Then the plugin will build the image, push it to a docker registry and deploy the image to your web app.

Web App on Linux also supports traditional ways like Git and WAR deploy, but only for built-in languages (.NET Core, Java, Node.js, PHP and Ruby). For other languages, you need to package your application code and service runtime together into a docker image and use docker to deploy.

To deploy using docker:

  1. Same as #1 - #3 of file upload approach.
  2. Select a Linux web app, choose Publish via Docker.
  3. Fill in Dockerfile path (by default it's **/Dockerfile), Docker registry URL (leave it empty if you use DockerHub), Registry credentials.
  4. Optionally you can specify the docker image name and tag in Advanced tab, by default image name is get from the image name you configured in Azure portal (in Docker Container setting) and tag is generated from $BUILD_NUMBER. So please specify the image name in at least one place (in Docker Container settings in portal or Docker Image in advanced options).
  5. Please also be noted deployment will fail if you're used built-in docker image setting. So please first go to Docker Container setting in Azure portal to change docker config to use custom image. For built-in image, please use file upload approach to deploy.
  6. Similar to file upload approach, you can choose a different slot other than production.
  7. Save and build the project, you'll see your container image is pushed to your registry and web app is deployed.

Deploy using Pipeline

You can also use this plugin in pipeline (Jenkinsfile). Here are some samples to use the plugin in pipeline script:

To deploy a Java web app using file upload:

azureWebAppPublish azureCredentialsId: '<credential_id>',
                   resourceGroup: '<resource_group_name>', appName: '<app_name>',
                   filePath: '*.war', sourceDirectory: 'target', targetDirectory: 'webapps'

To deploy using docker:

azureWebAppPublish azureCredentialsId: '<credential_id>', publishType: 'docker',
                   resourceGroup: '<resource_group_name>', appName: '<app_name>',
                   dockerImageName: '<image_name>', dockerImageTag: '<image_tag>',
                   dockerRegistryEndpoint: [credentialsId: '<registry_credential_id>', url: "<registry_url>"]

For advanced options, you can use Jenkins Pipeline Syntax tool to generate a sample script.


Azure App Service Plugin collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more.

You can turn off usage data collection in Manage Jenkins -> Configure System -> Azure -> Help make Azure Jenkins plugins better by sending anonymous usage statistics to Azure Application Insights.


Version 0.3.1, 2018-05-30

  • Switch to war deploy for Java apps
  • Add null check for path names when deploy

Version 0.3.0, 2018-04-03

  • Add an option to skip docker build step (#25)
  • Restart slot after successful deployment (JENKINS-48191, #21)
  • Support Java container app on Linux (#23)
  • Support for credentials lookup in Folders
  • Expands variables in source/target directory and slot name (#24)

Version 0.2.0, 2018-01-05

  • Support MSI

Version 0.1.3, 2017-11-07

  • Specify refspec explicitly when doing git push
  • Add Third Party Notice

Version 0.1.2, 2017-10-18

  • Remove runtime licenses

Version 0.1.1, 2017-09-30

  • Improve stability of FTP and Docker deploy

Version 0.1, 2017-07-18

  • Initial release
  • Support deploy to Azure Web App through Git and FTP
  • Support deploy to Azure Web App on Linux through Docker


  1. I am trying to use the plugin with no successes

    1. I installed "Azure App Service Plugin"
    2. I created an Azure Service Principal through Azure portal.
    3. In Jenkins I created a new Credentials for Microsoft Azure Service Principal
    4. Created a new freestyle project in Jenkins
    5. Added a post-build action 'Publish an Azure Web App'.
    6. Selected Azure credential in Azure Profile Configuration section.
    7. In the App Configuration section, I can’t choose the resource group and web app.  Also I can’t find were to fill in the files I want to deploy

  2. Avi Veltz, could you verify whether your service principal is valid and has enough permission by clicking "Verify Service Principal" button in the service principal configuration dialog? Also the textbox to fill in files to deploy only shows up after you select a valid web app.

    1. Thanks, the plugin works!

      The Verify Service Principal pointed the problem.

      In “Subscription ID” filed is used Subscription name instead of ID.

      I am adding a print screen for the Verify Service Principal button in Jenkins.

      I wasn’t sure at first if this button is part of Jenkins or Azure Portal.

  3. How is this plugin meant to be used in Jenkins Pipelines to deploy a Node.JS web app (NOT using docker) to Azure? Currently I have everything setup, it detects it is not a Java app so it uses Git to deploy, but then fails because there is no documented way to specify Git credentials.

  4. Git credential is get from your publish settings of web app, you don't need to specify it, so the deployment should work as long as your service principal is correct. What the error message did you see?

    1. The commit step fails because Git's and are not set. It's this error:

      returned status code 128:
      *** Please tell me who you are.
        git config --global ""
        git config --global "Your Name"
      to set your account's default identity.
      Omit --global to set the identity only in this repository.

      I have specified global commit authors in Manage Jenkins > Configure System > Git plugin which this either ignores or there is a bug in the Git plugin. The only way to get this to work is to set it globally, which is non-ideal for my use case.

      1. Seems in some version of git you'll be asked for user name if you didn't configure one. We'll do a fix to set default one to the commit if it's not configured.

  5. Hi All.

    Could you please help me with deployment files to Azure WebApp by this plugin.

    Deployment completed successfully but some files have a zero size. More often this problem occurs with 1 file which size is a bit more than 5MB in bin folder. For example if I define to upload just this file it will be downloaded successfully.

    I had the same issue with deployment to WebApp. Workaround was in deletion all possible folders in /site folder of WebApp and re-deploy. In case with WebApiApp it doesn't work.

    Note: Deployment jobs work on Windows VM Agent (Slave)

    1. Is this a .Net app? Could you try to increase the git post buffer by executing:

      git config --global http.postBuffer 1048576000
      1. Hi @Dayang. Thank you for response.

        Yes. It is a .Net app.

        Do I correctly understand that I should execute this command as part of my Jenkins Freestyle project step because git.exe runs by a specific user account (local system I guess)?

        1. For testing purpose you can just add this command as part of your job. If it works, you can then modify this config on your build machine. It can also be specified in one the git config files(See ).

          1. I've tried to add this command to the job but $lastexitcode is 1 every time. As I understood the cause in the absence of parameter http.postBuffer.

            When I try to execute "git config --global http.postBuffer 1048576000" I get error: could not lock config file %USERPROFILE%/.gitconfig: No such file or directory

            Of course I executed this command in RDP session on server (no any errors in this case) but it wasn't helped also.


            I've tried to push files directly from VM - is works fine.

  6. Hi,

    Sorry if the question is stupid but I don't get: Can I use the user from publish profile as a Service Principal? If so, what is the configuration I should put for the service principal in jenkins (subscription id? application id?...?)





    1. Hi Sylvain,


      Publish profile cannot be used as replacement of Service Principal. It only contains credentials for uploading your files. However, we need a Service Principal to make other functionality work, for example, listing apps under a resource group.

      1. Thanks for the answer.


        And can you tell me what are the minimal requirement for this service principal? Having a contributor role?

        1. A contributor role should be sufficient.

  7. Hi, I'm trying to deploy previously built artifacts to  an azure webapp, I managed to set up the service principal account and grant contributor access to the webapp.

    I only need to copy the "output" folder to the wwwroot folder of the webapp.

    I need to acheve this using  jenkins pipeline, here are the script lines.


    stage ('Deploy'){

    azureWebAppPublish azureCredentialsId: 'bfe599fe-f493-48ed-8922-9301c10e3652', publishType: 'file',
    resourceGroup: 'MW-WS-LB-IPV-01', appName: 'adminuuitestemerios',
    sourceDirectory: 'output'




    However, Im getitng this error:

    Starting Azure Web App Deployment
    Cloning repository
     > git.exe init C:\Program Files (x86)\Jenkins\workspace\AdminUI\AdminUI\.azure-deploy # timeout=10
    Fetching upstream changes from
     > git.exe --version # timeout=10
    using GIT_ASKPASS to set credentials 
     > git.exe fetch --tags --progress +refs/heads/*:refs/remotes/origin/*
     > git.exe config remote.origin.url # timeout=10
     > git.exe config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
    Seen 0 remote branches
    [Pipeline] } [Pipeline] // dir [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.lang.NullPointerException
    	at hudson.FilePath.isAbsolute(
    	at hudson.FilePath.glob(
    	at hudson.FilePath.access$1700(
    	at hudson.FilePath$32.invoke(
    	at hudson.FilePath$32.invoke(
    	at hudson.FilePath.act(
    	at hudson.FilePath.act(
    	at hudson.FilePath.list(
    	at hudson.FilePath.list(
    	at hudson.FilePath.list(
    	at org.jenkinsci.plugins.workflow.steps.CoreStep$
    	at org.jenkinsci.plugins.workflow.steps.CoreStep$
    	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$
    	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$
    	at java.util.concurrent.Executors$ Source)
    	at Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$ Source)
    	at Source)
    Finished: FAILURE

    Any hint?


    1. Looks like it cannot find the `output` directory in workspace. Try `sourceDirectory: 'AdminUI\output'`?

  8. It seems like the plugin successfully clones our .git on Azure, but then fails later.

    Every successful call hits:

    The failure has this trailing slash:

    Any help would be appreciated.

    Starting Azure Web App Deployment
    Cloning repository
    > git init /var/lib/jenkins/workspace/ # timeout=10
    Fetching upstream changes from
    > git --version # timeout=10
    using GIT_ASKPASS to set credentials
    > git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*
    ERROR: Build step failed with exception
    hudson.plugins.git.GitException: Command "git fetch --tags --progress +refs/heads/*:refs/remotes/origin/*" returned status code 128:
    stderr: fatal: unable to access '': The requested URL returned error: 500

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(

  9. Hello,

    We are deploying build artifact (.jar, etc) to azure webapp. Previously it was working fine before latest version upgrade 0.3.1.


    Now we are getting following errors while deployment:

    1]. java.util.NoSuchElementException: Sequence contains no elements
    	at rx.internal.operators.OperatorSingle$ParentSubscriber.onCompleted(
    	at rx.internal.operators.DeferredScalarSubscriber.complete(
    	at rx.internal.operators.OnSubscribeTakeLastOne$TakeLastOneSubscriber.onCompleted(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(
    	at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(
    	at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(
    	at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(
    	at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(
    	at retrofit2.adapter.rxjava.RxJavaCallAdapterFactory$RequestArbiter.request(


    2. ] Is it mandatory to deploy .war file? Even after downgrading the Azure App Service plugin version to 0.3.0, its failing with same.

     [Pipeline] step Starting Azure Web App Deployment

    accessTokens.json is not WAR file. Will skip.
    az.json is not WAR file. Will skip.
    az.sess is not WAR file. Will skip.
    azureProfile.json is not WAR file. Will skip.
    clouds.config is not WAR file. Will skip.
    config is not WAR file. Will skip.
    cacerts is not WAR file. Will skip.
    SecurityLib-1.3.4.jar is not WAR file. Will skip.
    SwaggerSupport-1.3.1.jar is not WAR file. Will skip.
    Please let me know, how we can resolve it or any workaround for same.
      1. Looks irrelevant.
      2. We switched to WAR deploy in 0.3.1 to reduce error rate. Is your webapp running on Windows or Linux? Did you modify the web.config to enable a non-standard jar deployment?
Write a comment…