Skip to content

Commit a6785d6

Browse files
authored
[Identity] Consistency review (Azure#49889)
* Reference docs * Marking obsolete Username and Password option in EnvironmentCredentials and EnvVars * Update samples and troubleshooting * Update changelog * ExportAPI * Remove obsolete attribute for internal members * Export API * Remove unused imports and pragma warning disables * Remove false statement in changelog
1 parent 7863871 commit a6785d6

File tree

6 files changed

+9
-22
lines changed

6 files changed

+9
-22
lines changed

sdk/identity/Azure.Identity/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
### Other Changes
1212

13+
- Removed references to `Username`, `Password`, `AZURE_USERNAME`, and `AZURE_PASSWORD` in XML comments from `EnvironmentCredentialOptions` and `EnvironmentCredential` due to lack of MFA support. See [MFA enforcement details](https://aka.ms/azsdk/identity/mfa).
14+
- Marked `AZURE_USERNAME` and `AZURE_PASSWORD` as obsolete due to lack of MFA support. See [MFA enforcement details](https://aka.ms/azsdk/identity/mfa).
15+
1316
## 1.14.0-beta.4 (2025-05-01)
1417

1518
### Bugs Fixed

sdk/identity/Azure.Identity/TROUBLESHOOTING.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ This troubleshooting guide covers failure investigation techniques, common error
1515
- [Troubleshoot ClientSecretCredential authentication issues](#troubleshoot-clientsecretcredential-authentication-issues)
1616
- [Troubleshoot ClientCertificateCredential authentication issues](#troubleshoot-clientcertificatecredential-authentication-issues)
1717
- [Troubleshoot ClientAssertionCredential authentication issues](#troubleshoot-clientassertioncredential-authentication-issues)
18-
- [Troubleshoot UsernamePasswordCredential authentication issues](#troubleshoot-usernamepasswordcredential-authentication-issues)
1918
- [Troubleshoot WorkloadIdentityCredential authentication issues](#troubleshoot-workloadidentitycredential-authentication-issues)
2019
- [Troubleshoot ManagedIdentityCredential authentication issues](#troubleshoot-managedidentitycredential-authentication-issues)
2120
- [Azure Virtual Machine managed identity](#azure-virtual-machine-managed-identity)
@@ -165,15 +164,6 @@ DefaultAzureCredentialOptions options = new
165164
|AADSTS700023| Client assertion audience claim doesn't match Realm issuer. Review the documentation at [Microsoft Identity platform application authentication certificate credentials](https://learn.microsoft.com/entra/identity-platform/certificate-credentials). | Ensure the audience `aud` field in the JWT assertion created has the correct value for the audience specified in the payload. This should be set to `https://login.microsoftonline.com/{tenantId}/v2`.|
166165
|AADSTS50027| JWT token is invalid or malformed. | Ensure the JWT assertion token is in the valid format. Refer to the documentation for [client assertion format](https://learn.microsoft.com/entra/identity-platform/certificate-credentials).|
167166

168-
## Troubleshoot `UsernamePasswordCredential` authentication issues
169-
170-
`AuthenticationFailedException`
171-
172-
| Error Code | Issue | Mitigation |
173-
|---|---|---|
174-
|AADSTS50076|Multifactor authentication (MFA) is enabled on your Entra tenant, and the username + password flow is incompatible with MFA.|Use a different credential, per the guidance at [Planning for mandatory MFA: Client libraries](https://aka.ms/azsdk/identity/mfa).|
175-
|AADSTS50126|The provided username or password is invalid|Ensure the `username` and `password` provided when constructing the credential are valid.|
176-
177167
## Troubleshoot `WorkloadIdentityCredential` authentication issues
178168

179169
`CredentialUnavailableException`

sdk/identity/Azure.Identity/samples/TokenCache.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ If `UnsafeAllowUnencryptedStorage` is `false` (the default), a `CredentialUnavai
8787

8888
### Silently authenticate a user with AuthenticationRecord and TokenCachePersistenceOptions
8989

90-
When authenticating a user via `InteractiveBrowserCredential`, `DeviceCodeCredential`, or `UsernamePasswordCredential`, an [AuthenticationRecord](https://learn.microsoft.com/dotnet/api/azure.identity.authenticationrecord?view=azure-dotnet) can be persisted as well. The authentication record is:
90+
When authenticating a user via `InteractiveBrowserCredential`, or `DeviceCodeCredential`, an [AuthenticationRecord](https://learn.microsoft.com/dotnet/api/azure.identity.authenticationrecord?view=azure-dotnet) can be persisted as well. The authentication record is:
9191

9292
- Returned from the `Authenticate` API and contains data identifying an authenticated account.
9393
- Needed to identify the appropriate entry in the persisted token cache to silently authenticate on subsequent executions.
@@ -151,6 +151,5 @@ The following table indicates the state of in-memory and persistent caching in e
151151
| `InteractiveBrowserCredential` | Supported | Supported |
152152
| `ManagedIdentityCredential` | Supported | Not Supported |
153153
| `OnBehalfOfCredential` | Supported | Supported |
154-
| `UsernamePasswordCredential` | Supported | Supported |
155154
| `VisualStudioCredential` | Supported | Not Supported |
156155
| `WorkloadIdentityCredential` | Supported | Supported |

sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.ComponentModel;
77
using System.Diagnostics.CodeAnalysis;
8-
using System.Net;
98
using Azure.Core;
109

1110
namespace Azure.Identity

sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
namespace Azure.Identity
1212
{
1313
/// <summary>
14-
/// Enables authentication to Microsoft Entra ID using a client secret or certificate, or as a user
15-
/// with a username and password.
14+
/// Enables authentication to Microsoft Entra ID using a client secret or certificate.
1615
/// <para>
1716
/// Configuration is attempted in this order, using these environment variables:
1817
/// </para>
@@ -40,13 +39,11 @@ namespace Azure.Identity
4039
/// <listheader><term>Variable</term><description>Description</description></listheader>
4140
/// <item><term>AZURE_TENANT_ID</term><description>The Microsoft Entra tenant (directory) ID.</description></item>
4241
/// <item><term>AZURE_CLIENT_ID</term><description>The client (application) ID of an App Registration in the tenant.</description></item>
43-
/// <item><term>AZURE_USERNAME</term><description>The username, also known as upn, of a Microsoft Entra user account.</description></item>
44-
/// <item><term>AZURE_PASSWORD</term><description>The password of the Microsoft Entra user account. Note this does not support accounts with MFA enabled.</description></item>
4542
/// </list>
4643
///
47-
/// This credential ultimately uses a <see cref="ClientSecretCredential"/>, <see cref="ClientCertificateCredential"/>, or <see cref="UsernamePasswordCredential"/> to
44+
/// This credential ultimately uses a <see cref="ClientSecretCredential"/> or <see cref="ClientCertificateCredential"/> to
4845
/// perform the authentication using these details. Please consult the
49-
/// documentation of that class for more details.
46+
/// documentation of those classes for more details.
5047
/// </summary>
5148
public class EnvironmentCredential : TokenCredential
5249
{
@@ -129,7 +126,7 @@ internal EnvironmentCredential(CredentialPipeline pipeline, TokenCredential cred
129126

130127
/// <summary>
131128
/// Obtains a token from Microsoft Entra ID, using the client details specified in the environment variables
132-
/// AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET or AZURE_USERNAME and AZURE_PASSWORD to authenticate.
129+
/// AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET to authenticate.
133130
/// Acquired tokens are <see href="https://aka.ms/azsdk/net/identity/token-cache">cached</see> by the credential
134131
/// instance. Token lifetime and refreshing is handled automatically. Where possible, <see href="https://aka.ms/azsdk/net/identity/credential-reuse">reuse credential instances</see>
135132
/// to optimize cache effectiveness.
@@ -149,7 +146,7 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell
149146

150147
/// <summary>
151148
/// Obtains a token from Microsoft Entra ID, using the client details specified in the environment variables
152-
/// AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET or AZURE_USERNAME and AZURE_PASSWORD to authenticate.
149+
/// AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET to authenticate.
153150
/// Acquired tokens are <see href="https://aka.ms/azsdk/net/identity/token-cache">cached</see> by the credential
154151
/// instance. Token lifetime and refreshing is handled automatically. Where possible, <see href="https://aka.ms/azsdk/net/identity/credential-reuse">reuse credential instances</see>
155152
/// to optimize cache effectiveness.

sdk/identity/Azure.Identity/src/EnvironmentVariables.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Linq;
7-
using System.Net.Http.Headers;
87

98
namespace Azure.Identity
109
{

0 commit comments

Comments
 (0)