Skip to content

Commit 23c0c85

Browse files
authored
Prepare Identity for release with bugfix (#47753)
1 parent fffdf45 commit 23c0c85

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

eng/Packages.Data.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@
164164
<!-- Other approved packages -->
165165
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.6.9" />
166166
<PackageReference Update="Microsoft.Azure.WebPubSub.Common" Version="1.4.0" />
167-
<PackageReference Update="Microsoft.Identity.Client" Version="4.66.1" />
168-
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="4.66.1" />
169-
<PackageReference Update="Microsoft.Identity.Client.Broker" Version="4.66.1" />
167+
<PackageReference Update="Microsoft.Identity.Client" Version="4.67.2" />
168+
<PackageReference Update="Microsoft.Identity.Client.Extensions.Msal" Version="4.67.2" />
169+
<PackageReference Update="Microsoft.Identity.Client.Broker" Version="4.67.2" />
170170

171171
<!-- TODO: Make sure this package is arch-board approved -->
172172
<PackageReference Update="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.35.0" />

sdk/identity/Azure.Identity/CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
# Release History
22

3-
## 1.14.0-beta.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
3+
## 1.13.2 (2025-01-14)
84

95
### Bugs Fixed
106

117
- Fixed an issue where setting `DefaultAzureCredentialOptions.TenantId` twice throws an `InvalidOperationException` ([#47035](https://github.com/Azure/azure-sdk-for-net/issues/47035))
128
- Fixed an issue where `ManagedIdentityCredential` does not honor the `CancellationToken` passed to `GetToken` and `GetTokenAsync`. ([#47156](https://github.com/Azure/azure-sdk-for-net/issues/47156))
139
- Fixed an issue where some credentials in `DefaultAzureCredential` would not fall through to the next credential in the chain under certain exception conditions.
14-
15-
### Other Changes
10+
- Fixed a regression in `ManagedIdentityCredential` when used in a `ChainedTokenCredential` where the invalid json responses do not fall through to the next credential in the chain. ([#47470](https://github.com/Azure/azure-sdk-for-net/issues/47470))
1611

1712
## 1.13.1 (2024-10-24)
1813

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.14.0-beta.1</Version>
5+
<Version>1.13.2</Version>
66
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
77
<ApiCompatVersion>1.13.1</ApiCompatVersion>
88
<PackageTags>Microsoft Azure Identity;$(PackageCommonTags)</PackageTags>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Azure.Core.Pipeline;
99
using System.Linq;
1010
using System.ComponentModel;
11+
using Microsoft.Identity.Client;
1112

1213
namespace Azure.Identity
1314
{
@@ -150,6 +151,13 @@ private async ValueTask<AccessToken> GetTokenImplAsync(bool async, TokenRequestC
150151
}
151152
return scope.Succeeded(result);
152153
}
154+
// The managed_identity_response_parse_failure error is thrown when the response from the managed identity endpoint cannot be parsed.
155+
// Since for non-DAC invocations of the credential, we do not participate in parsing the raw response, we rely on this error to indicate
156+
// that the response was not valid JSON.
157+
catch (MsalServiceException e) when (e.ErrorCode == MsalError.ManagedIdentityResponseParseFailure)
158+
{
159+
throw scope.FailWrapAndThrow(new CredentialUnavailableException(MsiUnavailableError, e), Troubleshooting);
160+
}
153161
catch (Exception e)
154162
{
155163
// This exception pattern indicates that the MI endpoint is not available after exhausting all retries.

sdk/identity/Azure.Identity/tests/ManagedIdentityCredentialTests.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ public async Task VerifyClientAuthenticateThrows()
863863
}
864864

865865
[Test]
866-
public async Task VerifyClientAuthenticateReturnsInvalidJsonOnSuccess([Values(200)] int status)
866+
[NonParallelizable]
867+
public async Task VerifyClientAuthenticateReturnsInvalidJsonOnSuccess([Values(true, false)] bool isChained)
867868
{
868869
using var environment = new TestEnvVar(
869870
new()
@@ -874,15 +875,20 @@ public async Task VerifyClientAuthenticateReturnsInvalidJsonOnSuccess([Values(20
874875
{ "IDENTITY_HEADER", null },
875876
{ "AZURE_POD_IDENTITY_AUTHORITY_HOST", null }
876877
});
877-
var mockTransport = new MockTransport(request => CreateInvalidJsonResponse(status));
878-
var options = new TokenCredentialOptions() { Transport = mockTransport, IsChainedCredential = true };
878+
var mockTransport = new MockTransport(request => CreateInvalidJsonResponse(200));
879+
var options = new TokenCredentialOptions() { Transport = mockTransport, IsChainedCredential = isChained };
879880
options.Retry.MaxDelay = TimeSpan.Zero;
880881
var pipeline = CredentialPipeline.GetInstance(options);
881882

882-
ManagedIdentityCredential credential = InstrumentClient(new ManagedIdentityCredential("mock-client-id", pipeline, options));
883+
ManagedIdentityCredential credential = InstrumentClient(new ManagedIdentityCredential(
884+
new ManagedIdentityClient(
885+
new ManagedIdentityClientOptions() { Pipeline = pipeline, ManagedIdentityId = ManagedIdentityId.FromUserAssignedClientId("mock-client-id"), IsForceRefreshEnabled = true, Options = options })));
883886

884887
var ex = Assert.ThrowsAsync<CredentialUnavailableException>(async () => await credential.GetTokenAsync(new TokenRequestContext(MockScopes.Default)));
885-
Assert.IsInstanceOf(typeof(System.Text.Json.JsonException), ex.InnerException);
888+
if (isChained)
889+
{
890+
Assert.IsInstanceOf(typeof(System.Text.Json.JsonException), ex.InnerException);
891+
}
886892
await Task.CompletedTask;
887893
}
888894

0 commit comments

Comments
 (0)