Handling CORS Policy In Azure Functions

Option 1: In Azure Portal Cross-Origin Resource Sharing (CORS) allows JavaScript code running in a browser on an external host to interact with your backend. Specify the origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). To allow all, use “*” and remove all other origins from the list. Slashes are not... » read more

Azure Function Get Environment Variable using local.settings.json

To get an environment variable or an app setting value, use System.Environment.GetEnvironmentVariable, as shown in the following code example: local.settings.json Note: Microsoft recommends this method because it works both locally with local.settings.json and in Azure. App settings can be read from environment variables both when developing locally and when running in Azure. When developing locally,... » read more

Run Timer Triggered Azure Function Locally

Gets or sets a value indicating whether the function should be invoked immediately on startup. After the initial startup run, the function will be run on schedule thereafter. Sources: https://stackoverflow.com/questions/46556621/what-is-the-simplest-way-to-run-a-timer-triggered-azure-function-locally-once

Reference System.Data.SqlClient not found

Microsoft has removed System.Data.SqlClient from the default installation of Visual Studio (.NET Core). In order to use it, you must install from NuGet as install-package System.Data.SqlClient.  Once installed, this reference is available for use and code will compile. Sources: https://social.msdn.microsoft.com/Forums/en-US/ec2361a3-1931-4423-bf68-08b206ce67aa/reference-systemdatasqlclient-not-found?forum=netfxbcl

Azure Function Setup Environment Configuration

You can setup Configuration Variables to store database connection strings or keys at the application level. You can get retrieve that value to be used in any of your functions. Azure Function -> Settings -> Configuration -> New application setting MyKey01 = “xxxxxxxxxxxxxxx”

Create SQL Login for SQL Azure Database

Generating Logins Logins are server wide login and password pairs, where the login has the same password across all databases. Here is some sample Transact-SQL that creates a login: You must be connected to the master database on SQL Azure with the administrative login (which you get from the SQL Azure portal) to execute the... » read more

NCRONTAB Used By Azure Function

Example When Triggered 0 */5 * * * * once every five minutes 0 0 * * * * once at the top of every hour 0 0 */2 * * * once every two hours 0 0 9-17 * * * once every hour from 9 AM to 5 PM 0 30 9 *... » read more

Azure Function Add Assembly

The following assemblies are automatically added by the Azure Functions hosting environment: mscorlibSystemSystem.CoreSystem.XmlSystem.Net.HttpMicrosoft.Azure.WebJobsMicrosoft.Azure.WebJobs.HostMicrosoft.Azure.WebJobs.ExtensionsSystem.Web.HttpSystem.Net.Http.Formatting The following assemblies may be referenced by simple-name (for example, #r “AssemblyName”): Newtonsoft.JsonMicrosoft.WindowsAzure.StorageMicrosoft.ServiceBusMicrosoft.AspNet.WebHooks.ReceiversMicrosoft.AspNet.WebHooks.CommonMicrosoft.Azure.NotificationHubs Sources: https://docs.microsoft.com/en-us/answers/questions/107470/how-to-add-reference-to-directives-in-azure-functi.html