Skip to content

Extracted broker auth into new doc #48046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

alexwolfmsft
Copy link
Contributor

@alexwolfmsft alexwolfmsft commented Aug 20, 2025

@alexwolfmsft alexwolfmsft reopened this Aug 20, 2025
@alexwolfmsft alexwolfmsft marked this pull request as ready for review August 20, 2025 19:14
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>

Consider the following sample code from a Windows Forms app that passes the credential to an instance of [BlobServiceClient](/dotnet/api/azure.storage.blobs.blobserviceclient):

:::code language="csharp" source="../snippets/authentication/additional-auth/interactive/InteractiveBrokeredAuth.cs" highlight="16-20":::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder names mentioned in the code comment here need to be updated.

Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com>
Brokered authentication collects user credentials using the system authentication broker to authenticate an application 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.

> [!NOTE]
> Currently, only the Windows authentication broker, Web Account Manager (WAM), is supported. Users on macOS and Linux will be authenticated through the [non-brokered interactive browser flow](additional-methods.md#interactive-browser-authentication).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the context for this statement? We do support Mac and Linux for brokered authentication currently - see the changelog here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this note could be improved by mentioning that Windows is supported natively with WAM, while MacOS and Linux require to install other tools like MS Intune.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the note. In step 1 of the "Implement the code" section, we should add a note saying that macOS and Linux support exists in Azure.Identity.Broker versions 1.3.0 and later.

1. In **Custom redirect URIs**, enter the following WAM redirect URI:

```text
ms-appx-web://Microsoft.AAD.BrokerPlugin/{client_id}
Copy link
Member

@scottaddie scottaddie Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This redirect URI differs by OS: https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/identity/Azure.Identity.Broker#redirect-uris. When you add the OS zone pivot, no need to list WSL. That detail should appear when Linux is selected. Linux broker prereqs are listed at https://learn.microsoft.com/en-us/entra/msal/dotnet/acquiring-tokens/desktop-mobile/linux-dotnet-sdk.

Brokered authentication collects user credentials using the system authentication broker to authenticate an application 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.

> [!NOTE]
> Currently, only the Windows authentication broker, Web Account Manager (WAM), is supported. Users on macOS and Linux will be authenticated through the [non-brokered interactive browser flow](additional-methods.md#interactive-browser-authentication).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the note. In step 1 of the "Implement the code" section, we should add a note saying that macOS and Linux support exists in Azure.Identity.Broker versions 1.3.0 and later.

> [!NOTE]
> For more information about retrieving window handles, see [Parent window handles](/entra/msal/dotnet/acquiring-tokens/desktop-mobile/wam#parent-window-handles) and [Retrieve a window handle](/windows/apps/develop/ui-input/retrieve-hwnd).

For the code to run successfully, your user account must be assigned an Azure RBAC role on the storage account that allows access to blob containers, such as **Storage Account Data Contributor**. 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.
Copy link
Member

@scottaddie scottaddie Aug 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you decide to stick with Key Vault Secrets in the apps I sent, your user account must be assigned an Azure RBAC role on the Key Vault resource that permits it to read secrets, such as Key Vault Secrets User. To create the secret, role Key Vault Secrets Officer is needed.

I also wonder if this content should move to an "Assign roles" section. After all, it's not something you do in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants