Skip to content

Commit 6676777

Browse files
schaabspvaneckscottaddiechristothes
authored
Updating Identity for 1.8.0 release (Azure#32353)
* [Identity] Update documentation (Azure#31867) This updates the README and TROUBLESHOOTING files for greater consistency with other language docs and for general enhancement. Code snippets were added for the README. Ref: Azure#31064 Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com> Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> * fix error messages with AADSTS and az login (Azure#31949) * fix error messages with AADSTS and az login * Update SharedTokenCacheCredential XML class documentation (Azure#32195) * [Identity] Class documentation improvements (Azure#32043) This adds additional details to the docstrings for some of the credential classes. Users may find the added info helpful. Also added missing envvar in README. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com> * Update Azure.Identity changelog (Azure#32216) * Handle Managed Identity json parse errors as CredentialUnAvailableException (Azure#32272) * handle json parse errors as CredentialNotAvailable * update changelog for 1.8.0 release * update csproj version Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com> Co-authored-by: Paul Van Eck <paulvaneck@microsoft.com> Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: Christopher Scott <chriss@microsoft.com>
1 parent 32d3253 commit 6676777

13 files changed

+304
-178
lines changed

sdk/identity/Azure.Identity/CHANGELOG.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
# Release History
22

3-
## 1.8.0-beta.2 (Unreleased)
3+
## 1.8.0 (2022-11-08)
44

5-
### Features Added
5+
### Bugs Fixed
6+
- Fixed error message parsing in `AzureCliCredential` which would misinterpret AAD errors with the need to login with `az login`. [#26894](https://github.com/Azure/azure-sdk-for-net/issues/26894), [#29109](https://github.com/Azure/azure-sdk-for-net/issues/29109)
7+
- `ManagedIdentityCredential` will no longer fail when a response received from the endpoint is invalid JSON. It now treats this scenario as if the credential is unavailable. [#30467](https://github.com/Azure/azure-sdk-for-net/issues/30467), [#32061](https://github.com/Azure/azure-sdk-for-net/issues/32061)
68

7-
### Breaking Changes
9+
## 1.9.0-beta.1 (2022-10-13)
810

9-
### Bugs Fixed
11+
### Features Added
12+
- Credentials that are implemented via launching a sub-process to acquire tokens now have configurable timeouts. This addresses scenarios where these proceses can take longer than the current default timeout values. (A community contribution, courtesy of _[reynaldoburgos](https://github.com/reynaldoburgos)_). The affected credentials and their associated options are:
13+
- `AzureCliCredential` and `AzureCliCredentialOptions.CliProcessTimeout`
14+
- `AzurePowerShellCredential` and `AzurePowerShellCredentialOptions.PowerShellProcessTimeout`
15+
- `VisualStudioCredential` and `VisualStudioCredentialOptions.VisualStudioProcessTimeout`
16+
- `DefaultAzureCredential` and `DefaultAzureCredentialOptions.DeveloperCredentialTimeout` Note: this option applies to all developer credentials above when using `DefaultAzureCredential`.
1017

11-
### Other Changes
18+
### Acknowledgments
19+
Thank you to our developer community members who helped to make Azure Identity better with their contributions to this release:
20+
21+
- _[reynaldoburgos](https://github.com/reynaldoburgos)_
1222

1323
## 1.8.0-beta.1 (2022-10-13)
1424

@@ -104,7 +114,7 @@ Thank you to our developer community members who helped to make Azure Identity b
104114
### Breaking Changes from 1.5.0-beta.4
105115
- The `AllowMultiTenantAuthentication` option has been removed and the default behavior is now as if it were true. The multi-tenant discovery feature can be totally disabled by either setting an `AppContext` switch named "Azure.Identity.DisableTenantDiscovery" to `true` or by setting the environment variable "AZURE_IDENTITY_DISABLE_MULTITENANTAUTH" to "true".
106116
- Removed the `IsPIILoggingEnabled` property from `TokenCredentialOptions`, similar functionality is planned to be added to `TokenCredentialOptions.Diagnostics` in a later release.
107-
- Removed `RegionalAuthority` from `ClientCertificateCredentialOptions` and `ClientSecretCredentialOptions`, along with the `RegionalAuthority` type. This feature will stay in preview, and these APIs will be added back in `1.6.0-beta.1`.
117+
- Removed `RegionalAuthority` from `ClientCertificateCredentialOptions` and `ClientSecretCredentialOptions`, along with the `RegionalAuthority` type.
108118
- Renamed struct `TokenCacheDetails` to `TokenCacheData`.
109119
- Renamed class `TokenCacheNotificationDetails` to `TokenCacheRefreshArgs`.
110120
- Updated `CacheBytes` property on `TokenCacheData` to be readonly and a required constructor parameter.

sdk/identity/Azure.Identity/README.md

Lines changed: 119 additions & 88 deletions
Large diffs are not rendered by default.

sdk/identity/Azure.Identity/TROUBLESHOOTING.md

Lines changed: 82 additions & 68 deletions
Large diffs are not rendered by default.

sdk/identity/Azure.Identity/src/Azure.Identity.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<Description>This is the implementation of the Azure SDK Client Library for Azure Identity</Description>
44
<AssemblyTitle>Microsoft Azure.Identity Component</AssemblyTitle>
5-
<Version>1.8.0-beta.2</Version>
5+
<Version>1.8.0</Version>
66
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
77
<ApiCompatVersion>1.7.0</ApiCompatVersion>
88
<PackageTags>Microsoft Azure Identity;$(PackageCommonTags)</PackageTags>

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
using System.Globalization;
77
using System.IO;
88
using System.Runtime.InteropServices;
9-
using System.Threading;
10-
using System.Threading.Tasks;
119
using System.Text.Json;
1210
using System.Text.RegularExpressions;
11+
using System.Threading;
12+
using System.Threading.Tasks;
1313
using Azure.Core;
1414
using Azure.Core.Pipeline;
1515
using Azure.Identitiy;
@@ -29,7 +29,7 @@ public class AzureCliCredential : TokenCredential
2929
internal const string Troubleshoot = "See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/azclicredential/troubleshoot";
3030
internal const string InteractiveLoginRequired = "Azure CLI could not login. Interactive login is required.";
3131
internal const string CLIInternalError = "CLIInternalError: The command failed with an unexpected error. Here is the traceback:";
32-
internal TimeSpan CliProcessTimeout { get; private set;}
32+
internal TimeSpan CliProcessTimeout { get; private set; }
3333

3434
// The default install paths are used to find Azure CLI if no path is specified. This is to prevent executing out of the current working directory.
3535
private static readonly string DefaultPathWindows = $"{EnvironmentVariables.ProgramFilesX86}\\Microsoft SDKs\\Azure\\CLI2\\wbin;{EnvironmentVariables.ProgramFiles}\\Microsoft SDKs\\Azure\\CLI2\\wbin";
@@ -146,10 +146,11 @@ private async ValueTask<AccessToken> RequestCliAccessTokenAsync(bool async, Toke
146146
throw new CredentialUnavailableException(AzureCLINotInstalled);
147147
}
148148

149+
bool isAADSTSError = exception.Message.Contains("AADSTS");
149150
bool isLoginError = exception.Message.IndexOf("az login", StringComparison.OrdinalIgnoreCase) != -1 ||
150151
exception.Message.IndexOf("az account set", StringComparison.OrdinalIgnoreCase) != -1;
151152

152-
if (isLoginError)
153+
if (isLoginError && !isAADSTSError)
153154
{
154155
throw new CredentialUnavailableException(AzNotLogIn);
155156
}

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,39 @@
1313
namespace Azure.Identity
1414
{
1515
/// <summary>
16-
/// Enables authentication to Azure Active Directory using client secret, or username and password,
17-
/// details configured in the following environment variables:
16+
/// Enables authentication to Azure Active Directory using a client secret or certificate, or as a user
17+
/// with a username and password.
18+
/// <para>
19+
/// Configuration is attempted in this order, using these environment variables:
20+
/// </para>
21+
///
22+
/// <b>Service principal with secret:</b>
1823
/// <list type="table">
1924
/// <listheader><term>Variable</term><description>Description</description></listheader>
20-
/// <item><term>AZURE_TENANT_ID</term><description>The Azure Active Directory tenant(directory) ID.</description></item>
21-
/// <item><term>AZURE_CLIENT_ID</term><description>The client(application) ID of an App Registration in the tenant.</description></item>
25+
/// <item><term>AZURE_TENANT_ID</term><description>The Azure Active Directory tenant (directory) ID.</description></item>
26+
/// <item><term>AZURE_CLIENT_ID</term><description>The client (application) ID of an App Registration in the tenant.</description></item>
2227
/// <item><term>AZURE_CLIENT_SECRET</term><description>A client secret that was generated for the App Registration.</description></item>
28+
/// </list>
29+
///
30+
/// <b>Service principal with certificate:</b>
31+
/// <list type="table">
32+
/// <listheader><term>Variable</term><description>Description</description></listheader>
33+
/// <item><term>AZURE_TENANT_ID</term><description>The Azure Active Directory tenant (directory) ID.</description></item>
34+
/// <item><term>AZURE_CLIENT_ID</term><description>The client (application) ID of an App Registration in the tenant.</description></item>
2335
/// <item><term>AZURE_CLIENT_CERTIFICATE_PATH</term><description>A path to certificate and private key pair in PEM or PFX format, which can authenticate the App Registration.</description></item>
24-
/// <item><term>AZURE_CLIENT_SEND_CERTIFICATE_CHAIN</term><description>Specifies whether an authentication request will include an x5c header to support subject name / issuer based authentication. When set to `true` or `1`, authentication requests include the x5c header.</description></item>
36+
/// <item><term>AZURE_CLIENT_CERTIFICATE_PASSWORD</term><description>(Optional) The password protecting the certificate file (currently only supported for PFX (PKCS12) certificates).</description></item>
37+
/// <item><term>AZURE_CLIENT_SEND_CERTIFICATE_CHAIN</term><description>(Optional) Specifies whether an authentication request will include an x5c header to support subject name / issuer based authentication. When set to `true` or `1`, authentication requests include the x5c header.</description></item>
38+
/// </list>
39+
///
40+
/// <b>Username and password:</b>
41+
/// <list type="table">
42+
/// <listheader><term>Variable</term><description>Description</description></listheader>
43+
/// <item><term>AZURE_TENANT_ID</term><description>The Azure Active Directory tenant (directory) ID.</description></item>
44+
/// <item><term>AZURE_CLIENT_ID</term><description>The client (application) ID of an App Registration in the tenant.</description></item>
2545
/// <item><term>AZURE_USERNAME</term><description>The username, also known as upn, of an Azure Active Directory user account.</description></item>
2646
/// <item><term>AZURE_PASSWORD</term><description>The password of the Azure Active Directory user account. Note this does not support accounts with MFA enabled.</description></item>
2747
/// </list>
48+
///
2849
/// This credential ultimately uses a <see cref="ClientSecretCredential"/>, <see cref="ClientCertificateCredential"/>, or <see cref="UsernamePasswordCredential"/> to
2950
/// perform the authentication using these details. Please consult the
3051
/// documentation of that class for more details.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
namespace Azure.Identity
1616
{
1717
/// <summary>
18-
/// Authenticates using tokens in the local cache shared between Microsoft applications.
18+
/// Authenticates using tokens in a local cache file. This is a legacy mechanism for authenticating clients using credentials provided to Visual Studio.
19+
/// This mechanism for Visual Studio authentication has been replaced by the <see cref="VisualStudioCredential"/>.
1920
/// </summary>
2021
public class SharedTokenCacheCredential : TokenCredential
2122
{

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
namespace Azure.Identity
1616
{
1717
/// <summary>
18-
/// Enables authentication to Azure Active Directory using data from Visual Studio Code.
18+
/// Enables authentication to Azure Active Directory as the user signed in to Visual Studio Code via
19+
/// the 'Azure Account' extension.
20+
///
21+
/// It's a <see href="https://github.com/Azure/azure-sdk-for-net/issues/27263">known issue</see> that `VisualStudioCodeCredential`
22+
/// doesn't work with <see href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account">Azure Account extension</see>
23+
/// versions newer than <b>0.9.11</b>. A long-term fix to this problem is in progress. In the meantime, consider authenticating
24+
/// with <see cref="AzureCliCredential"/>.
1925
/// </summary>
2026
public class VisualStudioCodeCredential : TokenCredential
2127
{

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
namespace Azure.Identity
1919
{
2020
/// <summary>
21-
/// Enables authentication to Azure Active Directory using data from Visual Studio
21+
/// Enables authentication to Azure Active Directory using data from Visual Studio 2017 or later. See
22+
/// <seealso href="https://learn.microsoft.com/dotnet/azure/configure-visual-studio" /> for more information
23+
/// on how to configure Visual Studio for Azure development.
2224
/// </summary>
2325
public class VisualStudioCredential : TokenCredential
2426
{

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ protected virtual async ValueTask<AccessToken> HandleResponseAsync(
6161

6262
message = GetMessageFromResponse(json.RootElement);
6363
}
64+
catch (JsonException jex)
65+
{
66+
throw new CredentialUnavailableException(UnexpectedResponse, jex);
67+
}
6468
catch (Exception e)
6569
{
6670
exception = e;

0 commit comments

Comments
 (0)