- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Create a Scheduled Function with the Azure Functions CLI
In this lab you'll learn how to use the Azure Functions Command line tools to create a timer triggered function to run on a schedule controlled by a CRON expression. - First, you'll create a new Azure Functions project with the `func init` command. - Then you'll use the `func new` command to add a function. - You can then use the `code` command to take a look at the files. - You'll update the cron expression to run every minute. - You'll, optionally, also update the `local.settings.json` file to point at the cloud shell's storage account connection string. - And you can see how the `func host start` command can run your scheduled function (assuming you configured it with a real storage account connnection string).

Lab Info
Table of Contents
-
Challenge
Create a Function App
Use the Azure Functions Core Tools to create a new function app.
-
Challenge
Create a timer triggered function
Use the Azure Functions Core tools to add a timer-triggered function to your Azure Functions app.
-
Challenge
Update the CRON expression
Update the CRON expression of your timer-triggered function so that it runs every 1 minute instead of the default of every 5 minutes.
-
Challenge
Set the storage account connection string
Use the Azure CLI to fetch the connection string of the cloud shell's storage account, and set it in the
local.settings.json
file.Note: This optional step is needed in order to successfully run your Function App in the cloud shell.
-
Challenge
Check the .NET version
Check that the version of the .NET runtime installed in the cloud shell matches the version in your function app
csproj
file. Adjust thecsproj
file to match if it does not.Note: This is an optional step to allow your function app to run successfully in the cloud shell.
-
Challenge
Launch the Azure Functions runtime
Use the
func host start
command from the Azure Functions Core Tools to launch the Azure Functions runtime and see your scheduled function run (assuming you performed the optional steps to add a storage account connection string and checked the .NET version).
About the author
Real skill practice before real-world application
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.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.