Click here to Skip to main content
15,885,782 members
Articles / Hosted Services / Azure

Create, Deploy Webjobs and Schedule Using Azure Logic App

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 Feb 2020CPOL3 min read 13.3K   1  
Create a logical app to schedule a trigger for Web jobs in Azure
In this article, an explanation has been given about how to schedule to run WebJobs. There is a step by step guide to creating and deploying webjobs, and also how to create Azure logic apps.

Background

We have all used and worked on the Azure Scheduler which helps in creating the jobs that run in the cloud. This Azure Scheduler would automatically schedule and runs the defined actions. Staring from 30th September 2019, Azure Scheduler has been Retired and Azure Logic Apps is replacing Azure Scheduler.

Now with this article, I will try to explain how we could schedule to run the WebJobs.

Create and Deploy WebJobs

To create and deploy webjobs, we can achieve it in two ways:

  1. Manual Deployment
  2. Deployment using Visual Studio

For all the above deployments, we need an Azure App service. Below are the complete steps to create an App service.

  1. Select the App Service from the left navigation bar, then click on the top Add button as shown below:

    Image 1

  2. After clicking on the Add Button, the below window will open and then on the window, fill up the information like Subscriptions name, resource group (default / create), App service name, runtime stack.

    Image 2

  3. After completing all the necessary Actions click on Review + Create which would take few moments to create the App Service as below:

    Image 3

  4. Create Webjob from the above App service created.
  5. Click on the Test-App-Webjobs App service and then type in Webjobs in the search window as shown below:

    Image 4

  6. Click on the webjobs and the following would be promoted to create a new webjob.

    Image 5

  7. On click of the Add, fill out the below screen to create the Webjob on the App services.

    Image 6

  8. From the above image, provide the Webjob name which is "Test-Webjob".
  9. On File Upload option, upload the zip which you would have built (using console app / webjob)
  10. On Type, there are two options:
    • Continuous: Job starts immediately when the WebJob is created and runs on all instances.
    • Triggered: Job starts only when it gets triggered manually or on a schedule and it runs on a single instance.
  11. Triggers: Again, this has two options:
    • Scheduled: There would be a schedule when the web jobs will run.
    • Manual: the web job must be triggered by API or by manually.
  12. CRON Expression: This expression is composed of six fields:

    {second}{minute}{hour}{day}{month} {day of the week}

    Example: If we want to schedule a job at 1 AM, then we would schedule it as "0 0 1 * * *".

  13. On OK button, the web job will be created.
  14. After creation of the webjob, the below image will be shown:

    Image 7

  15. We can run the webjobs manually by clicking on the "Run" option and it can be used to test for run issue or error in the application.

Create Azure Logic Apps

Now, I am going to show how to schedule the above webjobs using Logic Apps.

  1. Go to Azure portal and search/ type Logic App. Click on the Logic Apps as shown in the below image:

    Image 8

  2. The below window "Azure Logic App" will popup or open.

    Image 9

  3. Provide the Logic App Name in position 1 that needs to be unique, which means that we cannot have any logic app with the exact same name.
  4. Select the Subscription type in the Subscription dropdown.
  5. Select an existing resource group or new resource group in position 3.
  6. Select a location from the dropdown at position 4.
  7. Click on Create button to create the Logic App.
  8. After click on the button, the below screen would be shown with the App created.

    Image 10

  9. On click of the "Test-Logic-App", the below screen would be shown to select trigger, for this, we are going to choose "Recurrence" as marked below:

    Image 11

  10. On selecting the Recurrence, the below screen would be shown with the Recurrence step as default.

    Image 12

  11. Give the Recurrence time and add required values as per your requirement. From the above, I have taken a sample to trigger the webjob every day at 9 AM.
  12. Click on the New step to configure the Webjob using HTTP Post Activity as shown below:

    Image 13

  13. Following properties would be shown in the window:

    Image 14

  14. Copy the required values to the properties and click on Save button.

    Image 15

  15. Logic app is created.
  16. Now test the app by clicking on the Run Trigger and look for Run history for the results.
  17. Now the application would trigger the webjobs as per the schedule.

    Image 16

History

  • 27th February, 2020: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --