Introduction
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it.
Functions can make development even more productive, and you can use your development languages of choice, such as C#, F#, Node.js, Java, or PHP.
Azure Functions has two kinds of pricing plans,
- Consumption plan
When your function runs, Azure provides all of the necessary computational resources. You don't have to worry about resource management, and you only pay for the time that your code runs. - App Service plan
Run your functions just like your web, mobile, and API apps. When you are already using App Service for your other applications, you can run your functions on the same plan at no additional cost.
In this post, I will try to make you understand how you can use entity framework with C# code in the Azure function. So, let’s get started.
- Visual Studio creates a new project, then from the cloud section select Azure Functions. Change the Project Name and Location and then click OK.

- In new function dialog select Timer trigger and define the schedule, the schedule is formatted by Cron Expression. To understand that we need to explain the schedule expression.

The cron (chronos) expresses time scheduled jobs as a string format, often segmented to 6 or 7 fields, separated by a space. Let us examine the format with examples.
These fields represent the following,
Seconds Minutes Hours Day of month Month Day of week Year (Optional) 0-59 0-59 0-23 1-31 1-12 or JAN-DEC 0-6 or MON-SUN 1970-2099 Let’s look at some basic examples of expressions,
Expression Behavior 0 * * * * * Trigger at Zero second on any minute, any hour, any day. Effectively triggering once every 60 seconds 0 0 * * * * Trigger at Zero second and Zero minute on any hour, any day. Effectively triggering once every 60 minutes. Because the occurrence of 0 second and 0 minute happens once an hour 0 15 * * * * Trigger at Zero second and 15th minute, any hour, any day. Effectively triggering once every 60 minutes at the 15th minute mark 30 30 1 * * * Trigger at 30th second and 30th minute and 1st hour, any day. Effectively triggering once, a day at 01:30:30 AM 0 0 0 * MON, TUE, WED, FRI Trigger at Zero second and Zero minute and Zero hour, any day of the Month and on MON, TUE, WED, FRI. Effectively triggering at midnight on the days of Monday, Tuesday, Wednesday and Friday Let us explore a more useful feature of the expression:
Expression Behavior */1 * * * * * Trigger at any second. Effectively triggering every second */30 * * * * * Trigger at any 30 second interval. Effectively triggering every 30 seconds 0 */5 * * * * Trigger at Zero second and any 5th minute. Effectively triggering at zero second every 5 minutes 0 30 */6 * * * Trigger at Zero second and 30th minute at any six hour interval. Effectively triggering every 6 hours at 30 min and zero second. This site helps us to generate cron expression with an easy to use online interface. Convert a cron expression into a readable text that clearly explains when it will execute, and visualize the next execution dates of your cron.
- Next, we need the entity framework package from NuGet Packages.









ramakrishna nagPosted Aug 5, 2020, 9:30 AM
Hi,how did the connection string issue resolved
Tushar AherPosted Dec 5, 2019, 8:56 AM
Hi i get following issue-Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception. I have added connection string of SQL from azure sql connection string
Umar RiazPosted Jun 20, 2019, 5:32 AM
Same error no connectionstring found
Mike BaronPosted Feb 4, 2019, 8:50 PM
Hi, this was very straight forward to follow, but when I try to test the function I get an error that the connection string cannot be found in the application config file
Duc DangPosted Oct 9, 2018, 3:54 AM
Tks u for this topic.But I run my function,I got [Error] Function completed.