{"id":37944,"date":"2019-12-03T12:00:35","date_gmt":"2019-12-03T19:00:35","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/premier-developer\/?p=37944"},"modified":"2019-11-26T07:38:26","modified_gmt":"2019-11-26T14:38:26","slug":"serverless-compute-logic-apps-functions-and-event-grid","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/serverless-compute-logic-apps-functions-and-event-grid\/","title":{"rendered":"Serverless Compute &#8211; Logic Apps, Functions and Event Grid"},"content":{"rendered":"<p>Application Development Manager <a href=\"https:\/\/www.linkedin.com\/in\/rickmcguire7\/\">Rick McGuire<\/a> discusses the benefits of the serverless computing paradigm for designing and deploying applications into the Azure cloud.<\/p>\n<hr \/>\n<p><img decoding=\"async\" class=\"size-full wp-image-37969 aligncenter\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/a-close-up-of-a-logo-description-generated-with-h-1.png\" alt=\"A close up of a logo Description generated with high confidence\" width=\"212\" height=\"172\" \/><\/p>\n<p>Many developers and architects these days focus on leveraging containers and orchestration platforms to solve technical\/business problems in the enterprise. Containerized workloads offer many benefits, however they can be complex and time consuming to build, deploy, and manage.<\/p>\n<p>While serverless computing has made its way into the enterprise, there are still many developers and infrastructure engineers who are not familiar with the technology and the clear advantages it offers. I believe serverless is the future of our industry. It is the ultimate way to leverage the cloud platform and streamline DevOps. The easiest way to reduce operational complexity is to eliminate the need for managing infrastructure.<\/p>\n<p>For this post, I want to introduce the serverless capabilities in Azure. With this, I\u2019m hoping to spark the interest of developers, architects, and DevOps engineers to think differently. While not all problems can be solved with serverless, many can \u2013 and with that in mind, why not consider it?<\/p>\n<h4>What is serverless computing?<strong>\n<\/strong><\/h4>\n<p>Serverless computing is an event-driven application design and deployment paradigm in which computing resources are provided as scalable cloud services.<\/p>\n<p>Serverless computing enables developers to build applications faster by eliminating the need to manage infrastructure. With serverless applications, it is the cloud platform, not you, that automatically provisions, scales, and manages the infrastructure needed to execute code.<\/p>\n<h4>What are the benefits of serverless?<\/h4>\n<p>Serverless simplifies DevOps effort by eliminating the infrastructure component, and enabling developers and technical resources to focus on application and business problems \u2013 not infrastructure plumbing.<\/p>\n<p>Consider, for example, the benefits of serverless:<\/p>\n<ul>\n<li>No infrastructure management (abstraction of servers)<\/li>\n<li>Dynamic scalability<\/li>\n<li>Faster time to market<\/li>\n<li>Reduced DevOps<\/li>\n<\/ul>\n<p>Let\u2019s dive into some of the capabilities that Azure provides for Serverless Compute. I will cover the three primary technologies: Azure Functions, Logic Apps and Event Grid. Keep in mind that the capabilities of these platforms are constantly evolving and expanding.<\/p>\n<h4>What are Azure Functions?<strong>\n<\/strong><\/h4>\n<p>Azure Functions enable you to develop serverless applications on Microsoft Azure. <img decoding=\"async\" class=\"wp-image-37970 alignleft\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-12.png\" alt=\"\" width=\"64\" height=\"64\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-12.png 256w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-12-150x150.png 150w\" sizes=\"(max-width: 64px) 100vw, 64px\" \/> With the platform, you write small blocks of code, or &#8220;functions.&#8221; which include just the code you need for the problem at hand, without worrying about the entire application and infrastructure to run it.<\/p>\n<p>Functions can dramatically increase your developer productivity. Azure Functions feature \u201cbuilt-in\u201d <strong><em>triggers<\/em><\/strong> that are ways to start execution of your code, and <strong><em>bindings<\/em><\/strong> that provide a pre-built framework for accessing input and output data.<\/p>\n<p>Azure functions offer:<\/p>\n<ul>\n<li>Choice of language &#8211; Write functions using C#, F#, Node.js, Python, PHP, batch, bash, or any executable.<\/li>\n<li>Automatic scaling &#8211; Azure functions detect workload volumes, and scale out and in automatically to handle it.<\/li>\n<li>Pay-per-use pricing model &#8211; Pay only for the time spent running your code.<\/li>\n<li>Bring your own dependencies &#8211; Functions supports NuGet and NPM, so you can use your favorite libraries.<\/li>\n<li>Integrated security &#8211; Protect HTTP-triggered functions with OAuth providers such as Azure Active Directory, Facebook, Google, Twitter, and Microsoft Account.<\/li>\n<li>Simplified integration &#8211; Easily leverage Azure services and software-as-a-service (SaaS) offerings.<\/li>\n<li>Flexible development &#8211; Code your functions right in the portal, or set up continuous integration and deploy your code through GitHub, Visual Studio Team Services, and other <a href=\"https:\/\/docs.microsoft.com\/azure\/app-service-web\/web-sites-deploy\">supported development tools<\/a>.<\/li>\n<li>Open-source &#8211; The Functions runtime is open-source and <a href=\"https:\/\/github.com\/azure\/azure-webjobs-sdk-script\">available on GitHub<\/a>.<\/li>\n<\/ul>\n<p>In terms of complexity and target audience, Functions are mainly focused at developers. The chart below shows where Azure Functions sits with respect to other low-code\/no-code options in the Azure stack.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-37971 size-large\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-13-1024x557.png\" alt=\"\" width=\"640\" height=\"348\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-13-1024x557.png 1024w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-13-300x163.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-13-768x418.png 768w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-13.png 1066w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>** Get started with Azure Functions -&gt; <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-functions\/\">here<\/a><\/p>\n<h4>What are Logic Apps?<strong>\n<\/strong><\/h4>\n<p><strong><img decoding=\"async\" width=\"64\" height=\"64\" class=\"wp-image-37972 alignleft\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-14.png\" \/><\/strong><\/p>\n<p>Logic Apps provide a way to simplify and implement scalable integrations and workflows in the cloud. You use a visual designer to model and automate your business process as a series of steps known as a workflow. There are many built-in connectors across the cloud and on-premises, allowing you to quickly integrate with multiple services and protocols.<\/p>\n<p>The Logic Apps Designer experience includes the following:<\/p>\n<ul>\n<li>No Code<\/li>\n<li>Browser-based<\/li>\n<li>API composition<\/li>\n<li>Full management API<\/li>\n<li>Visual Studio IDE support<\/li>\n<\/ul>\n<h4>Why Use Logic Apps?<\/h4>\n<ul>\n<li>Iterate faster with hyper-scale computing<\/li>\n<li>Utilize existing solutions and APIs &#8211; connect APIs easily<\/li>\n<li>Leverage dozens of pre-built templates<\/li>\n<li>Easy to use design tools &#8211; Logic Apps can be designed end-to-end in the browser<\/li>\n<li>Reduce on-premises infrastructure<\/li>\n<li>Quickly build and test software<\/li>\n<li>Reduce time building your integration solutions<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"682\" height=\"374\" class=\"wp-image-37973\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-15.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-15.png 682w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-15-300x165.png 300w\" sizes=\"(max-width: 682px) 100vw, 682px\" \/><\/p>\n<p>Logic Apps feature several straight-forward concepts:<\/p>\n<ul>\n<li>Logic App <strong><em>Workflows<\/em><\/strong> model business processes as a series of steps (similar to the SQL Server Integration Services (SSIS) designer BIDS). You can leverage many already available <strong><em>connectors<\/em><\/strong>\u00a0&#8211; Predefined APIs that focuses on connectivity.<\/li>\n<li>Logic App <strong><em>Triggers<\/em><\/strong> are predefined event that initiate a new instance of a workflow. Triggers can include the arrival of an e-mail, a change in your Azure Storage account, or a custom event using a webhook. To keep things simple, you can invoke triggers from a recurring schedule or on demand by clicking a \u201cRun Now\u201d button.<\/li>\n<li>Logic App <strong><em>Actions<\/em><\/strong> include the workflow steps performed after an event had been triggered. <strong><em>Actions<\/em><\/strong> perform operations and more. For instance, they can call out to other services with API Apps, direct HTTP endpoints, other workflows, send a response, and call other Logic Apps or Azure Functions!<\/li>\n<\/ul>\n<p>One of the more compelling reasons to consider Logic Apps is the many pre-built connectors available. Using these can save hours of time. Some examples include: Service Bus, Power BI, Oracle Database, OneDrive, and many more!<\/p>\n<p><img decoding=\"async\" width=\"800\" height=\"450\" class=\"wp-image-37974\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-16.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-16.png 800w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-16-300x169.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-16-768x432.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Get started with Logic Apps \u2192 <a href=\"https:\/\/docs.microsoft.com\/azure\/logic-apps\/logic-apps-overview\">here<\/a><\/p>\n<h4>What is Azure Event Grid?<\/h4>\n<p><img decoding=\"async\" class=\"alignleft wp-image-37975\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-17-150x150.png\" alt=\"\" width=\"64\" height=\"64\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-17-150x150.png 150w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-17.png 200w\" sizes=\"(max-width: 64px) 100vw, 64px\" \/><\/p>\n<p>Finally, I want to briefly cover Event Grid. Azure Event Grid is a fully managed intelligent event routing service that allows for uniform event consumption using a publish-subscribe model. You may use Azure Event Grid to react to relevant events across both Azure and non-Azure services in near-real time fashion.<\/p>\n<p>There are five concepts to understand with respect to Event Grid:<\/p>\n<ol>\n<li><strong><em>Events<\/em><\/strong> &#8211; What happened.<\/li>\n<li><strong><em>Event sources<\/em><\/strong> &#8211; Where the event took place.<\/li>\n<li><strong><em>Topics<\/em><\/strong> &#8211; The endpoint where publishers send events.<\/li>\n<li><strong><em>Event subscriptions<\/em><\/strong> &#8211; The endpoint or built-in mechanism to route events, sometimes to multiple handlers. Subscriptions are also used by handlers to intelligently filter incoming events.<\/li>\n<li><strong><em>Event handlers<\/em><\/strong> &#8211; The app or service reacting to the event.<\/li>\n<\/ol>\n<p><img decoding=\"async\" width=\"800\" height=\"450\" class=\"wp-image-37976\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-18.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-18.png 800w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-18-300x169.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/word-image-18-768x432.png 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>Use Event Grid for reactive programming, as it is just an event distributor. Notify me when I need to do something or notify some other service when it needs to do something.<\/p>\n<p>Get started using Event Grid \u2192 <a href=\"https:\/\/docs.microsoft.com\/azure\/event-grid\/\">here<\/a><\/p>\n<h4>Looking Forward<\/h4>\n<p><img decoding=\"async\" class=\"alignleft wp-image-37977\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/c-users-admin-appdata-local-microsoft-windows-ine-150x150.png\" alt=\"C:\\Users\\Admin\\AppData\\Local\\Microsoft\\Windows\\INetCache\\Content.MSO\\1476719.tmp\" width=\"64\" height=\"65\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/c-users-admin-appdata-local-microsoft-windows-ine-150x150.png 150w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/11\/c-users-admin-appdata-local-microsoft-windows-ine.png 223w\" sizes=\"(max-width: 64px) 100vw, 64px\" \/><\/p>\n<p>As the Azure cloud services continue to grow and evolve rapidly, expect to see a wide variety of serverless offerings.<\/p>\n<p>&nbsp;<\/p>\n<p>For example, consider the following:<\/p>\n<ul>\n<li>Azure API Management \u2013 serverless tier<\/li>\n<\/ul>\n<p>Recently, Microsoft announced a\u00a0<a href=\"https:\/\/azure.microsoft.com\/blog\/announcing-azure-api-management-for-serverless-architectures\/\">API Management serverless tier<\/a> for Azure API Management. Referred to as the consumption pricing tier, this service is a variant of API Management designed around the serverless computing model. Unlike the \u201cpre-allocated\u201d pricing tiers previously available, the consumption tier provides instant provisioning and pay-per-action pricing.<\/p>\n<ul>\n<li>Azure SQL Database \u2013 serverless<\/li>\n<\/ul>\n<p><a href=\"https:\/\/docs.microsoft.com\/azure\/sql-database\/sql-database-serverless\">Azure SQL Database serverless<\/a>\u00a0(available for preview at time of the time of writing) is a compute tier for single databases that automatically scales based on workload demand, and bills for the amount of compute used per second. The serverless compute tier also automatically pauses databases during inactive periods so that only storage charges are billed. It automatically resumes when activity returns.<\/p>\n<p>I hope this was helpful \u2013 we just scratched the surface on serverless. If you want to get started on a quick, fun project, I suggest using Logic Apps to monitor a Twitter feed. There is a walk through \u2192 <a href=\"https:\/\/docs.microsoft.com\/azure\/connectors\/connectors-create-api-twitter\">here<\/a>.<\/p>\n<p>Once you get this sample sending email to your Office 365 account, you might want to try using our Cognitive Services APIs to get the <a href=\"https:\/\/docs.microsoft.com\/azure\/cognitive-services\/text-analytics\/how-tos\/text-analytics-how-to-sentiment-analysis\">sentiment<\/a> of the tweet text?<\/p>\n<p>Perhaps the next enterprise solution you build will take advantage of serverless and PaaS?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For this post, I want to introduce the serverless capabilities in Azure. With this, I\u2019m hoping to spark the interest of developers, architects, and DevOps engineers to think differently. While not all problems can be solved with serverless, many can \u2013 and with that in mind, why not consider it?<\/p>\n","protected":false},"author":582,"featured_media":37955,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[25,5940,1],"tags":[24],"class_list":["post-37944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-development","category-permierdev","tag-azure"],"acf":[],"blog_post_summary":"<p>For this post, I want to introduce the serverless capabilities in Azure. With this, I\u2019m hoping to spark the interest of developers, architects, and DevOps engineers to think differently. While not all problems can be solved with serverless, many can \u2013 and with that in mind, why not consider it?<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/37944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=37944"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/37944\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37955"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=37944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=37944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=37944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}