Sample Code for Azure Functions
C# Batchfile
Permalink
Failed to load latest commit information.
AppSettingsWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
CSharpCompilerSlackOuthookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
CSharpCompilerWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
DotNetFrameworkVersionResponseCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
ExternalCsxWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
GenericWebhookCSharpExtensionMethod Change log.Verbose to log.Info May 11, 2016
GithubWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
LineBotWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
MyExtensions MyExtensions will be generated on CD. Jan 19, 2017
SSLCertificateExpireCheck #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
VSTSWebhookCSharp #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
WebhookCSharpGithubOctokit #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
WebhookCSharpSendToChatWork #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
WebhookCSharpSendToSlack #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
images Add README for Precompiled functions. Jan 10, 2017
sharedlib avoid issue : Azure/azure-webjobs-sdk-script#1073 by change reference… Dec 27, 2016
src add TraceWriter for method signature. Jan 10, 2017
.deployment Added .deployment for Kudu custom deploy with Git CI Apr 15, 2016
.gitignore MyExtensions will be generated on CD. Jan 19, 2017
CSharpScripting.csx Typo May 8, 2016
EnumerableExtensions.csx Added ExternalCsxSample Apr 14, 2016
LICENSE Initial Commit Apr 2, 2016
MyExtensions.sln Reference External Assemblies, and reference in Roslyn Compiler May 8, 2016
NugetSample.csx Added ExternalCsxSample Apr 14, 2016
PrecompileFunctions.sln Shorten FunctionName Jan 10, 2017
README.md #r "System.Configuration" is no longer needed with .csx for AzureFunc… Jan 19, 2017
RescureUrl.csx Google Chrisis Reposense も追加 Apr 17, 2016
deploy.cmd Add MSBuild to .deployment Jan 10, 2017
global.json Added PreCompile Sample Jan 10, 2017

README.md

AzureFunctionsIntroduction

This is Sample project for Azure Functions. May this repository help you understand Azure Functions better.

What you can know

This sample include following.

FunctionName Language Pre-compiled? Description
AppSettingsWebhookCSharp C# No Reference Application Settings > App Setting of Web Apps Sample code.
CSharpCompilerSlackOuthookCSharp C# No Slack Interactive C# Code Roslyn Evaluation Sample. (@C#: Enumerable.Range(10, 20).Aggregate((x, y) => x + y))
CSharpCompilerWebhookCSharp C# No Generic Webhook C# Code Roslyn Evaluation Sample.
DotNetFrameworkVersionResponseCSharp C# No Retrurn .NET Framework Friendly Name by passing .NET Framework Release Registry Value.
ExternalCsxWebhookCSharp C# No Reference external .csx usage Sample code.
GenericWebhookCSharpExtensionMethod C# No Extension Method usage Sample code.
GithubWebhookCSharp C# No Github Webhook Sample code.
LineBotWebhookCSharp C# No Line Bot Webhook Sample code with Emergency Evacuation info with sent info.
SSLCertificateExpireCheck C# No SSL Certificate Checker. Often introduce in AWS Lambda but you can do with C# + AzureFucntions, too!
VSTSWebhookCSharp C# No Visual Studio Team Service (VSTS) Webhook Sample code.
WebhookCSharpGithubOctokit C# No NuGet package reference sample for Octokit.
WebhookCSharpSendToChatWork C# No Chatwork Notification Sample code.
WebhookCSharpSendToSlack C# No Slack Notification Sample code.
src/PreCompiledFunctionSample C# Yes Basic sample of PreCompiled Function. Build artifact will published right under root as PreCompiledFunctionSample.
src/PreCompileEnvironmentVariables C# Yes Basic sample of PreCompiled Function with Logger. Build artifact will published right under root as PreCompileEnvironmentVariables.

GitHub Integration Sample

You may find this repository structure is fit with Azure Functions CI by Github.

This repogitory Sync with Azure Functions by GitHub Integration.

More Reference

http://tech.guitarrapc.com/archive/category/AzureFunctions

Precompiled functions reference

Refer basic information with https://github.com/Azure/azure-webjobs-sdk-script/wiki/Precompiled-functions .

Following additional tips will be useful for first step.

Description Screenshot
Precomplied function's Run signature will accept TraceWriter. Use Logger as same as .csx even you are using Precompile. You need to add Microsoft.Azure.WebJobs.Host nuget package to refer TraceWriter.
Precompiled function required to add Microsoft.AspNet.WebApi.Core nuget package for several HttpRequestMessage Extensions.
Precompiled function's dll will be locked by w3wp.exe when deployed function. You should kill w3wp.exe and restart AppService to deploy new PreCompiled dll.

Recommend Azure Functions settings for stability

These settings are my recommendation with using AzureFunctions.

Description Screenshot
Concider to select Dynamic Service Plan if possible.
This will bring you best cost efficiency and scalability
Keep your Azure Functions Runtime version up-to-date. Actually there's no meaning concider downtime because apply will be done in just a seconds. Azure Functions host (0.x) are deprecated and will be remove starting February 1st, 2017. if you're using preview features, you continue to set your minor version explicitly (i.e. ~1.0), rather than just the major version(~1)..

You can find Release note here.

Keep Function App Platform 32bit (don't change to 64bit)
Do not run out memory, add Dynamic Memory if needed! Default 128MB will be run out easiry. Upgrade to 256MB or higher as your app requires.
Dynamic Plan pricing is relates to Memory size, but less meanful to concider.
AzureFunctions pricing is here.
Make sure your functions in AppService will be less than 1536MB. This is limiation of Dynamic Service Plan.
In case you exceed 1536MB there's 2 options.
- Divide to separate functions.
- Combine all functions to single App Service Plan.
Stop nesting multiple Azure Functions, use #load "<YourCoolLogic.csx>" to load shared code.
This is efficient and speedier way to call functions.
Use AppSettings to store secret values. This eliminate sensitive value in the source code.
You can load it with both System.Environment.GetEnvironmentVariable("Key") or System.Configuration.ConfigurationManager.AppSettings["Key"].
C# sample with screenShot: GetEnvironmentVariable("Secret_Value") or ConfigurationManager.AppSettings["Secret_Value"];
See C# Dev Samples for more details

Not Recommend

There's are possible but I never recommend. These settings will bring complexity

Description Screenshot
Default TimeZone is UTC, but you can use LocalTime zone with WEBSITE_TIME_ZONE into Application Settings.
You can obtain all timezone string with System.TimeZoneInfo.GetSystemTimeZones()
Detail is here : Changing the server time zone on Azure Web Apps

License

MIT