This document discusses new features and improvements in Azure Functions V2 including support for Java and .NET Core 2.0, separation of host and runtime processes, and the introduction of Durable Functions for orchestrating workflows. Durable Functions allow defining workflows using code and handle state management. Application Insights is recommended for monitoring performance and stability. Authentication, CORS, and retry policies are also discussed.
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
#SPFestSea Introduction to #Azure #Functions v2
1. Azure Functions: What’s New In
V2 & Getting Started
SharePoint Fest Seattle 2019
Vincent Biret
2. Passionate about technologies, development and community
Vincent Biret
@baywet
bit.ly/vince365
Microsoft Office Dev MVP
Azure and Office 365 developer @ 2toLead
11. 6 languages supported for production in Azure Functions and more to come
Languages (v2)
12. These langauges are suitable for experiments but not for production workloads
Preview Languages
13. Start with consumption and work your way up depending on features and cost
SKU’s & scale
Consumption based plan
Cost Based # of Executions, Duration
and Memory (GB.s)
Dedicated App Service plan
Tiers: Free, Shared, Basic, Standard,
Premium
Cost based on reserved VMs
You have to manage scale
Premium plan (preview)
Mix between consumption and
dedicated
Unlimited and continuous run times
Faster scaling than dedicated
14. Besides the browser, you can use VS2017/2019 + Azure SDK or VSCode + Azure F CLI
Tooling
17. The separation of processes solved a lot of dependencies versions issues for dotnet
Main improvements
• Support for Java (version 8)
• Transition to Dot Net Core 2 (from 4.7)
• You must migrate from TextWriter to ILogger
• Upgrade to Node 8/10 (from 6)
• Separation of host process and running process
• Extensions based model
• Moved from Web Job Dashboard to Application Insights
• Default timeout on ASE set to 30 minutes
• Azure Durable functions
18. A common pattern to chain Azure Function was to use queues
Coordinating Azure Functions: Chaining
19. A common pattern to chain Azure Function was to use a state repository, each function
triggering the next one
Coordinating Azure Functions: State Repo
20. The pain of coordinating Azure Functions grows exponentially with the number of
functions.
TRYING TO
COORDINATE
MANY FUNCTIONS
21. Durable Functions remove a lot of pain introduced with regular functions
Introducing Durable Functions
•All the benefits of « regular » Functions
•Code defined workflow
•Automates state management
•Reports status
•Enables new design patterns
• Fan out/Fan-in
• Chaining
• Monitoring
22. The Orchestrator leverages a decorator design pattern to « work it’s magic »
High level overview
Orchestration
client
State persistence
Orchestrator
ActivitiesTrigger
23. Timers and external events allow to implement advanced scenarios like approvals, or
deep integrations
Timers and external events
• Part of Durable Functions
• Timers allow to set « timeouts » during execution
• Avoids « active waiting »
• External events allow processes outside of the Functions to influence
the execution
26. Application Insights is a key tool in understanding performance and stability of your
functions. It should ALWAYS be enabled.
Telemetry
• Azure WebJobs Dashboard and Functions integration is being
retired
• Application Insight is the tool of choice
• Set up sampling
• Set up Daily cap
• (when available) set up retention period
27. CORS are essential to comply with browsers security features when developing front end
applications
Local and production CORS
• Azure App Service Environment provides support for CORS
• When debugging locally you can configure host to support CORS
• Local.settings.json
28. As http trigger functions are exposed to the web, it’s important to secure those.
Authentication/Authorization
• Using keys, existing policies:
• Anonymous: anyone can access
• Function: accepts host or function key
• Admin: accepts host key
• System: only accepts the master key
• User: validates a use Auth (not working today)
• Using bearer token validation (easy-auth)
• Requires OAuth integration
29. It’s important to allow the function host to « understand » what is going on with your
functions. This is why it is healthy to let your functions fail.
Retry handling
• Some triggers include default retry mechanisms
• Eg: Service Bus, Event Hub,…
• NEVER do active retry policies
• ALWAYS let your functions fail
• Azure Durable Functions include a passive retry mechanism for
activities
https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings
Samples from Fabian: https://github.com/fabianwilliams/AzureFunctionsWithVisualStudio/tree/master/FunctWithFabs/FunctWithFabs
The key can be passed using the code query string parameter or the x-functions-key http header
https://vincentlauzon.com/2017/12/04/azure-functions-http-authorization-levels/
https://github.com/Azure/azure-functions-host/issues/33
Money save = dev time saved, less support to provide, better product/service