Serverless Compute – Logic Apps, Functions and Event Grid

Premier Developer

Premier

Application Development Manager Rick McGuire discusses the benefits of the serverless computing paradigm for designing and deploying applications into the Azure cloud.


A close up of a logo Description generated with high confidence

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.

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.

For this post, I want to introduce the serverless capabilities in Azure. With this, I’m 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 – and with that in mind, why not consider it?

What is serverless computing?

Serverless computing is an event-driven application design and deployment paradigm in which computing resources are provided as scalable cloud services.

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.

What are the benefits of serverless?

Serverless simplifies DevOps effort by eliminating the infrastructure component, and enabling developers and technical resources to focus on application and business problems – not infrastructure plumbing.

Consider, for example, the benefits of serverless:

  • No infrastructure management (abstraction of servers)
  • Dynamic scalability
  • Faster time to market
  • Reduced DevOps

Let’s 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.

What are Azure Functions?

Azure Functions enable you to develop serverless applications on Microsoft Azure. With the platform, you write small blocks of code, or “functions.” which include just the code you need for the problem at hand, without worrying about the entire application and infrastructure to run it.

Functions can dramatically increase your developer productivity. Azure Functions feature “built-in” triggers that are ways to start execution of your code, and bindings that provide a pre-built framework for accessing input and output data.

Azure functions offer:

  • Choice of language – Write functions using C#, F#, Node.js, Python, PHP, batch, bash, or any executable.
  • Automatic scaling – Azure functions detect workload volumes, and scale out and in automatically to handle it.
  • Pay-per-use pricing model – Pay only for the time spent running your code.
  • Bring your own dependencies – Functions supports NuGet and NPM, so you can use your favorite libraries.
  • Integrated security – Protect HTTP-triggered functions with OAuth providers such as Azure Active Directory, Facebook, Google, Twitter, and Microsoft Account.
  • Simplified integration – Easily leverage Azure services and software-as-a-service (SaaS) offerings.
  • Flexible development – Code your functions right in the portal, or set up continuous integration and deploy your code through GitHub, Visual Studio Team Services, and other supported development tools.
  • Open-source – The Functions runtime is open-source and available on GitHub.

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.

** Get started with Azure Functions -> here

What are Logic Apps?

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.

The Logic Apps Designer experience includes the following:

  • No Code
  • Browser-based
  • API composition
  • Full management API
  • Visual Studio IDE support

Why Use Logic Apps?

  • Iterate faster with hyper-scale computing
  • Utilize existing solutions and APIs – connect APIs easily
  • Leverage dozens of pre-built templates
  • Easy to use design tools – Logic Apps can be designed end-to-end in the browser
  • Reduce on-premises infrastructure
  • Quickly build and test software
  • Reduce time building your integration solutions

Logic Apps feature several straight-forward concepts:

  • Logic App Workflows model business processes as a series of steps (similar to the SQL Server Integration Services (SSIS) designer BIDS). You can leverage many already available connectors – Predefined APIs that focuses on connectivity.
  • Logic App Triggers 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 “Run Now” button.
  • Logic App Actions include the workflow steps performed after an event had been triggered. Actions 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!

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!

Get started with Logic Apps → here

What is Azure Event Grid?

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.

There are five concepts to understand with respect to Event Grid:

  1. Events – What happened.
  2. Event sources – Where the event took place.
  3. Topics – The endpoint where publishers send events.
  4. Event subscriptions – The endpoint or built-in mechanism to route events, sometimes to multiple handlers. Subscriptions are also used by handlers to intelligently filter incoming events.
  5. Event handlers – The app or service reacting to the event.

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.

Get started using Event Grid → here

Looking Forward

C:\Users\Admin\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\1476719.tmp

As the Azure cloud services continue to grow and evolve rapidly, expect to see a wide variety of serverless offerings.

 

For example, consider the following:

  • Azure API Management – serverless tier

Recently, Microsoft announced a API Management serverless tier 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 “pre-allocated” pricing tiers previously available, the consumption tier provides instant provisioning and pay-per-action pricing.

  • Azure SQL Database – serverless

Azure SQL Database serverless (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.

I hope this was helpful – 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 → here.

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 sentiment of the tweet text?

Perhaps the next enterprise solution you build will take advantage of serverless and PaaS?

Premier Developer
Premier Developer

Premier Support for Developers

Follow Premier   

0 comments

    Leave a comment