Skip to content

Commit ece4379

Browse files
author
Michael J. Lyons (XBOX)
committed
Debugging updates
1 parent 62b9c3d commit ece4379

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/shared/Core/Authentication/MicrosoftAuthentication.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,14 @@ public async Task<IMicrosoftAuthenticationResult> GetTokenForServicePrincipalAsy
274274

275275
try
276276
{
277-
var tokenBuilder = app.AcquireTokenForClient(scopes);
278-
279-
if (sp.SendX5C)
280-
{
281-
tokenBuilder = tokenBuilder.WithSendX5C(true);
282-
}
283-
284-
AuthenticationResult result = await tokenBuilder.ExecuteAsync();
277+
Context.Trace.WriteLine($"Sending with X5C: '{sp.SendX5C}'.");
278+
AuthenticationResult result = await app.AcquireTokenForClient(scopes).WithSendX5C(sp.SendX5C).ExecuteAsync();;
285279

286280
return new MsalResult(result);
287281
}
288282
catch (Exception ex)
289283
{
290-
Context.Trace.WriteLine($"Failed to acquire token for service principal '{sp.TenantId}/{sp.TenantId}'.");
284+
Context.Trace.WriteLine($"Failed to acquire token for service principal '{sp.TenantId}/{sp.Id}'.");
291285
Context.Trace.WriteException(ex);
292286
throw;
293287
}

src/shared/Microsoft.AzureRepos/AzureReposHostProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private bool UseServicePrincipal(out ServicePrincipalIdentity sp)
555555
AzureDevOpsConstants.GitConfiguration.Credential.ServicePrincipalCertificateSendX5C,
556556
out string certHasX5C);
557557

558-
sp.SendX5C = !hasX5CSetting || certHasX5C == "false";
558+
sp.SendX5C = !hasX5CSetting || certHasX5C != "false";
559559

560560
X509Certificate2 cert = X509Utils.GetCertificateByThumbprint(certThumbprint);
561561
if (cert is null)

0 commit comments

Comments
 (0)