Skip to content

Commit ff3841a

Browse files
committed
tweaks
1 parent d5fef2f commit ff3841a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/azure/sdk/authentication/authentication-best-practices.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This article offers guidelines to help you maximize the performance and reliabil
1515

1616
## Reuse credential instances
1717

18-
To improve app resilience, reuse credential instances when possible to reduce the number of access token requests issued to Microsoft Entra ID. When a credential is reused, an attempt is made to fetch a token from the app token cache managed by the underlying MSAL dependency. For more information, see [Token caching in the Azure Identity client library](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/samples/TokenCache.md).
18+
Reuse credential instances when possible to improve app resilience and reduce the number of access token requests issued to Microsoft Entra ID. When a credential is reused, an attempt is made to fetch a token from the app token cache managed by the underlying MSAL dependency. For more information, see [Token caching in the Azure Identity client library](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/samples/TokenCache.md).
1919

2020
> [!NOTE]
2121
> A high-volume app that doesn't reuse credentials may encounter HTTP 429 throttling responses from Microsoft Entra ID, which can lead to app outages.
@@ -35,7 +35,7 @@ Other types of .NET apps can reuse credential instances as follows:
3535
The Azure Identity library for .NET allows you to authenticate via managed identity with `ManagedIdentityCredential`. The way you use `ManagedIdentityCredential` impacts the applied retry strategy:
3636

3737
- When used via `DefaultAzureCredential`:
38-
- No retries are attempted when token acquisition fails.
38+
- No retries are attempted when token acquisition fails, which makes this the least resilient option.
3939
- When used via any other approach, such as `ChainedTokenCredential` or `ManagedIdentityCredential` directly:
4040
- The time interval between retries starts at 0.8 seconds, and a maximum of five retries are attempted.
4141
- If the Azure service to which you're authenticating provides a `Retry-After` response header, the next retry is delayed by the duration specified in that header's value.

docs/azure/sdk/includes/default-azure-credential-usage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ For example, consider the following hypothetical sequence of events:
66
1. An organization's security team mandates all apps use managed identity to authenticate to Azure resources.
77
1. For months, a .NET app hosted on an Azure Virtual Machine (VM) successfully uses `DefaultAzureCredential` to authenticate via managed identity.
88
1. Without telling the support team, a developer installs the Azure CLI on that VM and runs the `az login` command to sign-in to Azure.
9-
1. Due to a separate configuration change in the Azure environment, Authentication via the original managed identity unexpectedly begins to fail.
9+
1. Due to a separate configuration change in the Azure environment, authentication via the original managed identity unexpectedly begins to fail silently.
1010
1. `DefaultAzureCredential` skips the failed `ManagedIdentityCredential` and searches for the next available credential, which is the Azure CLI credentials.
11-
1. Because logging is disabled by default, the team is unaware of this silent authentication failure.
11+
1. The team is unaware of the hidden authentication failure because logging is disabled by default.
1212

1313
`DefaultAzureCredential` also introduces the following challenges in some scenarios:
1414

15-
- **Debugging challenges**: When authentication fails, it can be difficult to debug and identify the offending credential. You must enable logging to see the progression from one credential to the next and the success or failure status of each. For more information, see [Debug a chained credential](/dotnet/azure/sdk/authentication/credential-chains?tabs=dac#debug-a-chained-credential).
16-
- **Performance overhead**: Sequentially attempting multiple credentials can introduce performance overhead. For example, on a local development machine, managed identity is unavailable. Consequently, `ManagedIdentityCredential` always fails locally, unless explicitly disabled via its corresponding `Exclude`-prefixed property.
15+
- **Debugging challenges**: When authentication fails, it can be difficult to identify and [debug the offending credential](/dotnet/azure/sdk/authentication/credential-chains?tabs=dac#debug-a-chained-credential). Enable logging to see the sequential progression and success or failure status of each credential.
16+
- **Performance overhead**: Sequential credential attempts can introduce performance overhead. For example, managed identity is unavailable on a local development machine. Consequently, `ManagedIdentityCredential` always fails locally, unless explicitly disabled via its corresponding `Exclude`-prefixed property.
1717

1818
To prevent these types of subtle issues or silent failures in production apps, strongly consider moving from `DefaultAzureCredential` to one of the following deterministic solutions:
1919

0 commit comments

Comments
 (0)