Skip to content

Commit 7f53a2b

Browse files
authored
Merge pull request #256718 from wchigit/how-to-signalr
Sample code for integration with SignalR
2 parents 054f9e5 + 88bdbc0 commit 7f53a2b

File tree

2 files changed

+54
-21
lines changed

2 files changed

+54
-21
lines changed

articles/service-connector/how-to-integrate-signalr.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: maud-lv
55
ms.author: malev
66
ms.service: service-connector
77
ms.topic: how-to
8-
ms.date: 08/11/2022
8+
ms.date: 10/31/2023
99
ms.custom:
1010
- ignite-fall-2021
1111
- kr2b-contr-experiment
@@ -14,7 +14,7 @@ ms.custom:
1414

1515
# Integrate Azure SignalR Service with Service Connector
1616

17-
This article shows the supported authentication types and client types of Azure SignalR Service using Service Connector. This article also shows default environment variable name and value or Spring Boot configuration that you get when you create the service connection. For more information, see [Service Connector environment variable naming convention](concept-service-connector-internals.md).
17+
This article supported authentication methods and clients, and shows sample code you can use to connect Azure SignalR Service to other cloud services using Service Connector. This article also shows default environment variable name and value or Spring Boot configuration that you get when you create the service connection. For more information about naming conventions, check the [Service Connector internals](concept-service-connector-internals.md#configuration-naming-convention) article.
1818

1919
## Supported compute service
2020

@@ -25,15 +25,6 @@ This article shows the supported authentication types and client types of Azure
2525

2626
Supported authentication and clients for App Service and Container Apps:
2727

28-
### [Azure App Service](#tab/app-service)
29-
30-
| Client type | System-assigned managed identity | User-assigned managed identity | Secret / connection string | Service principal |
31-
|-------------|--------------------------------------|--------------------------------------|--------------------------------------|--------------------------------------|
32-
| .NET | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) |
33-
| None | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) |
34-
35-
### [Azure Container Apps](#tab/container-apps)
36-
3728
| Client type | System-assigned managed identity | User-assigned managed identity | Secret / connection string | Service principal |
3829
|-------------|--------------------------------------|--------------------------------------|--------------------------------------|--------------------------------------|
3930
| .NET | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) | ![yes icon](./media/green-check.png) |
@@ -43,35 +34,50 @@ Supported authentication and clients for App Service and Container Apps:
4334

4435
## Default environment variable names or application properties
4536

46-
Use the connection details below to connect compute services to SignalR. For each example below, replace the placeholder texts
37+
Use environment variable names listed below to connect compute services to Azure SignalR Service. For each example below, replace the placeholder texts
4738
`<SignalR-name>`, `<access-key>`, `<client-ID>`, `<tenant-ID>`, and `<client-secret>` with your own SignalR name, access key, client ID, tenant ID and client secret.
4839

49-
### .NET
50-
51-
#### Secret / Connection string
40+
### System-assigned Managed Identity
5241

5342
| Default environment variable name | Description | Example value |
5443
| --- | --- | --- |
55-
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string | `Endpoint=https://<SignalR-name>.service.signalr.net;AccessKey=<access-key>;Version=1.0;` |
44+
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string with Managed Identity | `Endpoint=https://<SignalR-name>.service.signalr.net;AuthType=aad;<client-ID>;Version=1.0;` |
5645

57-
#### System-assigned Managed Identity
46+
#### Sample code
47+
Refer to the steps and code below to connect to Azure SignalR Service using a system-assigned managed identity.
48+
[!INCLUDE [code for signalR](./includes/code-signalr.md)]
49+
50+
### User-assigned Managed Identity
5851

5952
| Default environment variable name | Description | Example value |
6053
| --- | --- | --- |
61-
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string with Managed Identity | `Endpoint=https://<SignalR-name>.service.signalr.net;AuthType=aad;<client-ID>;Version=1.0;` |
54+
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string with Managed Identity | `Endpoint=https://<SignalR-name>.service.signalr.net;AuthType=aad;client-id=<client-id>;Version=1.0;` |
55+
56+
#### Sample code
57+
Refer to the steps and code below to connect to Azure SignalR Service using a user-assigned managed identity.
58+
[!INCLUDE [code for signalR](./includes/code-signalr.md)]
59+
6260

63-
#### User-assigned Managed Identity
61+
### Connection string
6462

6563
| Default environment variable name | Description | Example value |
6664
| --- | --- | --- |
67-
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string with Managed Identity | `Endpoint=https://<SignalR-name>.service.signalr.net;AuthType=aad;client-id=<client-id>;Version=1.0;` |
65+
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string | `Endpoint=https://<SignalR-name>.service.signalr.net;AccessKey=<access-key>;Version=1.0;` |
6866

69-
#### Service Principal
67+
#### Sample code
68+
Refer to the steps and code below to connect to Azure SignalR Service using a connection string.
69+
[!INCLUDE [code for signalR](./includes/code-signalr.md)]
70+
71+
### Service Principal
7072

7173
| Default environment variable name | Description | Example value |
7274
| --- | --- | --- |
7375
| AZURE_SIGNALR_CONNECTIONSTRING | SignalR Service connection string with Service Principal | `Endpoint=https://<SignalR-name>.service.signalr.net;AuthType=aad;ClientId=<client-ID>;ClientSecret=<client-secret>;TenantId=<tenant-ID>;Version=1.0;` |
7476

77+
#### Sample code
78+
Refer to the steps and code below to connect to Azure SignalR Service using a service principal.
79+
[!INCLUDE [code for signalR](./includes/code-signalr.md)]
80+
7581
## Next steps
7682

7783
> [!div class="nextstepaction"]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
author: wchigit
3+
ms.service: service-connector
4+
ms.topic: include
5+
ms.date: 10/31/2023
6+
ms.author: wchi
7+
---
8+
9+
### [.NET](#tab/dotnet)
10+
11+
1. Install dependencies.
12+
```bash
13+
dotnet add package Microsoft.Azure.SignalR
14+
```
15+
1. Get the connection string from the environment variables added by Service Connector.
16+
17+
```csharp
18+
var builder = WebApplication.CreateBuilder(args);
19+
20+
var connectionString = Environment.GetEnvironmentVariable("AZURE_SIGNALR_CONNECTIONSTRING");
21+
builder.Services.AddSignalR().AddAzureSignalR(connectionString);
22+
23+
var app = builder.Build();
24+
```
25+
26+
### [Other](#tab/other)
27+
For other languages, you can use the connection string that Service Connector sets to the environment variables to connect Azure SignalR Service. For environment variable details, see [Integrate Azure SignalR Service with Service Connector](../how-to-integrate-signalr.md).

0 commit comments

Comments
 (0)