From b54d530f18f20ccab6247bc307242e29df325ae2 Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Tue, 18 Jun 2024 16:05:13 -0500 Subject: [PATCH 1/5] Add exception information for all credential classes --- .../Credentials/AuthorizationCodeCredential.cs | 4 ++++ .../Credentials/AzureApplicationCredential.cs | 4 ++++ .../src/Credentials/AzureCliCredential.cs | 16 ++++++++++------ .../Credentials/AzureDeveloperCliCredential.cs | 16 ++++++++++------ .../Credentials/AzurePipelinesCredential.cs | 18 ++++++++++++++++-- .../Credentials/AzurePowerShellCredential.cs | 16 ++++++++++------ .../src/Credentials/ChainedTokenCredential.cs | 4 ++++ .../Credentials/ClientAssertionCredential.cs | 4 ++++ .../Credentials/ClientCertificateCredential.cs | 4 ++++ .../src/Credentials/ClientSecretCredential.cs | 4 ++++ .../src/Credentials/DefaultAzureCredential.cs | 2 ++ .../src/Credentials/DeviceCodeCredential.cs | 8 ++++++++ .../src/Credentials/EnvironmentCredential.cs | 4 ++++ .../InteractiveBrowserCredential.cs | 10 ++++++++++ .../Credentials/ManagedIdentityCredential.cs | 4 ++++ .../src/Credentials/OnBehalfOfCredential.cs | 4 ++++ .../Credentials/SharedTokenCacheCredential.cs | 4 ++++ .../Credentials/UsernamePasswordCredential.cs | 4 ++++ .../Credentials/VisualStudioCodeCredential.cs | 18 ++++++++++++++++-- .../src/Credentials/VisualStudioCredential.cs | 18 ++++++++++++++++-- .../Credentials/WorkloadIdentityCredential.cs | 18 ++++++++++++++++-- 21 files changed, 158 insertions(+), 26 deletions(-) diff --git a/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs index 27b18bf2c1abd..dc14f2bff539c 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs @@ -115,6 +115,8 @@ internal AuthorizationCodeCredential(string tenantId, string clientId, string cl /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -128,6 +130,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs index 9bfb87b39b97a..3c8854365a367 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs @@ -51,6 +51,8 @@ internal AzureApplicationCredential(AzureApplicationCredentialOptions options, E /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -62,6 +64,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs index 477958dbde6c1..29ae11461f52c 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs @@ -84,9 +84,11 @@ internal AzureCliCredential(CredentialPipeline pipeline, IProcessService process /// /// Obtains a access token from Azure CLI credential, using this access token to authenticate. This method called by Azure SDK clients. /// - /// - /// - /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -95,9 +97,11 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// /// Obtains a access token from Azure CLI service, using the access token to authenticate. This method id called by Azure SDK clients. /// - /// - /// - /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs index 2c80b4a121e29..15634b5cf3ca8 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs @@ -76,9 +76,11 @@ internal AzureDeveloperCliCredential(CredentialPipeline pipeline, IProcessServic /// /// Obtains an access token from Azure Developer CLI credential, using this access token to authenticate. This method called by Azure SDK clients. /// - /// - /// - /// AccessToken + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -87,9 +89,11 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// /// Obtains an access token from Azure Developer CLI service, using the access token to authenticate. This method is called by Azure SDK clients. /// - /// - /// - /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs index 36cf15fba5f4f..c423307545a64 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs @@ -67,11 +67,25 @@ public AzurePipelinesCredential(string tenantId, string clientId, string service AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants); } - /// + /// + /// Obtains an access token from within an Azure Pipelines environment. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenCoreAsync(false, requestContext, cancellationToken).EnsureCompleted(); - /// + /// + /// Obtains an access token from within an Azure Pipelines environment. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenCoreAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs index e9fb0041ae779..749eaa820c337 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs @@ -76,9 +76,11 @@ internal AzurePowerShellCredential(AzurePowerShellCredentialOptions options, Cre /// /// Obtains a access token from Azure PowerShell, using the access token to authenticate. This method id called by Azure SDK clients. /// - /// - /// - /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -87,9 +89,11 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// /// Obtains a access token from Azure PowerShell, using the access token to authenticate. This method id called by Azure SDK clients. /// - /// - /// - /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs index 9c9952ee56aa2..badfae8644baf 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs @@ -76,6 +76,8 @@ public ChainedTokenCredential(params TokenCredential[] sources) /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -87,6 +89,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs index 979f9737d2ca5..f560cfa60ba36 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs @@ -76,6 +76,8 @@ public ClientAssertionCredential(string tenantId, string clientId, Func /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = Pipeline.StartGetTokenScope("ClientAssertionCredential.GetToken", requestContext); @@ -100,6 +102,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public async override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = Pipeline.StartGetTokenScope("ClientAssertionCredential.GetToken", requestContext); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs index 294ea57676f83..6e7d84d83603a 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs @@ -180,6 +180,8 @@ internal ClientCertificateCredential( /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientCertificateCredential.GetToken", requestContext); @@ -205,6 +207,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientCertificateCredential.GetToken", requestContext); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs index 530099c75ab79..865d59faa32f4 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs @@ -109,6 +109,8 @@ internal ClientSecretCredential(string tenantId, string clientId, string clientS /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext); @@ -132,6 +134,8 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext); diff --git a/sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredential.cs index cfea7989d1b8a..5a30b98f63a4a 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredential.cs @@ -109,6 +109,7 @@ internal DefaultAzureCredential(DefaultAzureCredentialFactory factory) /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -127,6 +128,7 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. + /// Thrown when the authentication failed. public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs index 1f282f5f15cc7..2dacfbc9f8610 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs @@ -104,6 +104,7 @@ internal DeviceCodeCredential(Func devi /// /// A controlling the request lifetime. /// The result of the authentication request, containing the acquired , and the which can be used to silently authenticate the account. + /// Thrown when the authentication failed. public virtual AuthenticationRecord Authenticate(CancellationToken cancellationToken = default) { // throw if no default scope exists @@ -120,6 +121,7 @@ public virtual AuthenticationRecord Authenticate(CancellationToken cancellationT /// /// A controlling the request lifetime. /// The which can be used to silently authenticate the account on future execution of credentials using the same persisted token cache. + /// Thrown when the authentication failed. public virtual async Task AuthenticateAsync(CancellationToken cancellationToken = default) { // throw if no default scope exists @@ -137,6 +139,7 @@ public virtual async Task AuthenticateAsync(CancellationTo /// A controlling the request lifetime. /// The details of the authentication request. /// The of the authenticated account. + /// Thrown when the authentication failed. public virtual AuthenticationRecord Authenticate(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return AuthenticateImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -148,6 +151,7 @@ public virtual AuthenticationRecord Authenticate(TokenRequestContext requestCont /// A controlling the request lifetime. /// The details of the authentication request. /// The of the authenticated account. + /// Thrown when the authentication failed. public virtual async Task AuthenticateAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await AuthenticateImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); @@ -161,6 +165,8 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -174,6 +180,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs index 350e9be122a7a..be95044ed91e1 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs @@ -137,6 +137,8 @@ internal EnvironmentCredential(CredentialPipeline pipeline, TokenCredential cred /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or or the environment is not properly configured. public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -154,6 +156,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default . + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or or the environment is not properly configured. public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs index a8ca1101081e9..564b9f28dd3dd 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs @@ -167,6 +167,8 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { #if PREVIEW_FEATURE_FLAG @@ -184,6 +186,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { #if PREVIEW_FEATURE_FLAG @@ -202,6 +206,8 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public AccessToken GetToken(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -215,6 +221,8 @@ public AccessToken GetToken(PopTokenRequestContext requestContext, CancellationT /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public async ValueTask GetTokenAsync(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); @@ -226,6 +234,7 @@ public async ValueTask GetTokenAsync(PopTokenRequestContext request /// A controlling the request lifetime. /// The details of the authentication request. /// The of the authenticated account. + /// Thrown when the authentication failed. public virtual AuthenticationRecord Authenticate(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return AuthenticateImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -237,6 +246,7 @@ public virtual AuthenticationRecord Authenticate(PopTokenRequestContext requestC /// A controlling the request lifetime. /// The details of the authentication request. /// The of the authenticated account. + /// Thrown when the authentication failed. public virtual async Task AuthenticateAsync(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await AuthenticateImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs index c5665314c25d1..3c0ed611d8fc3 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs @@ -86,6 +86,8 @@ internal ManagedIdentityCredential(ManagedIdentityClient client) /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default if no managed identity is available. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); @@ -99,6 +101,8 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default if no managed identity is available. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs index 298835e1be301..6163667f42544 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs @@ -218,6 +218,8 @@ internal OnBehalfOfCredential( /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenInternalAsync(requestContext, false, cancellationToken).EnsureCompleted(); @@ -230,6 +232,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenInternalAsync(requestContext, true, cancellationToken); diff --git a/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs index 3af25a60b05ba..7e275639b8558 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs @@ -95,6 +95,8 @@ internal SharedTokenCacheCredential(string tenantId, string username, TokenCrede /// The details of the authentication request. /// A controlling the request lifetime /// An which can be used to authenticate service client calls + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -108,6 +110,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime /// An which can be used to authenticate service client calls + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs index 7d24abf6914fd..ddb295b57ed82 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs @@ -170,6 +170,8 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -184,6 +186,8 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// The details of the authentication request. /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs index 3a3275e704652..ecf504a19e34f 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs @@ -60,11 +60,25 @@ internal VisualStudioCodeCredential(VisualStudioCodeCredentialOptions options, C AdditionallyAllowedTenantIds = TenantIdResolver.ResolveAddionallyAllowedTenantIds((options as ISupportsAdditionallyAllowedTenants)?.AdditionallyAllowedTenants); } - /// + /// + /// Obtains a access token from account signed in to Visual Studio Code. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenImplAsync(requestContext, true, cancellationToken).ConfigureAwait(false); - /// + /// + /// Obtains a access token from account signed in to Visual Studio Code. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenImplAsync(requestContext, false, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs index 2293df746e54d..a122e6cac6cc5 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs @@ -65,11 +65,25 @@ internal VisualStudioCredential(string tenantId, CredentialPipeline pipeline, IF _isChainedCredential = options?.IsChainedCredential ?? false; } - /// + /// + /// Obtains a access token from account signed in to Visual Studio. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenImplAsync(requestContext, true, cancellationToken).ConfigureAwait(false); - /// + /// + /// Obtains a access token from account signed in to Visual Studio. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenImplAsync(requestContext, false, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs index db4bd85fa26ed..96028b5e6264f 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs @@ -52,13 +52,27 @@ public WorkloadIdentityCredential(WorkloadIdentityCredentialOptions options) _pipeline = _clientAssertionCredential?.Pipeline ?? CredentialPipeline.GetInstance(default); } - /// + /// + /// Obtains a access token for the specified set of scopes. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenCoreAsync(false, requestContext, cancellationToken).EnsureCompleted(); } - /// + /// + /// Obtains a access token for the specified set of scopes. + /// + /// The details of the authentication request. + /// A controlling the request lifetime. + /// An which can be used to authenticate service client calls. + /// Thrown when the authentication failed. + /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenCoreAsync(true, requestContext, cancellationToken).ConfigureAwait(false); From 20dcde6d655cacb6c6af1f4644e3f9fdcb320a16 Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Thu, 18 Jul 2024 17:20:28 -0500 Subject: [PATCH 2/5] feedback --- .../src/Credentials/AzurePipelinesCredential.cs | 4 ++-- .../Azure.Identity/src/Credentials/ChainedTokenCredential.cs | 2 -- .../src/Credentials/ClientAssertionCredential.cs | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs index c423307545a64..cdaa2e2294a21 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs @@ -74,7 +74,7 @@ public AzurePipelinesCredential(string tenantId, string clientId, string service /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . + /// Thrown when the credential is unavailable when used as part of a . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenCoreAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -85,7 +85,7 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . + /// Thrown when the credential is unavailable when used as part of a . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenCoreAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs index badfae8644baf..b20b595153548 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ChainedTokenCredential.cs @@ -77,7 +77,6 @@ public ChainedTokenCredential(params TokenCredential[] sources) /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -90,7 +89,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs index f560cfa60ba36..3bfd0960d7edf 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs @@ -103,7 +103,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public async override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = Pipeline.StartGetTokenScope("ClientAssertionCredential.GetToken", requestContext); From 3ea7f697109db27a5fe558c2269dc603f72df96d Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Thu, 18 Jul 2024 17:31:40 -0500 Subject: [PATCH 3/5] fb --- .../Azure.Identity/src/Credentials/ClientAssertionCredential.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs index 3bfd0960d7edf..f552f69a3b61a 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientAssertionCredential.cs @@ -77,7 +77,6 @@ public ClientAssertionCredential(string tenantId, string clientId, Func /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = Pipeline.StartGetTokenScope("ClientAssertionCredential.GetToken", requestContext); From 0f7322b0245b2a38f322b1f7b5e277bd1218ab7b Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Thu, 18 Jul 2024 17:40:22 -0500 Subject: [PATCH 4/5] cleanup CredentialUnavailableException docs for all creds other than chained creds --- .../src/Credentials/AuthorizationCodeCredential.cs | 2 -- .../src/Credentials/AzureApplicationCredential.cs | 2 -- .../Azure.Identity/src/Credentials/AzureCliCredential.cs | 2 -- .../src/Credentials/AzureDeveloperCliCredential.cs | 2 -- .../src/Credentials/AzurePipelinesCredential.cs | 2 -- .../src/Credentials/AzurePowerShellCredential.cs | 2 -- .../src/Credentials/ClientCertificateCredential.cs | 2 -- .../Azure.Identity/src/Credentials/ClientSecretCredential.cs | 2 -- .../Azure.Identity/src/Credentials/DeviceCodeCredential.cs | 2 -- .../Azure.Identity/src/Credentials/EnvironmentCredential.cs | 4 ++-- .../src/Credentials/InteractiveBrowserCredential.cs | 4 ---- .../src/Credentials/ManagedIdentityCredential.cs | 2 -- .../Azure.Identity/src/Credentials/OnBehalfOfCredential.cs | 2 -- .../src/Credentials/SharedTokenCacheCredential.cs | 2 -- .../src/Credentials/UsernamePasswordCredential.cs | 2 -- .../src/Credentials/VisualStudioCodeCredential.cs | 2 -- .../Azure.Identity/src/Credentials/VisualStudioCredential.cs | 2 -- .../src/Credentials/WorkloadIdentityCredential.cs | 2 -- 18 files changed, 2 insertions(+), 38 deletions(-) diff --git a/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs index dc14f2bff539c..8d12a0b9f7114 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AuthorizationCodeCredential.cs @@ -116,7 +116,6 @@ internal AuthorizationCodeCredential(string tenantId, string clientId, string cl /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -131,7 +130,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs index 3c8854365a367..4beab62212716 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureApplicationCredential.cs @@ -52,7 +52,6 @@ internal AzureApplicationCredential(AzureApplicationCredentialOptions options, E /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -65,7 +64,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// The first returned by the specified sources. Any credential which raises a will be skipped. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) => await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs index 29ae11461f52c..6ac687b003330 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureCliCredential.cs @@ -88,7 +88,6 @@ internal AzureCliCredential(CredentialPipeline pipeline, IProcessService process /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -101,7 +100,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs index 15634b5cf3ca8..c8bbb86b94487 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzureDeveloperCliCredential.cs @@ -80,7 +80,6 @@ internal AzureDeveloperCliCredential(CredentialPipeline pipeline, IProcessServic /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -93,7 +92,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs index cdaa2e2294a21..1425f14a94fe8 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzurePipelinesCredential.cs @@ -74,7 +74,6 @@ public AzurePipelinesCredential(string tenantId, string clientId, string service /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenCoreAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -85,7 +84,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenCoreAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs index 749eaa820c337..4528f541feff3 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/AzurePowerShellCredential.cs @@ -80,7 +80,6 @@ internal AzurePowerShellCredential(AzurePowerShellCredentialOptions options, Cre /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -93,7 +92,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs index 6e7d84d83603a..bba259f194ba4 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientCertificateCredential.cs @@ -181,7 +181,6 @@ internal ClientCertificateCredential( /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientCertificateCredential.GetToken", requestContext); @@ -208,7 +207,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientCertificateCredential.GetToken", requestContext); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs index 865d59faa32f4..4e308905a064d 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ClientSecretCredential.cs @@ -110,7 +110,6 @@ internal ClientSecretCredential(string tenantId, string clientId, string clientS /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext); @@ -135,7 +134,6 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { using CredentialDiagnosticScope scope = _pipeline.StartGetTokenScope("ClientSecretCredential.GetToken", requestContext); diff --git a/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs index 2dacfbc9f8610..2203ccedd83c5 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/DeviceCodeCredential.cs @@ -166,7 +166,6 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -181,7 +180,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs index be95044ed91e1..af19888ef2531 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs @@ -138,7 +138,7 @@ internal EnvironmentCredential(CredentialPipeline pipeline, TokenCredential cred /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or or the environment is not properly configured. + /// Thrown when the credential is unavailable when the environment is not properly configured. public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -157,7 +157,7 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default . /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or or the environment is not properly configured. + /// Thrown when the credential is unavailable when the environment is not properly configured. public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs index 564b9f28dd3dd..8101b15c75a64 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/InteractiveBrowserCredential.cs @@ -168,7 +168,6 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { #if PREVIEW_FEATURE_FLAG @@ -187,7 +186,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { #if PREVIEW_FEATURE_FLAG @@ -207,7 +205,6 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public AccessToken GetToken(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -222,7 +219,6 @@ public AccessToken GetToken(PopTokenRequestContext requestContext, CancellationT /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public async ValueTask GetTokenAsync(PopTokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs index 3c0ed611d8fc3..ebc4e80dfaa34 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/ManagedIdentityCredential.cs @@ -87,7 +87,6 @@ internal ManagedIdentityCredential(ManagedIdentityClient client) /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default if no managed identity is available. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); @@ -102,7 +101,6 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default if no managed identity is available. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs index 6163667f42544..5f3ff5c026fa4 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/OnBehalfOfCredential.cs @@ -219,7 +219,6 @@ internal OnBehalfOfCredential( /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenInternalAsync(requestContext, false, cancellationToken).EnsureCompleted(); @@ -233,7 +232,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenInternalAsync(requestContext, true, cancellationToken); diff --git a/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs index 7e275639b8558..b20e1556b45f6 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/SharedTokenCacheCredential.cs @@ -96,7 +96,6 @@ internal SharedTokenCacheCredential(string tenantId, string username, TokenCrede /// A controlling the request lifetime /// An which can be used to authenticate service client calls /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -111,7 +110,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime /// An which can be used to authenticate service client calls /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs index ddb295b57ed82..f2c5e5311868f 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/UsernamePasswordCredential.cs @@ -171,7 +171,6 @@ public virtual async Task AuthenticateAsync(TokenRequestCo /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -187,7 +186,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false); diff --git a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs index ecf504a19e34f..c3755995a5822 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCodeCredential.cs @@ -67,7 +67,6 @@ internal VisualStudioCodeCredential(VisualStudioCodeCredentialOptions options, C /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenImplAsync(requestContext, true, cancellationToken).ConfigureAwait(false); @@ -78,7 +77,6 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenImplAsync(requestContext, false, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs index a122e6cac6cc5..e72a2daa0c4f1 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/VisualStudioCredential.cs @@ -72,7 +72,6 @@ internal VisualStudioCredential(string tenantId, CredentialPipeline pipeline, IF /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) => await GetTokenImplAsync(requestContext, true, cancellationToken).ConfigureAwait(false); @@ -83,7 +82,6 @@ public override async ValueTask GetTokenAsync(TokenRequestContext r /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) => GetTokenImplAsync(requestContext, false, cancellationToken).EnsureCompleted(); diff --git a/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs index 96028b5e6264f..d1ccf215e2c53 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/WorkloadIdentityCredential.cs @@ -59,7 +59,6 @@ public WorkloadIdentityCredential(WorkloadIdentityCredentialOptions options) /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenCoreAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -72,7 +71,6 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when used as part of a chained credential such as or . public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenCoreAsync(true, requestContext, cancellationToken).ConfigureAwait(false); From 7c1f85f4f434749f7fb91dd81ed090368699aa6b Mon Sep 17 00:00:00 2001 From: Christopher Scott Date: Thu, 18 Jul 2024 17:49:46 -0500 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> --- .../Azure.Identity/src/Credentials/EnvironmentCredential.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs index af19888ef2531..64a408fd0fc8c 100644 --- a/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs +++ b/sdk/identity/Azure.Identity/src/Credentials/EnvironmentCredential.cs @@ -138,7 +138,7 @@ internal EnvironmentCredential(CredentialPipeline pipeline, TokenCredential cred /// A controlling the request lifetime. /// An which can be used to authenticate service client calls. /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when the environment is not properly configured. + /// Thrown when the credential is unavailable because the environment is not properly configured. public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return GetTokenImplAsync(false, requestContext, cancellationToken).EnsureCompleted(); @@ -157,7 +157,7 @@ public override AccessToken GetToken(TokenRequestContext requestContext, Cancell /// A controlling the request lifetime. /// An which can be used to authenticate service client calls, or a default . /// Thrown when the authentication failed. - /// Thrown when the credential is unavailable when the environment is not properly configured. + /// Thrown when the credential is unavailable because the environment is not properly configured. public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken = default) { return await GetTokenImplAsync(true, requestContext, cancellationToken).ConfigureAwait(false);