Public preview launch of Dapr extension for Azure Functions
Published Oct 27 2023 11:09 AM 4,379 Views
Microsoft

We are pleased to announce the public preview launch of the Dapr extension and the seamless integration with Azure Functions for cloud-native services hosted on Azure Container Apps. These capabilities enable functions to seamlessly interact with Dapr, facilitating the development of cloud-native applications. Azure Functions on Azure Container Apps was launched in public preview in May 2023 which enables you to quickly build event driven, cloud-native apps, with the flexibility to run Functions along with other microservices, APIs, websites, workflows or any container hosted components.  With this seamless integration cloud native microservices can leverage DAPR to simplify the development of distributed applications by abstracting away the challenges in building resilient, scalable, and secure cloud-native systems.

The DAPR extension for Azure Functions is optimized for  Azure Functions on  Azure  container apps plans. In addition, the extension can also be used in other environments that supports Dapr and Azure Functions like AKS, Kubernetes or self-hosted mode.

 

Azure Functions is a serverless  solution that offers an event driven compute experience, integrated programming model and allows you write code in the language of your choice. You can connect other services without hard-coding integrations for faster development using the triggers and bindings that comes with Azure Functions extensions.

 

Dapr is an open source, Cloud Native Computing Foundation (CNCF) project and the foundational microservices building block for Azure Container Apps.  The DAPR extension for Azure Functions, on Azure Container Apps platform can provide:

  • Essential microservices capabilities powered by Dapr and consumed via native Functions programming model.
  • Simplified abstractions to increase developer productivity for practicing event-driven architecture or microservices patterns such as fault-tolerance.
  • Managed Dapr infrastructure without frictions for Functions audiences.

 

DAPR Extension Building blocks:

Ramya_Oruganti_0-1698403677981.png

 

 Dapr extension for Azure Functions scenarios:

 

This new extension allows you to more easily pair the Azure Functions programming model with capabilities from Dapr. or example, a public facing front end function http trigger api can securely invoke a backend Dapr API managed by Dapr directly within the functions programming model like below. The DAPR capabilities are extended as Triggers and Bindings to the Function

 

Ramya_Oruganti_1-1698403677987.png

 

Enable Dapr from Azure Functions on Azure Container Apps:

Ramya_Oruganti_2-1698403677996.png

 Front end Azure Function Http Trigger enabled with Dapr using Service Invocation Output binding:

Ramya_Oruganti_3-1698403677997.png

 

Ramya_Oruganti_4-1698403678002.png

 

Function App Settings to be configured:

“Appid” : “<appid>”

“Methodname” : “<serviceinvokemethodname>”

 

Service Invocation Trigger

Ramya_Oruganti_5-1698403678006.png

 

Function App Settings to be configured:

“StatestoreName” : “<statestorename>

“DAPR_APP_PORT” : “<DAPR APP port>”

 

Other scenarios include keeping some persistent and flexible state alongside your function and create /retrieve state managed by Dapr directly within the function app or use Dapr extension to publish and subscribe to topics between functions.

 

DAPR Extension for Azure Function Triggers

Azure Function triggers cause a function to run. A trigger defines how a function is invoked and a function must have exactly one trigger. Triggers have associated data, which is often provided as the payload of the function.

Trigger Type

Description

daprBindingTrigger

Trigger on a Dapr input binding

daprServiceInvocationTrigger

Trigger on a Dapr service invocation

daprTopicTrigger

Trigger on a Dapr topic subscription

 

DAPR extension for Azure Function Bindings

Azure Function bindings is a way of declaratively connecting another resource to the function; bindings may be connected as Input BindingsOutput Bindings, or both. Data from bindings is provided to the function as parameters.

Binding Type

Direction

Description

daprState

Input

Pull in Dapr state for an execution

daprSecret

Input

Pull in Dapr secrets for an execution

daprState

Output

Save a value to Dapr state

daprInvoke

Output

Invoke another Dapr app

daprPublish

Output

Publish a message to a Dapr topic

daprBinding

Output

Send a value to a Dapr output binding

 

With this new extension, you can now bring both together for serverless and event-driven apps that can use the growing set of capabilities Dapr provides. Developers, teams, and organizations can use these tools to build functions that use a powerful set of capabilities with little code. You can get started today with the extension, which is fully open source on GitHub.

 

Learn more:

Dapr Extension for Azure Functions | Microsoft Learn

Dapr Extension for interacting with Dapr APIs from an Azure Function (github.com)

Bicep templates sample

Quickstart to deploy Azure Functions and Dapr on ACA using azd

 

 

 

Version history
Last update:
‎Oct 28 2023 01:42 AM
Updated by: