Create an Azure Function to Run on a Timer

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we use the Azure Portal to create and run a timer-triggered Azure function.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log In to the Azure Portal

Log in to the Azure Portal using the username and password supplied by the lab.

  1. Open a browser.
  2. Nevigate to the provided Azure Portal URL.
  3. Use the supplied username and password to authenticate.
Go to the Overview of the Provided Function Application Service

Starting in the Azure dashboard, perform the following tasks:

  1. Open the navigation menu in the upper-left of the Portal.
  2. Click on All resources.

Wait for all the resources to appear.

In the list, click on the app service that has a name starting with fa-. This will open the overview page of the function app service.

Create and Run the Timer-Triggered Function

On the function app overview page, click Functions in the function apps navigation tree on the left of the page.

Now click the + New function link that appears a top of the empty list of functions.

In the list of triggers that appears, click Timer trigger.

In the panel that opens, name the function "MyTimerTrigger" without the quotes.

Leave the schedule as 0 /5 *.

Click the Create button.

Wait for the function code to open in the browser.

Open the Logs panel to verify the function has already run.

If you want, wait five minutes to see it run again. Afterwards, continue to the next task.

Change the Trigger Execution to Every Five Seconds

Click View files on the right side of the browser window.

In the panel that opens, click the function.json file.

When the JSON for that file opens in the editor, change the following line:

"schedule": "0 */5 * * * *",


 "schedule": "0/5 * * * * *",

Press the Save button above the code, and then the Run button.

Go back to the Logs panel. After a few moments, the function should run every five seconds.

Additional Resources

Your employer needs to perform periodic cleanups of blobs in a storage account. As a developer and Azure DevOps person, you decide this would be best done with an Azure Function that runs on a timer trigger. You need to create the function in an existing app service. You don't need to code the function, just create it and test that it runs. The implementation will be handled by another developer. You do need to change the default timer of every five minutes to five seconds before handing off the code to the other developer.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?