Skip to content

Commit 0c3429c

Browse files
committed
User ChainedTokenCredential and fallback to interactive browser to login
1 parent 041921f commit 0c3429c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shell/agents/Microsoft.Azure.Agent/Schema.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ internal class UserAccessToken
357357
{
358358
private readonly TokenRequestContext _tokenContext;
359359
private AccessToken? _accessToken;
360+
private const string AiShellAppId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"; // Use Azure Cli's Application Id for now
360361

361362
/// <summary>
362363
/// The access token.
@@ -386,7 +387,8 @@ internal async Task CreateOrRenewTokenAsync(CancellationToken cancellationToken)
386387

387388
if (needRefresh)
388389
{
389-
_accessToken = await new AzureCliCredential()
390+
_accessToken = await new ChainedTokenCredential(new AzureCliCredential(),
391+
new InteractiveBrowserCredential(AiShellAppId))
390392
.GetTokenAsync(_tokenContext, cancellationToken);
391393
}
392394
}

0 commit comments

Comments
 (0)