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
# Authenticate .NET apps to Azure services during local development using brokered authentication
11
11
12
-
Brokered authentication collects user credentials using the system authentication broker to authenticate an app with <xref:Azure.Identity.InteractiveBrowserCredential>. A system authentication broker is an app running on a user's machine that manages the authentication handshakes and token maintenance for all connected accounts.
13
-
14
-
Brokered authentication offers the following benefits:
15
-
16
-
-**Enables Single Sign-On (SSO):** Enables apps to simplify how users authenticate with Microsoft Entra ID and protects Microsoft Entra ID refresh tokens from exfiltration and misuse.
17
-
-**Enhanced security:** Many security enhancements are delivered with the broker, without needing to update the app logic.
18
-
-**Enhanced feature support:** With the help of the broker, developers can access rich OS and service capabilities.
19
-
-**System integration:** Applications that use the broker plug-and-play with the built-in account picker, allowing the user to quickly pick an existing account instead of reentering the same credentials over and over.
20
-
-**Token Protection:** Ensures that the refresh tokens are device bound and enables apps to acquire device bound access tokens. See [Token Protection](/azure/active-directory/conditional-access/concept-token-protection).
Windows provides an authentication broker called [Web Account Manager (WAM)](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam). WAM enables identity providers such as Microsoft Entra ID to natively plug into the OS and provide secure login services to apps. Brokered authentication enables the app for all operations allowed by the interactive login credentials.
25
-
26
-
Personal Microsoft accounts and work or school accounts are supported. On supported Windows versions, the default browser-based UI is replaced with a smoother authentication experience, similar to built-in Windows apps.
macOS doesn't natively include a built-in authentication broker. Brokered authentication is supported via the `Azure.Identity.Broker` library, which uses platform-specific mechanisms and may integrate with apps like Microsoft Company Portal when devices are managed. For more information, see [Microsoft Enterprise SSO plug-in for Apple devices](/entra/identity-platform/apple-sso-plugin).
To enable brokered authentication in your application, follow these steps:
45
-
46
-
1. In the [Azure portal](https://portal.azure.com), navigate to **Microsoft Entra ID** and select **App registrations** on the left-hand menu.
47
-
1. Select the registration for your app, then select **Authentication**.
48
-
1. Add the appropriate redirect URI to your app registration via a platform configuration:
49
-
1. Under **Platform configurations**, select **+ Add a platform**.
50
-
1. Under **Configure platforms**, select the tile for your application type (platform) to configure its settings, such as **mobile and desktop applications**.
51
-
1. In **Custom redirect URIs**, enter the following redirect URI for your platform:
| Windows 10+ or WSL |`ms-appx-web://Microsoft.AAD.BrokerPlugin/{your_client_id}`|
56
-
| macOS |`msauth.com.msauth.unsignedapp://auth` for unsigned apps<br>`msauth.{bundle_id}://auth` for signed apps |
57
-
| Linux |`https://login.microsoftonline.com/common/oauth2/nativeclient`|
58
-
59
-
Replace `{your_client_id}` or `{bundle_id}` with the **Application (client) ID** from the app registration's **Overview** pane.
60
-
61
-
1. Select **Configure**.
62
-
63
-
To learn more, see [Add a redirect URI to an app registration](/entra/identity-platform/quickstart-register-app#add-a-redirect-uri).
64
-
65
-
1. Back on the **Authentication** pane, under **Advanced settings**, select **Yes** for **Allow public client flows**.
66
-
1. Select **Save** to apply the changes.
67
-
1. To authorize the application for specific resources, navigate to the resource in question, select **API Permissions**, and enable **Microsoft Graph** and other resources you want to access.
68
-
69
-
> [!IMPORTANT]
70
-
> You must also be the admin of your tenant to grant consent to your application when you sign in for the first time.
71
-
72
-
## Assign roles
73
-
74
-
To run your app code successfully with brokered authentication, grant your user account permissions using [Azure role-based access control (RBAC)](/azure/role-based-access-control/overview). Assign an appropriate role to your user account for the relevant Azure service. For example:
75
-
76
-
-**Azure Blob Storage**: Assign the **Storage Account Data Contributor** role.
77
-
-**Azure Key Vault**: Assign the **Key Vault Secrets Officer** role.
If an app is specified, it must have API permissions set for **user_impersonation Access Azure Storage** (step 6 in the previous section). This API permission allows the app to access Azure storage on behalf of the signed-in user after consent is granted during sign-in.
To run your app code successfully with brokered authentication, grant your user account permissions using [Azure role-based access control (RBAC)](/azure/role-based-access-control/overview). Assign an appropriate role to your user account for the relevant Azure service. For example:
9
+
10
+
-**Azure Blob Storage**: Assign the **Storage Account Data Contributor** role.
11
+
-**Azure Key Vault**: Assign the **Key Vault Secrets Officer** role.
12
+
13
+
If an app is specified, it must have API permissions set for **user_impersonation Access Azure Storage** (step 6 in the previous section). This API permission allows the app to access Azure storage on behalf of the signed-in user after consent is granted during sign-in.
To enable brokered authentication in your application, follow these steps:
9
+
10
+
1. In the [Azure portal](https://portal.azure.com), navigate to **Microsoft Entra ID** and select **App registrations** on the left-hand menu.
11
+
1. Select the registration for your app, then select **Authentication**.
12
+
1. Add the appropriate redirect URI to your app registration via a platform configuration:
13
+
1. Under **Platform configurations**, select **+ Add a platform**.
14
+
1. Under **Configure platforms**, select the tile for your application type (platform) to configure its settings, such as **mobile and desktop applications**.
15
+
1. In **Custom redirect URIs**, enter the following redirect URI for your platform:
| Windows 10+ or WSL |`ms-appx-web://Microsoft.AAD.BrokerPlugin/{your_client_id}`|
20
+
| macOS |`msauth.com.msauth.unsignedapp://auth` for unsigned apps<br>`msauth.{bundle_id}://auth` for signed apps |
21
+
| Linux |`https://login.microsoftonline.com/common/oauth2/nativeclient`|
22
+
23
+
Replace `{your_client_id}` or `{bundle_id}` with the **Application (client) ID** from the app registration's **Overview** pane.
24
+
25
+
1. Select **Configure**.
26
+
27
+
To learn more, see [Add a redirect URI to an app registration](/entra/identity-platform/quickstart-register-app#add-a-redirect-uri).
28
+
29
+
1. Back on the **Authentication** pane, under **Advanced settings**, select **Yes** for **Allow public client flows**.
30
+
1. Select **Save** to apply the changes.
31
+
1. To authorize the application for specific resources, navigate to the resource in question, select **API Permissions**, and enable **Microsoft Graph** and other resources you want to access.
32
+
33
+
> [!IMPORTANT]
34
+
> You must also be the admin of your tenant to grant consent to your application when you sign in for the first time.
Brokered authentication collects user credentials using the system authentication broker to authenticate an app. A system authentication broker is an app running on a user's machine that manages the authentication handshakes and token maintenance for all connected accounts.
7
+
8
+
Brokered authentication offers the following benefits:
9
+
10
+
-**Enables Single Sign-On (SSO):** Enables apps to simplify how users authenticate with Microsoft Entra ID and protects Microsoft Entra ID refresh tokens from exfiltration and misuse.
11
+
-**Enhanced security:** Many security enhancements are delivered with the broker, without needing to update the app logic.
12
+
-**Enhanced feature support:** With the help of the broker, developers can access rich OS and service capabilities.
13
+
-**System integration:** Applications that use the broker plug-and-play with the built-in account picker, allowing the user to quickly pick an existing account instead of re-entering the same credentials over and over.
14
+
-**Token Protection:** Ensures that the refresh tokens are device bound and enables apps to acquire device bound access tokens. For more information, see [Token Protection](/azure/active-directory/conditional-access/concept-token-protection).
macOS doesn't natively include a built-in authentication broker. The Azure Identity client library implements brokered authentication features using platform-specific mechanisms and can integrate with apps like Microsoft Company Portal when devices are managed. For more information, see [Microsoft Enterprise SSO plug-in for Apple devices](/entra/identity-platform/apple-sso-plugin).
Windows provides an authentication broker called [Web Account Manager (WAM)](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam). WAM enables identity providers such as Microsoft Entra ID to natively plug into the OS and provide secure login services to apps. Brokered authentication enables the app for all operations allowed by the interactive login credentials.
7
+
8
+
Personal Microsoft accounts and work or school accounts are supported. On supported Windows versions, the default browser-based UI is replaced with a smoother authentication experience, similar to built-in Windows apps.
0 commit comments