[BUG] GetAccessTokenAsync is very slow when running locally
See original GitHub issueDescribe the bug
I used GetAccessTokenAsync
code to test MSI locally. The code was running for more than 1 minute before it returned a valid token. I tested it multiple times, the behavior was consistent.
Exception or Stack Trace Add the exception log and stack trace if available
To Reproduce Try running the code locally.
Code Snippet
namespace test
{
class Program
{
static async Task Main(string[] args)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var token = await azureServiceTokenProvider.GetAccessTokenAsync("https://management.azure.com/");
stopwatch.Stop();
Console.WriteLine(stopwatch.Elapsed);
}
}
}
Expected behavior The method returns code in a reasonable time (e.g. a few seconds).
Screenshots If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
- OS: [e.g. iOS] Mac OS 10.13.6
- IDE : [e.g. IntelliJ] VS code, tested locally using
dotnet run
. - Version of the Library used:
Microsoft.Azure.Services.AppAuthentication
, 1.0.3 - Dotnet version: 2.2.103
- Azure CLI version:
2.0.58
Additional context Add any other context about the problem here.
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
"RunAs=Developer; DeveloperTool=AzureCli"
https://docs.microsoft.com/en-us/azure/key-vault/service-to-service-authentication#connection-string-supportYes please.