Migrate Azure Scheduler jobs to Azure Logic Apps

Important

Azure Logic Apps is replacing Azure Scheduler, which is being retired. To continue working with the jobs that you set up in Scheduler, please move to Azure Logic Apps as soon as possible by following this article.

This article shows how you can schedule one-time and recurring jobs by creating automated workflows with Azure Logic Apps, rather than with Azure Scheduler. When you create scheduled jobs with Logic Apps, you get these benefits:

  • Build your job by using a visual designer and ready-to-use connectors from hundreds of services, such as Azure Blob Storage, Azure Service Bus, Office 365 Outlook, and SAP.

  • Manage each scheduled workflow as a first-class Azure resource. You don't have to worry about the concept of a job collection because each logic app is an individual Azure resource.

  • Run multiple one-time jobs by using a single logic app.

  • Set schedules that support time zones and automatically adjust to daylight savings time (DST).

To learn more, see What is Azure Logic Apps? or try creating your first logic app in this quickstart: Create your first logic app.

Prerequisites

Migrate by using a script

Each Scheduler job is unique, so no one-size-fits-all tool exists for migrating Scheduler jobs to Azure Logic Apps. However, you can edit this script to meet your needs.

Schedule one-time jobs

You can run multiple one-time jobs by creating just a single logic app.

  1. In the Azure portal, create a blank logic app in Logic App Designer.

    For the basic steps, follow Quickstart: Create your first logic app.

  2. In the search box, enter "when a http request" as your filter. From the triggers list, select this trigger: When a HTTP request is received

    Add "Request" trigger

  3. For the Request trigger, you can optionally provide a JSON schema, which helps the Logic App Designer understand the structure for the inputs from the incoming request and makes the outputs easier for you to select later in your workflow.

    To specify a schema, enter the schema in the Request Body JSON Schema box, for example:

    Request schema

    If you don't have a schema, but you have a sample payload in JSON format, you can generate a schema from that payload.

    1. In the Request trigger, select Use sample payload to generate schema.

    2. Under Enter or paste a sample JSON payload, provide your sample payload, and then select Done, for example:

      Sample payload

  4. Under the trigger, select Next step.

  5. In the search box, enter "delay until" as your filter. Under the actions list, select this action: Delay until

    This action pauses your logic app workflow until a specified date and time.

    Add "Delay until" action

  6. Enter the timestamp for when you want to start the logic app's workflow.

    When you click inside the Timestamp box, the dynamic content list appears so you can optionally select an output from the trigger.

    Provide "Delay until" details

  7. Add any other actions you want to run by selecting from hundreds of ready-to-use connectors.

    For example, you can include an HTTP action that sends a request to a URL, or actions that work with Storage Queues, Service Bus queues, or Service Bus topics:

    HTTP action

  8. When you're done, save your logic app.

    Save your logic app

    When you save your logic app for the first time, the endpoint URL for your logic app's Request trigger appears in the HTTP POST URL box. When you want to call your logic app and send inputs to your logic app for processing, use this URL as the call destination.

    Save Request trigger endpoint URL

  9. Copy and save this endpoint URL so you can later send a manual request that triggers your logic app.

Start a one-time job

To manually run or trigger a one-time job, send a call to the endpoint URL for your logic app's Request trigger. In this call, specify the input or payload to send, which you might have described earlier by specifying a schema.

For example, using the Postman app, you can create a POST request with the settings similar to this sample, and then select Send to make the request.

Request method URL Body Headers
POST <endpoint-URL> raw

JSON(application/json)

In the raw box, enter the payload that you want to send in the request.

Note: This setting automatically configures the Headers values.

Key: Content-Type
Value: application/json

Send request to manually trigger your logic app

After you send the call, the response from your logic app appears under the raw box on the Body tab.

Important

If you want to cancel the job later, select the Headers tab. Find and copy the x-ms-workflow-run-id header value in the response.

Response

Cancel a one-time job

In Logic Apps, each one-time job executes as a single logic app run instance. To cancel a one-time job, you can use Workflow Runs - Cancel in the Logic Apps REST API. When you send a call to the trigger, provide the workflow run ID.

Schedule recurring jobs

  1. In the Azure portal, create a blank logic app in Logic App Designer.

    For the basic steps, follow Quickstart: Create your first logic app.

  2. In the search box, enter "recurrence" as your filter. From the triggers list, select this trigger: Recurrence

    Add "Recurrence" trigger

  3. Set up a more advanced schedule, if you want.

    Advanced schedule

    For more information about advanced scheduling options, see Create and run recurring tasks and workflows with Azure Logic Apps.

  4. Add other actions you want by selecting from hundreds of ready-to-use. Under the trigger, select Next step. Find and select the actions you want.

    For example, you can include an HTTP action that sends a request to a URL, or actions that work with Storage Queues, Service Bus queues, or Service Bus topics:

    HTTP action

  5. When you're done, save your logic app.

    Save your logic app

Advanced setup

Here are other ways you can customize your jobs.

Retry policy

To control the way that an action tries to rerun in your logic app when intermittent failures happen, you can set the retry policy in each action's settings, for example:

  1. Open the action's ellipses (...) menu, and select Settings.

    Open action settings

  2. Select the retry policy that you want. For more information about each policy, see Retry policies.

    Select retry policy

Handle exceptions and errors

In Azure Scheduler, if the default action fails to run, you can run an alterative action that addresses the error condition. In Azure Logic Apps, you can also perform the same task.

  1. In Logic App Designer, above the action that you want to handle, move your pointer over the arrow between steps, and select Add a parallel branch.

    Add parallel branch

  2. Find and select the action you want to run instead as the alternative action.

    Add parallel action

  3. On the alternative action, open the ellipses (...) menu, and select Configure run after.

    Configure run after

  4. Clear the box for the is successful property. Select these properties: has failed, is skipped, and has timed out

    Set up "run after" properties

  5. When you're finished, select Done.

To learn more about exception handling, see Handle errors and exceptions - RunAfter property.

FAQ

Q: When is Azure Scheduler retiring?
A: Azure Scheduler is scheduled to fully retire on December 31, 2019. For important steps to take before this date and a detailed timeline, see Extending retirement date for Scheduler to December 31, 2019. For general updates, see Azure updates - Scheduler.

Q: What happens to my job collections and jobs after the service retires?
A: All Scheduler job collections and jobs stop running and are deleted from the system.

Q: Do I have to back up or perform any other tasks before migrating my Scheduler jobs to Logic Apps?
A: As a best practice, always back up your work. Check that the logic apps you created are running as expected before deleting or disabling your Scheduler jobs.

Q: Is there a tool that can help me migrate my jobs from Scheduler to Logic Apps?
A: Each Scheduler job is unique, so a one-size-fits-all tool doesn't exist. However, based on your needs, you can edit this script to migrate Azure Scheduler jobs to Azure Logic Apps.

Q: Where can I get support for migrating my Scheduler jobs?
A: Here are some ways to get support:

Azure portal

If your Azure subscription has a paid support plan, you can create a technical support request in the Azure portal. Otherwise, you can select a different support option.

  1. On the Azure portal main menu, select Help + support.

  2. From the Support menu, select New support request. Provide this information about for your request:

    Property Value
    Issue type Technical
    Subscription <your-Azure-subscription>
    Service Under Monitoring & Management, select Scheduler. If you can't find Scheduler, select All services first.
  3. Select the support option you want. If you have a paid support plan, select Next.

Community

Next steps