| title | Create a function in Azure that runs on a schedule | ||||
|---|---|---|---|---|---|
| description | Learn how to use the Azure portal to create a function that runs based on a schedule that you define. | ||||
| ms.assetid | ba50ee47-58e0-4972-b67b-828f2dc48701 | ||||
| ms.topic | how-to | ||||
| ms.date | 05/07/2025 | ||||
| ms.custom |
|
Learn how to use the Azure portal to create a function that runs serverless on Azure based on a schedule that you define.
[!INCLUDE functions-in-portal-editing-note]
To complete this tutorial:
Ensure that you have an Azure subscription. If you don't have an Azure subscription, create a free account before you begin.
[!INCLUDE Create function app Azure portal]
Your new function app is ready to use. Next, you create a function in the new function app.
:::image type="content" source="./media/functions-create-scheduled-function/function-app-create-success-new.png" alt-text="Screenshot showing successful creation of the function app." border="true":::
-
In your function app, select Overview, and then select + Create under Functions.
:::image type="content" source="./media/functions-create-scheduled-function/function-create-function.png" alt-text="Screenshot of adding a function in the Azure portal." border="true":::
-
Under Select a template, scroll down and choose the Timer trigger template.
:::image type="content" source="./media/functions-create-scheduled-function/function-select-timer-trigger-template.png" alt-text="Screenshot of select the timer trigger page in the Azure portal." border="true":::
-
In Template details, configure the new trigger with the settings as specified in the table below the image, and then select Create.
:::image type="content" source="./media/functions-create-scheduled-function/function-configure-timer-trigger-new.png" alt-text="Screenshot that shows the New Function page with the Timer Trigger template selected." border="true":::
Setting Suggested value Description Name Default Defines the name of your timer triggered function. Schedule 0 */1 * * * * A six field CRON expression that schedules your function to run every minute.
-
In your function, select Code + Test and expand the Logs.
:::image type="content" source="./media/functions-create-scheduled-function/function-code-test-timer-trigger.png" alt-text="Screenshot of the Test the timer trigger page in the Azure portal." border="true":::
-
Verify execution by viewing the information written to the logs.
:::image type="content" source="./media/functions-create-scheduled-function/function-timer-logs-view.png" alt-text="Screenshot showing the View the timer trigger page in the Azure portal." border="true":::
Now, you change the function's schedule so that it runs once every hour instead of every minute.
-
In your function, select Integration. Here, you define the input and output bindings for your function and also set the schedule.
-
Select Timer (myTimer).
:::image type="content" source="./media/functions-create-scheduled-function/function-update-timer-schedule-new.png" alt-text="Screenshot of Update the timer schedule page in the Azure portal." border="true":::
-
Update the Schedule value to
0 0 */1 * * *, and then select Save.:::image type="content" source="./media/functions-create-scheduled-function/function-edit-timer-schedule.png" alt-text="Screenshot of the Update function timer schedule page in the Azure portal." border="true":::
You now have a function that runs once every hour, on the hour.
[!INCLUDE Next steps note]
You created a function that runs based on a schedule. For more information about timer triggers, see Timer trigger for Azure Functions.
[!INCLUDE Next steps note]