Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Accounts/Accounts/Account/ConnectAzureRmAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public override void ExecuteCmdlet()
subscriptionName,
password,
SkipValidation,
WriteWarning,
WriteWarningEvent, //Could not use WriteWarning directly because it may be in worker thread
name,
shouldPopulateContextList,
MaxContextPopulation));
Expand All @@ -419,7 +419,7 @@ public override void ExecuteCmdlet()

try
{
var result = (PSAzureProfile)(task.ConfigureAwait(false).GetAwaiter().GetResult());
var result = (PSAzureProfile)task.Result;
WriteObject(result);
}
catch (AuthenticationFailedException ex)
Expand Down
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed an issue causing Write-Object error during Connect-AzAccount [#13419]
* Added parameter "ContainerRegistryEndpointSuffix" to: `Add-AzEnvironment`, `Set-AzEnvironment`
* Supported interrupting login by hitting <kbd>CTRL</kbd>+<kbd>C</kbd>
* Fixed an issue causing `Connect-AzAccount -KeyVaultAccessToken` not working [#13127]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public IAccessToken Authenticate(
{
while (processAuthenticator != null && processAuthenticator.TryAuthenticate(GetAuthenticationParameters(tokenCacheProvider, account, environment, tenant, password, promptBehavior, promptAction, tokenCache, resourceId), out authToken))
{
token = authToken?.ConfigureAwait(true).GetAwaiter().GetResult();
token = authToken?.ConfigureAwait(false).GetAwaiter().GetResult();
if (token != null)
{
// token.UserId is null when getting tenant token in ADFS environment
Expand All @@ -142,7 +142,7 @@ public IAccessToken Authenticate(
{
if (!IsTransientException(e) || retries == 0)
{
throw e;
throw;
}

TracingAdapter.Information(string.Format("[AuthenticationFactory] Exception caught when calling TryAuthenticate, retrying authentication - Exception message: '{0}'", e.Message));
Expand Down
3 changes: 2 additions & 1 deletion src/Accounts/Authenticators/DeviceCodeAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.ResourceManager.Common;

namespace Microsoft.Azure.PowerShell.Authenticators
{
Expand Down Expand Up @@ -74,7 +75,7 @@ public override bool CanAuthenticate(AuthenticationParameters parameters)
private void WriteWarning(string message)
{
EventHandler<StreamEventArgs> writeWarningEvent;
if (AzureSession.Instance.TryGetComponent("WriteWarning", out writeWarningEvent))
if (AzureSession.Instance.TryGetComponent(AzureRMCmdlet.WriteWarningKey, out writeWarningEvent))
{
writeWarningEvent(this, new StreamEventArgs() { Message = message });
}
Expand Down
6 changes: 3 additions & 3 deletions src/Accounts/Authenticators/MsalAccessToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static async Task<IAccessToken> GetAccessTokenAsync(
string userId = null,
string homeAccountId = "")
{
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken);
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken).ConfigureAwait(false);
return new MsalAccessToken(tokenCredential, requestContext, token.Token, token.ExpiresOn, tenantId, userId, homeAccountId);
}

Expand All @@ -84,9 +84,9 @@ public static async Task<IAccessToken> GetAccessTokenAsync(
TokenRequestContext requestContext,
CancellationToken cancellationToken)
{
var record = await authTask;
var record = await authTask.ConfigureAwait(false);
cancellationToken.ThrowIfCancellationRequested();
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken);
var token = await tokenCredential.GetTokenAsync(requestContext, cancellationToken).ConfigureAwait(false);

return new MsalAccessToken(tokenCredential, requestContext, token.Token, token.ExpiresOn, record.TenantId, record.Username, record.HomeAccountId);
}
Expand Down