How to Configure CI/CD for Azure WebJobs in in Azure DevOps.

Sai Kiran Maturi 66 Reputation points
2023-03-21T13:22:28.18+00:00

How can we configure CI/CD Pipelines for an azure Webjob of azure app service in azure DevOps.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,978 questions
{count} votes

4 answers

Sort by: Most helpful
  1. brtrach-MSFT 17,741 Reputation points Microsoft Employee Moderator
    2023-03-23T01:44:53.3366667+00:00

    To configure CI/CD pipelines for an Azure WebJob of Azure App Service in Azure DevOps, you can follow the steps below:

    1. Create a new pipeline in Azure DevOps and select the appropriate repository where your code is stored.
    2. Add a build step to build your WebJob project.
    3. Add a publish step to publish the WebJob artifacts to a staging directory.
    4. Add a deploy step to deploy the WebJob artifacts to the Azure App Service.
    5. In the deploy step, select the WebJob type as "Continuous" and specify the WebJob name and file path.
    6. Finally, save and run the pipeline to deploy the WebJob to the Azure App Service.

    You can find more detailed information on how to configure CI/CD pipelines for Azure WebJobs in Azure DevOps in this document.

    Let me know if you have any further questions or need more information.

    1 person found this answer helpful.

  2. Phil Nachreiner-MSFT 1 Reputation point Microsoft Employee
    2024-09-19T18:54:56.57+00:00
    
    

    To deploy an Azure WebJob in an Azure DevOps CI/CD pipeline you'll want to use the AzureRMWebAppDeployment task. The documentation for the AzureRMWebAppDeployment task can be found here: AzureRmWebAppDeployment@4 - Azure App Service deploy v4 task.

    In order to use the AzureRMWebAppDeployment task to deploy an Azure WebJob. You will first need to create the WebJob in the Azure Portal.

    1. Steps to create a continuous or triggered Azure WebJob in Azure Portal:

    Now that you have an Azure WebJob created in the Azure App Service you can use the AzureRMWebAppDeployment to deploy new versions of your Azure WebJob.

    The scenario below assumes you will be deploying a WebJob as .NET Framework console app as a Package (compressed zip file). The compressed zip file needs to have a specific rooted folder structure App_Data/jobs/continuous for continuous and App_Data/jobs/triggered for triggered in order to be deployed as a WebJob. Azure WebJobs deploy to those folders in your Azure App Service (i.e. wwwroot\app_data\jobs\triggered\{job name} or wwwroot\app_data\jobs\continuous\{job name}.

    The Console development tool is useful in diagnosing deployment issues Working with Files in Azure App Service.

    The below Azure DevOps YAML assumes you've stored your Azure WebJob Package in $(Build.ArtifactStagingDirectory) and that you'll be using a Pipeline Service connection Manage service connections to your Azure Subscription.

    Consult the documentation for the AzureRmWebAppDeployment@4 task for descriptions on each of the inputs.

    Here's the YAML task to deploy your Packaged Azure WebJob

    steps:
    - task: AzureRmWebAppDeployment@4
      displayName: 'Deploy: Azure WebJob'
      inputs:
      azureSubscription: '<Service Connection to Azure Resource Manager for your Azure Subscription>'
        WebAppName: '<Azure App Service name>'
        packageForLinux: '$(Build.ArtifactStagingDirectory)/<azurewebjobpackage>.zip'
        enableCustomDeployment: true
        DeploymentType: zipDeploy
    
    0 comments No comments

  3. Phil Nachreiner-MSFT 1 Reputation point Microsoft Employee
    2024-09-19T19:00:45.15+00:00

    To deploy an Azure WebJob in an Azure DevOps CI/CD pipeline you'll want to use the AzureRMWebAppDeployment task. The documentation for the AzureRMWebAppDeployment task can be found here: AzureRmWebAppDeployment@4 - Azure App Service deploy v4 task.

    In order to use the AzureRMWebAppDeployment task to deploy an Azure WebJob. You will first need to create the Azure your textWebJob in the Azure Portal.

    1. Steps to create a continuous or triggered Azure WebJob in Azure Portal:

    Now that you have an Azure WebJob created in the Azure App Service you can use the AzureRMWebAppDeployment to deploy new versions of your Azure WebJob.

    The scenario below assumes you will be deploying a WebJob as .NET Framework console app as a Package (compressed zip file). The compressed zip file needs to have a specific rooted folder structure App_Data/jobs/continuous for continuous and App_Data/jobs/triggered for triggered in order to be deployed as a WebJob. Azure WebJobs deploy to those folders in your Azure App Service (i.e. wwwroot\app_data\jobs\triggered\{job name} or wwwroot\app_data\jobs\continuous\{job name}.

    The Console development tool is useful in diagnosing deployment issues Working with Files in Azure App Service.

    The below Azure DevOps YAML assumes you've stored your Azure WebJob Package in $(Build.ArtifactStagingDirectory) and that you'll be using a Pipeline Service connection Manage service connections to your Azure Subscription.

    See the documentation for the AzureRmWebAppDeployment@4 task for description on each of the inputs.

    Here's the YAML task snippet to deploy your Packaged Azure WebJob

    steps:
    - task: AzureRmWebAppDeployment@4
      displayName: 'Deploy: Azure WebJob'
      inputs:
        azureSubscription: '<Service Connection to Azure Resource Manager for your Azure Subscription>'
        WebAppName: '<Azure App Service name>'
        packageForLinux: '$(Build.ArtifactStagingDirectory)/<azurewebjobpackage>.zip'
        enableCustomDeployment: true
        DeploymentType: zipDeploy
    

  4. Puja Manna (Accenture International Limited) 0 Reputation points Microsoft External Staff
    2025-07-08T08:47:59.95+00:00

    When we deploy both the Web App and WebJob together to the same Azure App Service using the following task:

    steps:

    • task: AzureRmWebAppDeployment@4
      displayName: 'Deploy: Azure WebJob'
      inputs:
      azureSubscription: '<Service Connection to Azure Resource Manager for your Azure Subscription>' WebAppName: '<Azure App Service name>'
      packageForLinux: '$(Build.ArtifactStagingDirectory)/<azurewebjobpackage>.zip' enableCustomDeployment: true
      DeploymentType: zipDeploy

    Azure automatically sets the WEBSITE_RUN_FROM_PACKAGE application setting to 1. This enables Run From Package, which mounts the app content as a read-only ZIP file in wwwroot.

    As a result:

    The Web App works correctly (as it supports run-from-package)

    But the WebJobs fail to start, because WebJobs require write access to specific folders under wwwroot (like App_Data/jobs) — and the file system is now read-only

    If we try to disable WEBSITE_RUN_FROM_PACKAGE (i.e., set it to 0), the WebJobs start successfully, but the Web App fails to load properly, since it expects to run from the packaged deployment.

    This creates a conflict:

    Web App requires WEBSITE_RUN_FROM_PACKAGE=1 WebJobs require WEBSITE_RUN_FROM_PACKAGE=0

    We're looking for a solution that allows deploying both the Web App and WebJobs together without breaking either due to the read-only file system constraint.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.