Showing posts from February, 2018

Use Azure Functions to Execute a SQL Azure Stored Procedure on a Timer

It was hard to find this information all in one place, so I thought I'd throw a post together quick. If you have the need to execute a stored procedure on a timer, that can be fairly easily accomplished with Azure Functions . Create a new Timer Trigger Azure Function , set the cron timer as desired, and add code similar to the code below: using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using Dapper; public static void Run(TimerInfo myTimer, TraceWriter log) {     var conString = ConfigurationManager.ConnectionStrings["ConString"]?.ConnectionString;          using(var con = new SqlConnection(conString))     {         con.Execute("dbo.MyProc", commandType: CommandType.StoredProcedure);     } } This code will not compile at this time. Note the name of the connection string, we'll need that in the app settings page. Go to the Connection Strings section of the Application Settings for the functio