Skip to content

Commit 3774094

Browse files
authored
Update DefaultAzureCredential, InteractiveBrowserCredential, and DeviceCodeCredential docs (#45009)
1 parent f77b824 commit 3774094

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

sdk/identity/Azure.Identity/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ See [Credential Classes](#credential-classes) for a complete listing of availabl
7777

7878
### DefaultAzureCredential
7979

80-
The `DefaultAzureCredential` is appropriate for most scenarios where the application is intended to ultimately be run in Azure. This is because the `DefaultAzureCredential` combines credentials commonly used to authenticate when deployed, with credentials used to authenticate in a development environment.
81-
82-
> Note: `DefaultAzureCredential` is intended to simplify getting started with the SDK by handling common scenarios with reasonable default behaviors. Developers who want more control or whose scenario isn't served by the default settings should use other credential types.
83-
84-
The `DefaultAzureCredential` attempts to authenticate via the following mechanisms, in this order, stopping when one succeeds:
80+
The `DefaultAzureCredential` simplifies authentication while developing applications that deploy to Azure by combining credentials used in Azure hosting environments and credentials used in local development. In production, it's better to use a specific credential type so authentication is more predictable and easier to debug. `DefaultAzureCredential` attempts to authenticate via the following mechanisms in this order, stopping when one succeeds:
8581

8682
![DefaultAzureCredential authentication flow][default_azure_credential_authflow_image]
8783

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@
1212
namespace Azure.Identity
1313
{
1414
/// <summary>
15-
/// Provides a default <see cref="TokenCredential"/> authentication flow for applications that will be deployed to Azure. The following credential
16-
/// types, if enabled, will be tried, in order:
15+
/// <see cref="DefaultAzureCredential"/> simplifies authentication while developing applications that deploy to Azure by
16+
/// combining credentials used in Azure hosting environments and credentials used in local development. In
17+
/// production, it's better to use a specific credential type so authentication is more predictable and easier
18+
/// to debug.
19+
///
20+
/// <see cref="DefaultAzureCredential"/> attempts to authenticate with each of these credential types, in the following order,
21+
/// stopping when one provides a token:
1722
/// <list type="bullet">
1823
/// <item><description><see cref="EnvironmentCredential"/></description></item>
1924
/// <item><description><see cref="WorkloadIdentityCredential"/></description></item>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public DeviceCodeCredential(DeviceCodeCredentialOptions options)
5252
/// Creates a new DeviceCodeCredential with the specified options, which will authenticate users with the specified application.
5353
/// </summary>
5454
/// <param name="deviceCodeCallback">The callback to be executed to display the device code to the user</param>
55-
/// <param name="clientId">The client id of the application to which the users will authenticate</param>
55+
/// <param name="clientId">The client ID of the application to which the users will authenticate. It's recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>. If not specified, users will authenticate to an Azure development application, which isn't recommended for production scenarios.</param>
5656
/// <param name="options">The client options for the newly created DeviceCodeCredential</param>
5757
[EditorBrowsable(EditorBrowsableState.Never)]
5858
public DeviceCodeCredential(Func<DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string clientId, TokenCredentialOptions options = default)
@@ -65,7 +65,7 @@ public DeviceCodeCredential(Func<DeviceCodeInfo, CancellationToken, Task> device
6565
/// </summary>
6666
/// <param name="deviceCodeCallback">The callback to be executed to display the device code to the user</param>
6767
/// <param name="tenantId">The tenant id of the application to which users will authenticate. This can be null for multi-tenanted applications.</param>
68-
/// <param name="clientId">The client id of the application to which the users will authenticate</param>
68+
/// <param name="clientId">The client id of the application to which the users will authenticate. It is recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>. If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.</param>
6969
/// <param name="options">The client options for the newly created DeviceCodeCredential</param>
7070
[EditorBrowsable(EditorBrowsableState.Never)]
7171
public DeviceCodeCredential(Func<DeviceCodeInfo, CancellationToken, Task> deviceCodeCallback, string tenantId, string clientId, TokenCredentialOptions options = default)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public string TenantId
3939

4040
/// <summary>
4141
/// The client ID of the application used to authenticate the user. If not specified the user will be authenticated with an Azure development application.
42+
/// It is recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>.
43+
/// If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.
4244
/// </summary>
4345
public string ClientId { get; set; } = Constants.DeveloperSignOnClientId;
4446

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public InteractiveBrowserCredential(InteractiveBrowserCredentialOptions options)
5757
/// <summary>
5858
/// Creates a new <see cref="InteractiveBrowserCredential"/> with the specified options, which will authenticate users with the specified application.
5959
/// </summary>
60-
/// <param name="clientId">The client id of the application to which the users will authenticate</param>
60+
/// <param name="clientId">The client id of the application to which the users will authenticate. It is recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>. If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.</param>
6161
[EditorBrowsable(EditorBrowsableState.Never)]
6262
public InteractiveBrowserCredential(string clientId)
6363
: this(null, clientId, null, null)
@@ -67,7 +67,7 @@ public InteractiveBrowserCredential(string clientId)
6767
/// Creates a new <see cref="InteractiveBrowserCredential"/> with the specified options, which will authenticate users with the specified application.
6868
/// </summary>
6969
/// <param name="tenantId">The tenant id of the application and the users to authenticate. Can be null in the case of multi-tenant applications.</param>
70-
/// <param name="clientId">The client id of the application to which the users will authenticate</param>
70+
/// <param name="clientId">The client id of the application to which the users will authenticate. It is recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>. If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.</param>
7171
/// TODO: need to link to info on how the application has to be created to authenticate users, for multiple applications
7272
/// <param name="options">The client options for the newly created <see cref="InteractiveBrowserCredential"/>.</param>
7373
[EditorBrowsable(EditorBrowsableState.Never)]

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public string TenantId
3838
public IList<string> AdditionallyAllowedTenants { get; internal set; } = new List<string>();
3939

4040
/// <summary>
41-
/// The client ID of the application used to authenticate the user. If not specified the user will be authenticated with an Azure development application.
41+
/// The client ID of the application used to authenticate the user. It is recommended that developers register their applications and assign appropriate roles. For more information, visit <see href="https://aka.ms/azsdk/identity/AppRegistrationAndRoleAssignment"/>.
42+
/// If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.
4243
/// </summary>
4344
public string ClientId { get; set; } = Constants.DeveloperSignOnClientId;
4445

0 commit comments

Comments
 (0)