dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.73k stars 430 forks source link

More DefaultAzureCredential diagnostics information with AddAzureProvisioning #2981

Open christiannagel opened 6 months ago

christiannagel commented 6 months ago

DefaultAzureCredential uses several different accounts to login such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential which can lead to wrong credentials used with AddAzureProvisioning. Not knowing which of these credentials have been used makes it harder to find issues. To see this information, diagnostic can be configured with DefaultAzureCredential.

It would be great to have a flag with AddAzureProvisioning (proabably with the configuration that's already used with user secrets) to enable diagnostic information with the use of DefaultAzureCredential.

This is an error I had: #2963

https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md#logging

christiannagel commented 6 months ago

Recently I had this issue again. Now it's possible to configure the credential source:

{
  "Azure": {
    "CredentialSource": "AzureCli",
  }
}

When I changed the credential source in the configuration to AzureCLI, authentication was working immediately. Changing this in the configuration can be one part for troubleshooting. To get more diagnostics information, I think the option to configure this would be great as well.

mitchdenny commented 6 months ago

Yeah I think this is a good idea in terms of diagnosability.