Azure SignalR binding spec

Detailed documentation on the Azure SignalR binding component

Component format

To setup Azure SignalR binding create a component of type bindings.azure.signalr. See this guide on how to create and apply a binding configuration.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: <NAME>
  5. spec:
  6. type: bindings.azure.signalr
  7. version: v1
  8. metadata:
  9. - name: connectionString
  10. value: Endpoint=https://<your-azure-signalr>.service.signalr.net;AccessKey=<your-access-key>;Version=1.0;
  11. - name: hub # Optional
  12. value: <hub name>

Warning

The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described here.

Spec metadata fields

FieldRequiredBinding supportDetailsExample
connectionStringYOutputThe Azure SignalR connection string“Endpoint=https://<your-azure-signalr>.service.signalr.net;AccessKey=<your-access-key>;Version=1.0;”
hubNOutputDefines the hub in which the message will be send. The hub can be dynamically defined as a metadata value when publishing to an output binding (key is “hub”)“myhub”
endpointNOutputEndpoint of Azure SignalR; required if not included in the connectionString or if using Azure ADhttps://<your-azure-signalr>.service.signalr.net
accessKeyNOutputAccess keyyour-access-key

Azure Active Directory (Azure AD) authentication

The Azure SignalR binding component supports authentication using all Azure Active Directory mechanisms. See the docs for authenticating to Azure to learn more about the relevant component metadata fields based on your choice of Azure AD authentication mechanism.

You have two options to authenticate this component with Azure AD:

  • Pass individual metadata keys:
    • endpoint for the endpoint
    • If needed: azureClientId, azureTenantId and azureClientSecret
  • Pass a connection string with AuthType=aad specified:
    • System-assigned managed identity: Endpoint=https://<servicename>.service.signalr.net;AuthType=aad;Version=1.0;
    • User-assigned managed identity: Endpoint=https://<servicename>.service.signalr.net;AuthType=aad;ClientId=<clientid>;Version=1.0;
    • Azure AD application: Endpoint=https://<servicename>.service.signalr.net;AuthType=aad;ClientId=<clientid>;ClientSecret=<clientsecret>;TenantId=<tenantid>;Version=1.0;
      Note that you cannot use a connection string if your application’s ClientSecret contains a ; character.

Binding support

This component supports output binding with the following operations:

  • create

Additional information

By default the Azure SignalR output binding will broadcast messages to all connected users. To narrow the audience there are two options, both configurable in the Metadata property of the message:

  • group: Sends the message to a specific Azure SignalR group
  • user: Sends the message to a specific Azure SignalR user

Applications publishing to an Azure SignalR output binding should send a message with the following contract:

  1. {
  2. "data": {
  3. "Target": "<enter message name>",
  4. "Arguments": [
  5. {
  6. "sender": "dapr",
  7. "text": "Message from dapr output binding"
  8. }
  9. ]
  10. },
  11. "metadata": {
  12. "group": "chat123"
  13. },
  14. "operation": "create"
  15. }

For more information on integration Azure SignalR into a solution check the documentation

Last modified October 4, 2022: Updated metadata for various Azure components (#2855) (d5a8227b)