
This Azure tutorial will discuss the steps to Create Azure Function Time Trigger From Visual Studio.
Table of Contents
Create timer trigger Azure function in Visual Studio 2019
Well, here we will discuss How To Create And Deploy Azure Functions Time Trigger From Visual Studio 2019. Let’s start Creating the Azure Functions Time Trigger From Visual Studio 2019.
Before starting the actual development, we should know the Prerequisites
Prerequisites
- We need an Azure Account or Azure Subscription. Don’t have an Azure Account now? No worries, create an Azure Free Account now.
- If you don’t have Visual Studio 2019 installed on your machine, install Visual Studio 2019 now. Along with Visual Studio 2019, you need to install the Azure development workload.
- We need Updated Azure Function tools.
- You need an Azure Storage Account. If you don’t have an Azure Storage Account till now, create an Azure Storage Account now.
Timer trigger Azure Function Example C#
Well, now we are ready for the development activities with all the Prerequisites needed. Let’s start creating the Azure Function Project.
- Now, from your local machine, Open Visual Studio 2019 and click the Create a New Project button. Select the Azure Functions template on the Create a new project window and click the Next button.

2. You need to provide the details in the window below
- Project name: Provide the Azure Function Project name
- Location: You need to choose a location for your Azure Function Project.
- Solution: Choose to Create new solution
Then, click on the Create button.

3. Now, this step is very important. We will have to choose a trigger for our Azure Functions. The role of the trigger is to invoke the Azure Function.
Make sure to choose the Timer Trigger as the template and then provide the below details
Storage Account (AzureWebStorage): choose the Storage Emulator option here.
Schedule: You can keep the CORN expression 0*/5**** as it is. This means the timer trigger Azure Function will execute on each 5-minute interval. If You change it to 0*/3****, the Azure Function will execute on each 3-minute interval. Decide based on your business requirements.
Finally, click on the Create button to create the timer trigger Azure Function.

Now you can see below the Azure functions timer trigger project was created successfully without any issue

Below is the Timer trigger Azure Function Code
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace TimeTriggerAzureFunction
{
public static class Function1
{
[FunctionName("mytimertriggerfunction")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
}
You can see it here

This way, you can Create Azure Functions Time Trigger in Visual Studio. Now, let’s check out the deployment steps.
How To Deploy Azure Functions Timer Trigger From Visual Studio 2019
Follow the below steps to Publish Azure Functions Time Trigger From Visual Studio 2019.
1. Right-click on the Azure Functions Time Trigger project and click on the Publish button

2. Click on the Azure Functions Consumption Plan, select the Create New option, and click the Create Profile button.

3. Provide the below details as highlighted
- Name: Provide the name for the Function App
- Subscription: Choose your correct subscription
- Resource group: You can choose your existing resource group or click on the New button to create a new Resource Group.
- Location: Choose a location for your Function App
- Azure Storage: You can choose your existing storage account, or If you don’t have an existing one, click on the New button to create a new one.
Now click on the Create button.

4. Now click on the Publish button from the below window to Publish the Azure Function

5. On the next pop-up, click on the Yes button to update the Azure Function version

Now, your Azure Function will get published successfully. The next step is to verify if it is published successfully, and then We will test if the Azure timer function is working.
Test the Azure Functions Timer Trigger
To check all these things, you must navigate to the Azure Function App you published just now.
1. Log in to the Azure Portal, search for the App services, and then click on the search result. You will find your Azure Function App in the list of app services. Click on your Azure Function App. Then, As shown below, On the Azure Function App page, click on the Functions from the left navigation

2. On the Azure Function page, click on the Code + Test link from the left navigation, and then to test the Azure Function, if it is working fine as expected, click on the Test/Run button.

3. The next step is to click on the Run button from the below window

You can see below we got the expected response code i.e. 202 Accepted.

Select the log as Information to see if the function is executed every 5 minutes. You can see the function execution time on each 5-minute

You may also like following the articles below
Wrapping Up
This article discusses the quick steps to create a timer trigger Azure function in Visual Studio 2019. I hope you have enjoyed this article !!!
I am Bijay, a Microsoft MVP (10 times) having more than 17 years of experience in the software industry. During my IT career, I got a chance to share my expertise in SharePoint and Microsoft Azure, like Azure VM, Azure Active Directory, Azure PowerShell, etc. I hope you will learn from these Azure tutorials. Read more
