You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -14,7 +14,7 @@ This set of articles explains how to authenticate, send real-time messages to cl
14
14
| Action | Type |
15
15
|---------|---------|
16
16
| Handle client events from Web PubSub |[Trigger binding](./functions-bindings-web-pubsub-trigger.md)|
17
-
| Handle client events from Web PubSub with HTTP trigger, or return client access URL and token | [Input binding](./functions-bindings-web-pubsub-input.md)
17
+
| Handle client events from Web PubSub with HTTP trigger, or return client access URL and token |[Input binding](./functions-bindings-web-pubsub-input.md)|
18
18
| Invoke service APIs |[Output binding](./functions-bindings-web-pubsub-output.md)|
@@ -65,18 +65,61 @@ Add the extension to your project by installing this [NuGet package].
65
65
66
66
(5)-(6) `WebPubSub` output binding to request service do something.
67
67
68
-
## Connection string settings
68
+
## Connection
69
69
70
-
By default, an application setting named `WebPubSubConnectionString` is used to store your Web PubSub connection string. When you choose to use a different setting name for your connection, you must explicitly set that as the key name in your binding definitions. During local development, you must also add this setting to the `Values` collection in the the [_local.settings.json_ file](./functions-develop-local.md#local-settings-file).
70
+
You can use [connection string](#connection-string) or [Microsoft Entra identity](#identity-based-connections) to connect to Azure Web PubSub service.
71
+
72
+
### Connection String
73
+
74
+
By default, an application setting named `WebPubSubConnectionString` is used to store your Web PubSub connection string. When you choose to use a different setting name for your connection, you must explicitly set that as the key name in your binding definitions. During local development, you must also add this setting to the `Values` collection in the [_local.settings.json_ file](./functions-develop-local.md#local-settings-file).
71
75
72
76
> [!IMPORTANT]
73
-
> A connection string includes the authorization information required for your application to access Azure Web PubSub service. The access key inside the connection string is similar to a root password for your service. For optimal security, your function app should use managed identities when connecting to the Web PubSub service instead of using a connection string. For more information, see [Authorize a managed identity request by using Microsoft Entra ID](../azure-web-pubsub/howto-authorize-from-managed-identity.md).
77
+
> A connection string includes the authorization information required for your application to access Azure Web PubSub service. The access key inside the connection string is similar to a root password for your service. For optimal security, your function app should use [managed identities](#identity-based-connections) when connecting to the Web PubSub service instead of using a connection string.
74
78
75
79
For details on how to configure and use Web PubSub and Azure Functions together, refer to [Tutorial: Create a serverless notification app with Azure Functions and Azure Web PubSub service](../azure-web-pubsub/tutorial-serverless-notification.md).
76
-
::: zone pivot="programming-language-csharp"
80
+
81
+
### Identity-based connections
82
+
83
+
If you're using Azure Web PubSub Functions Extensions v1.10.0 or higher, instead of using a connection string with an access key, you can configure your function app to authenticate to Azure Web PubSub using a Microsoft Entra identity.
84
+
85
+
This approach removes the need to manage secrets and is recommended for production workloads.
86
+
87
+
#### Prerequisites
88
+
89
+
Make sure the Microsoft Entra identity used by your function app has been granted an appropriate Azure RBAC role on the target Web PubSub resource:
90
+
91
+
-[Azure Web PubSub Owner](../role-based-access-control/built-in-roles/web-and-mobile.md#web-pubsub-service-owner)
92
+
93
+
#### Configuration
94
+
95
+
Identity-based connections in Azure Functions use a set of settings that share a common prefix. By default, Azure Web PubSub Functions extensions look for settings with the prefix `WebPubSubConnectionString`. You can customize this prefix by setting the `connection` property in your trigger or binding.
96
+
97
+
For Azure Web PubSub, the service-specific setting you must provide is the service endpoint URI:
| Service URI |`WebPubSubConnectionString__serviceUri`| The URI of your Web PubSub service endpoint. | Yes |
102
+
103
+
When hosted in the Azure Functions service, identity-based connections use a [managed identity](../app-service/overview-managed-identity.md?toc=%2fazure%2fazure-functions%2ftoc.json). The system-assigned identity is used by default, although a user-assigned identity can be specified. For more information on how to customize the identity, [Common properties for identity-based connections](./functions-reference.md#common-properties-for-identity-based-connections).
104
+
105
+
When run in other contexts, such as local development, your developer identity is used instead, although this can be customized. See [Local development with identity-based connections](./functions-reference.md#local-development-with-identity-based-connections).
106
+
107
+
#### Example configuration
108
+
109
+
The following example shows how to configure identity-based with default settings:
> When running in the isolated worker model, the Azure Web PubSub binding doesn't currently support Microsoft Entra ID authentication using managed identities. In the isolated model, you must continue to use a connection string, which includes a shared secret key.
79
-
::: zone-end
119
+
> When using `local.settings.json` file at local, [Azure App Configuration](../azure-app-configuration/quickstart-azure-functions-csharp.md), or [Key Vault](/azure/key-vault/general/overview) to provide settings for identity-based connections, replace `__` with `:` in the setting name to ensure names are resolved correctly.
120
+
>
121
+
> For example, `WebPubSubConnectionString:serviceUri`.
122
+
80
123
## Next steps
81
124
82
125
-[Handle client events from Web PubSub (Trigger binding)](./functions-bindings-web-pubsub-trigger.md)
0 commit comments