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
Copy file name to clipboardExpand all lines: articles/azure-signalr/signalr-howto-authorize-application.md
+55-67Lines changed: 55 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: Authorize requests to Azure SignalR Service resources with Microsoft Entra applications
3
3
description: This article provides information about authorizing requests to Azure SignalR Service resources by using Microsoft Entra applications.
4
-
author: vicancy
5
-
ms.author: lianwei
6
-
ms.date: 02/03/2023
4
+
author: terencefan
5
+
ms.author: tefa
6
+
ms.date: 03/14/2023
7
7
ms.service: azure-signalr-service
8
8
ms.topic: how-to
9
9
ms.devlang: csharp
@@ -12,52 +12,26 @@ ms.custom: subject-rbac-steps
12
12
13
13
# Authorize requests to Azure SignalR Service resources with Microsoft Entra applications
14
14
15
-
Azure SignalR Service supports Microsoft Entra ID for authorizing requests from [Microsoft Entra applications](../active-directory/develop/app-objects-and-service-principals.md).
15
+
Azure SignalR Service supports Microsoft Entra ID for authorizing requests from [Microsoft Entra applications](/entra/identity-platform/app-objects-and-service-principals).
16
16
17
17
This article shows how to configure your Azure SignalR Service resource and codes to authorize requests to the resource from a Microsoft Entra application.
18
18
19
-
## Register an application
19
+
## Register an application in Microsoft Entra ID
20
20
21
-
The first step is to register a Microsoft Entra application:
22
-
23
-
1. In the [Azure portal](https://portal.azure.com/), search for and select **Microsoft Entra ID**.
24
-
2. Under **Manage**, select **App registrations**.
25
-
3. Select **New registration**. The **Register an application** pane opens.
26
-
27
-

28
-
5. For **Name**, enter a display name for your application.
29
-
6. Select **Register** to confirm the registration.
21
+
The first step is to [Register an application in Microsoft Entra ID](/entra/identity-platform/quickstart-register-app):
30
22
31
23
After you register your application, you can find the **Application (client) ID** and **Directory (tenant) ID** values on the application's overview page. These GUIDs can be useful in the following steps.
32
24
33
25

34
26
35
-
To learn more about registering an application, see [Quickstart: Register an application with the Microsoft identity platform](../active-directory/develop/quickstart-register-app.md).
36
-
37
27
## Add credentials
38
28
39
-
You can add both certificates and client secrets (a string) as credentials to your confidential client app registration.
40
-
41
-
### Client secret
42
-
43
-
The application requires a client secret to prove its identity when it's requesting a token. To create a client secret, follow these steps:
44
-
45
-
1. Under **Manage**, select **Certificates & secrets**.
46
-
1. On the **Client secrets** tab, select **New client secret**.
47
-
48
-

49
-
1. Enter a description for the client secret, and choose an expiration time.
50
-
1. Copy the value of the client secret and then paste it in a secure location.
51
-
> [!NOTE]
52
-
> The secret appears only once.
29
+
After registering an app, you can add **certificates, client secrets (a string), or federated identity credentials** as credentials to your confidential client app registration. Credentials allow your application to authenticate as itself, requiring no interaction from a user at runtime, and are used by confidential client applications that access a web API.
53
30
54
-
### Certificate
31
+
-[Add a certificate](/entra/identity-platform/quickstart-register-app?tabs=certificate#add-credentials)
32
+
-[Add a client secret](/entra/identity-platform/quickstart-register-app?tabs=client-secret#add-credentials)
33
+
-[Add a federated credential](/entra/identity-platform/quickstart-register-app?tabs=federated-credential#add-credentials)
55
34
56
-
You can upload a certificate instead of creating a client secret.
57
-
58
-

59
-
60
-
To learn more about adding credentials, see [Add credentials](../active-directory/develop/quickstart-register-app.md#add-credentials).
61
35
62
36
## Add role assignments in the Azure portal
63
37
@@ -93,58 +67,72 @@ To learn more about how to assign and manage Azure roles, see these articles:
93
67
-[Assign Azure roles using the Azure CLI](../role-based-access-control/role-assignments-cli.md)
94
68
-[Assign Azure roles using Azure Resource Manager templates](../role-based-access-control/role-assignments-template.md)
95
69
96
-
## Configure your app
70
+
## Microsoft.Azure.SignalR app server SDK for C#
97
71
98
-
### App server
72
+
[Azure SignalR server SDK for C#](https://github.com/Azure/azure-signalr)
99
73
100
-
The best practice is to configure identity and credentials in your environment variables:
74
+
### Use Microsoft Entra application with certificate
|`AZURE_TENANT_ID`| The Microsoft Entra tenant ID. |
105
-
|`AZURE_CLIENT_ID`| The client (application) ID of an app registration in the tenant. |
106
-
|`AZURE_CLIENT_SECRET`| A client secret that was generated for the app registration. |
107
-
|`AZURE_CLIENT_CERTIFICATE_PATH`| A path to a certificate and private key pair in PEM or PFX format, which can authenticate the app registration. |
108
-
|`AZURE_USERNAME`| The username, also known as User Principal Name (UPN), of a Microsoft Entra user account. |
109
-
|`AZURE_PASSWORD`| The password of the Microsoft Entra user account. A password isn't supported for accounts with multifactor authentication enabled. |
You can use either [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) or [EnvironmentCredential](/dotnet/api/azure.identity.environmentcredential) to configure your Azure SignalR Service endpoints. Here's the code for `DefaultAzureCredential`:
86
+
### Use Microsoft Entra application with client secret
### Use Microsoft Entra application with Federated identity
124
100
125
-
```C#
101
+
> [!NOTE]
102
+
> Configure an application to trust a managed identity is a preview feature.
103
+
> To learn more about it, see [Configure an application to trust a managed identity (preview)](/entra/workload-id/workload-identity-federation-config-app-trust-managed-identity).
To learn how `DefaultAzureCredential` works, see [DefaultAzureCredential class](/dotnet/api/overview/azure/identity-readme#defaultazurecredential).
136
-
137
-
#### Use endpoint-specific credentials
125
+
### Use multiple endpoints
138
126
139
-
In your organization, you might want to use different credentials for different endpoints.
127
+
Credentials can be different for different endpoints.
140
128
141
-
In this scenario, you can use [ClientSecretCredential](/dotnet/api/azure.identity.clientsecretcredential) or [ClientCertificateCredential](/dotnet/api/azure.identity.clientcertificatecredential):
129
+
In this sample, the Azure SignalR SDK will connect to `resource1` with client secret and connect to `resource2` with certificate.
###Azure SignalR Service bindings in Azure Functions
145
+
## Azure SignalR Service bindings in Azure Functions
158
146
159
147
Azure SignalR Service bindings in Azure Functions use [application settings](../azure-functions/functions-how-to-use-azure-function-app-settings.md) in the portal or [local.settings.json](../azure-functions/functions-develop-local.md#local-settings-file) locally to configure Microsoft Entra application identities to access your Azure SignalR Service resources.
160
148
161
149
First, you need to specify the service URI of Azure SignalR Service. The key of the service URI is `serviceUri`. It starts with a connection name prefix (which defaults to `AzureSignalRConnectionString`) and a separator. The separator is an underscore (`__`) in the Azure portal and a colon (`:`) in the *local.settings.json* file. You can customize the connection name by using the binding property [`ConnectionStringSetting`](../azure-functions/functions-bindings-signalr-service.md). Continue reading to find the sample.
162
150
163
151
Then, you choose whether to configure your Microsoft Entra application identity in [predefined environment variables](#configure-an-identity-in-predefined-environment-variables) or in [SignalR-specified variables](#configure-an-identity-in-signalr-specified-variables).
164
152
165
-
####Configure an identity in predefined environment variables
153
+
### Configure an identity in predefined environment variables
166
154
167
155
See [Environment variables](/dotnet/api/overview/azure/identity-readme#environment-variables) for the list of predefined environment variables. When you have multiple services, we recommend that you use the same application identity, so that you don't need to configure the identity for each service. Other services might also use these environment variables, based on the settings of those services.
168
156
@@ -188,7 +176,7 @@ AZURE_TENANT_ID = ...
188
176
AZURE_CLIENT_SECRET = ...
189
177
```
190
178
191
-
####Configure an identity in SignalR-specified variables
179
+
### Configure an identity in SignalR-specified variables
192
180
193
181
SignalR-specified variables share the same key prefix with the `serviceUri` key. Here's the list of variables that you might use:
0 commit comments