- Lab
- A Cloud Guru
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).
Path 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).
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.