Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Azure functions: Build apps faster with serverless architecture (March 2018)

198 views

Published on

Azure Functions is a serverless compute service that enables you to run code-on-demand without having to explicitly provision or manage infrastructure. You can use Azure Functions to run a script or piece of code in response to a variety of events.

Published in: Technology
  • Be the first to comment

Azure functions: Build apps faster with serverless architecture (March 2018)

  1. 1. Microsoft Azure Azure Functions: Building apps faster with a serverless architecture Callon Campbell - @flying_maverick Systems Architect
  2. 2. Microsoft Azure About me Callon Campbell Systems Architect / Developer with 20 years of experience developing desktop, mobile and web enterprise applications using .NET, SQL Server, Mobile and Azure technologies. Co-creator of ReflectInsight, a .NET logging framework and a real-time Live Log Viewer. 2 Email: CallonCampbell@Outlook.com Twitter: @Flying_Maverick Blog: http://TheFlyingMaverick.com LinkedIn: LinkedIn.com/in/calloncampbell Website: http://ReflectInsight.com Slideshare: https://www.slideshare.net/calloncampbell
  3. 3. Microsoft Azure What is serverless? 4
  4. 4. Microsoft Azure Benefits of serverless 5
  5. 5. Microsoft Azure Realizing serverless benefits 6
  6. 6. Microsoft Azure Azure serverless offerings There are three components to Azure serverless: 7
  7. 7. Microsoft Azure What are Logic Apps? • Fully managed iPaaS (integration Platform as a Service) • Provide serverless workflows that allow developers to easily integrate data with their apps instead of writing complex glue code between disparate systems • Orchestrate and connect the serverless functions and APIs of your applications
  8. 8. Microsoft Azure Advantages of Logic Apps •Save time by designing complex processes using easy to understand design tools (focus on business) •Orchestration engine built for the cloud (cloud scale, massive compute, high availability built into the platform) •Reduced DevOps •Reduced costs •Reduced time to market 9
  9. 9. Microsoft Azure Quickly tap into the power of the cloud Fire workflows on events from other services 10
  10. 10. Microsoft Azure Orchestrate anything • Run mission-critical, complex integrations scenarios with ease • Connect on-premises, hybrid and cloud applications • Position for future with API centric connectivity • Easily connect custom on- premises applications to the cloud 11
  11. 11. Microsoft Azure Connectors •Out-of-the-box connectors reduce integration challenges and enable you to connect apps, data and device anywhere •Currently there are almost 200 connectors 12
  12. 12. Microsoft Azure What is Event Grid? • Messaging service to support event-based architectures manages the routing and delivery of events from a number of sources and subscribers • Built-in support for events coming from other Azure services, like resource groups, subscriptions, storage blobs, and event hubs • Is agnostic to any language or platform 13
  13. 13. Microsoft Azure Differences from other message queue services •Event Grid are centered around speed, scale, breadth, and low cost •Rather than being a general / generic messaging service, Event Grid is built specifically for Serverless architectures 14
  14. 14. Microsoft Azure Topics and Subscriptions 15
  15. 15. Microsoft Azure Event Grid Architectures Azure Event Grid is designed to be used in microservices and event based architectures 16
  16. 16. Microsoft Azure What is Azure Functions? • Azure Functions is a serverless event driven compute on demand experience • Think of Azure Functions as… • C#, JavaScript, PHP, Python and more • Visual Studio, VS Code and CLI tooling
  17. 17. Microsoft Azure Azure Functions architecture Azure Functions are built on top of Azure App Service and WebJobs SDK. 18
  18. 18. Microsoft Azure Serverless scale 19 Monolith Microservice Function Function Function FunctionMicroservice Function Microservice Microservice Microservice Function Function Function Function Function Function Function
  19. 19. Microsoft Azure What can I do with Azure Functions? •Azure Functions are great for processing data, integrating systems, working with IoT, simple API’s and microservices •Azure Functions provide templates for a number of key scenarios •Azure Functions supports • Triggers - a way to start execution • Bindings - a way to simplify code for input and output of data 20
  20. 20. Microsoft Azure Integrations • Azure Functions can be triggered by virtually any event in Azure, other 3rd party services or even from on-premise systems • These services can trigger your function (startup) or serve as input and output for your code 21 Supported Integrations • CosmosDB • Event Hubs • Mobile Apps (tables) • Notification Hubs • Service Bus (queues, topics) • Storage (blob, queues, tables) • GitHub (webhooks) • Twilio (SMS messages) • On-premises (using Service Bus)
  21. 21. Microsoft Azure 22
  22. 22. Microsoft Azure Securing your Azure Functions HttpTriggers can be protected by Oauth providers such as: • Azure Active Directory • Microsoft Account • Facebook • Google • Twitter 23
  23. 23. Microsoft Azure Azure Functions runtime versions
  24. 24. Microsoft Azure Function timeouts •On a Consumption plan, a function can run for a maximum of 10 minutes, with a default timeout of 5 minutes. •The value can be increased changing the property functionTimeout in host.json. •For longer running functions use the App Service Plan and/or Durable Functions. 25
  25. 25. Microsoft Azure Develop how you want 26
  26. 26. Demo 1: Azure Functions from Portal
  27. 27. Demo 2: Debugging from Visual Studio
  28. 28. Microsoft Azure Deployment and monitoring 41
  29. 29. Microsoft Azure Build and deployment •Visual Studio (dev) •Visual Studio Team Services (devops) •Functions CLI (ops) •Azure Resource Manager (ops) •Maven / Jenkins / TeamCity? (devops) 42
  30. 30. Microsoft Azure Building and deploying with VSTS •Setup an automated build •Setup release / continuous release •Plus many other options… 43
  31. 31. Demo 3a: Setup continuous build
  32. 32. Microsoft Azure Setup build 45
  33. 33. Microsoft Azure Setup release 46
  34. 34. Microsoft Azure Release – artifact 47
  35. 35. Microsoft Azure Release – continuous deployment 48
  36. 36. Microsoft Azure Release – publish 49
  37. 37. Demo 3b: Demo build and release
  38. 38. Microsoft Azure Monitoring •Application Insights •Functions Logs •Azure Monitor (soon) 51
  39. 39. Demo 4: Monitoring
  40. 40. Microsoft Azure Proxies •Proxies provide more control over all functions or just select methods •When using a custom domain, it’s used in the proxy 53
  41. 41. Microsoft Azure Routing Example Take our current function url: https://tag-function1.azurewebsites.net/api/HttpTriggerCSharp3 If we add a route in the function.json like so: "route": "helloworld" Our function URL would then be like this: https://tag-function1.azurewebsites.net/api/helloworld 54
  42. 42. Microsoft Azure Proxy Sample 55 If I setup a proxy, I can use the following: https://tag-function1.azurewebsites.net/hello
  43. 43. Demo 5: Setting up routing and proxies
  44. 44. Microsoft Azure Common scenarios for Azure Functions 57
  45. 45. Microsoft Azure Timer-based processing Azure Functions supports an event based on a timer using CRON job syntax. 58
  46. 46. Microsoft Azure Azure service event processing Azure Functions supports triggering an event based on an activity in an Azure service. 59
  47. 47. Microsoft Azure SaaS event processing Azure Functions supports triggers based on activity in a SaaS service. 60
  48. 48. Microsoft Azure Serverless web application architectures Azure Functions can power a single page app. 61
  49. 49. Microsoft Azure Serverless mobile backends A mobile backend can be just a set of HTTP APIs that are called from a mobile client using the WebHook URL. 62
  50. 50. Microsoft Azure Real-time stream processing Azure Functions can power an IoT Stream Analytics app. 63
  51. 51. Microsoft Azure Real-time bot messaging Azure Functions can be used to customize the behavior of a bot using a WebHook. 64
  52. 52. Microsoft Azure Best practices for Azure Functions 65
  53. 53. Microsoft Azure Approach to building functions “A key to realizing the full value is to write only the smallest unit of logic to do a single scope of work and to keep the dependencies to a minimum.” – Joseph Fultz and Darren Brust, MSDN Magazine 66
  54. 54. Microsoft Azure Best practices •Functions should “do one thing” •Functions should be idempotent •Functions should finish as quickly as possible 67
  55. 55. Microsoft Azure Where to get started •Start small, replace 1 API or background processing item •Integration is a great place, often it’s a new layer on top of old layers 68
  56. 56. Microsoft Azure Pricing 69
  57. 57. Microsoft Azure Pricing •No upfront cost •No termination fees •Pay only for what you use 70
  58. 58. Microsoft Azure 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’re already using App Service for your other applications, you can also run your functions on the same plan at no additional cost. 71
  59. 59. Microsoft Azure Pricing - Consumption Plan • The Consumption Plan is billed based on resource consumption and executions • Consumption Plan pricing includes a monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month: • This is the recommended plan for scale…but set your limits! 72
  60. 60. Microsoft Azure Pricing - App Service Plan • Your functions run on dedicated VMs • Dedicated VM’s are allocated to your App Service apps and function apps are always available whether code is actively running or not • Good option if you have under utilized VMs • A VM decouples the cost from both runtime and memory size – you can limit the cost for long- running functions to the cost of the VMs they run on 73
  61. 61. Microsoft Azure One more demo… 74
  62. 62. Microsoft Azure A serverless sample 75 https://msdn.microsoft.com/en-ca/magazine/mt829271/
  63. 63. Microsoft Azure Summary 77
  64. 64. Microsoft Azure Summary • With Azure Functions, the focus is on the code and not managing the infrastructure. • When used as the serverless compute component of a serverless architecture, you have the following benefits: • Reduced time to market • Lower total cost of ownership • Pay per execution 78
  65. 65. Microsoft Azure Azure serverless compute •It’s now becoming easier than ever to create small, targeted microservice architecture using a variety of services •Azure provides many services that can help you achieve a low-friction, high-throughput and low-cost solution •Azure Functions, Logic Apps, Event Grid are just a few in the serverless architecture family 79
  66. 66. Azure Functions are bricks. You are the architect!
  67. 67. Microsoft Azure Thank you! CallonCampbell@Outlook.com TheFlyingMaverick.com @Flying_Maverick 81
  68. 68. Microsoft Azure What’s next? •Try Azure Functions for free: https://azure.microsoft.com/en-us/try/app-service/ •Blog:https://blogs.msdn.microsoft.com/appservicete am/tag/azure-functions/ •Twitter: @AzureFunctions •Learn more at Microsoft Virtual Academy and Channel 9 82
  69. 69. Microsoft Azure References • https://azure.microsoft.com/en-us/services/functions/ • https://functions.azure.com/ • https://portal.azure.com/ • https://docs.microsoft.com/en-us/azure/azure-functions/ • https://azure.microsoft.com/en-us/pricing/details/functions/ • Azure Functions in Practice • Azure - Serverless Architecture with Azure Functions • Visual Studio Tools for Azure Functions Preview • Azure Storage Explorer 83

×