Skip to content

Commit

Permalink
Update default broker account sample (#35003)
Browse files Browse the repository at this point in the history
* Update default broker account sample

* Update variable name to match previous code sample
  • Loading branch information
scottaddie committed Mar 28, 2024
1 parent 4ed19c3 commit 4348985
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sdk/identity/azure-identity-broker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ Microsoft Entra applications rely on redirect URIs to determine where to send th
ms-appx-web://Microsoft.AAD.BrokerPlugin/{client_id}
```

## Use the default account for sign-in

When the `use_default_broker_account` argument is set to `True`, the credential will attempt to silently use the default broker account. If using the default account fails, the credential will fall back to interactive authentication.

```
cred = new InteractiveBrowserBrokerCredential(use_default_broker_account=True)
```

## Examples

### Authenticate with `InteractiveBrowserBrokerCredential`
Expand All @@ -64,6 +56,15 @@ credential = InteractiveBrowserBrokerCredential(parent_window_handle=current_win
client = BlobServiceClient(account_url, credential=credential)
```

To bypass the account selection dialog and use the account currently signed into the operating system, set the `use_default_broker_account` argument to `True`. The credential will attempt to silently use the default broker account. If using the default account fails, the credential will fall back to interactive authentication.

```python
credential = new InteractiveBrowserBrokerCredential(
parent_window_handle=current_window_handle,
use_default_broker_account=True
)
```

## Troubleshooting

See the Azure Identity [troubleshooting guide][troubleshooting_guide] for details on how to diagnose various failure scenarios.
Expand Down

0 comments on commit 4348985

Please sign in to comment.