microsoft / DockerTools

Tools For Docker, including Visual Studio Provisioning and Publishing
Other
173 stars 26 forks source link

Containers.Tools.Targets 1.20.0 breaks VisualStudioCredential Token on VS 2022 17.9.5 #425

Closed omni-htg closed 3 months ago

omni-htg commented 3 months ago

Updating the Microsoft.VisualStudio.Azure.Containers.Tools.Targets package to 1.20.0 in a .NET 8 project running under VS 2022 17.9.5, the Azure Identity DefaultAzureCredential GetToken operation fails because it seems unable to fetch the VisualStudioCredential (which is being used to connect to Azure hosted services):

info: Azure.Identity[3]
      DefaultAzureCredential.GetToken was unable to retrieve an access token. Scopes: [ https://servicebus.azure.net/.default ] ParentRequestId: [REDACTED] Exception: Azure.Identity.CredentialUnavailableException (0x80131500): DefaultAzureCredential failed to retrieve a token from the included credentials. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot
      - EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
      - WorkloadIdentityCredential authentication unavailable. The workload options are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/workloadidentitycredential/troubleshoot
      - Managed Identity response was not in the expected format. See the inner exception for details.
      - Visual Studio Token provider can't be accessed at /home/app/.IdentityService/AzureServiceAuth/tokenprovider.json
      - Azure CLI not installed
      - PowerShell is not installed.
      - Azure Developer CLI could not be found.
       ---> System.AggregateException (0x80131500): Multiple exceptions were encountered while attempting to authenticate. (EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot) (WorkloadIdentityCredential authentication unavailable. The workload options are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/workloadidentitycredential/troubleshoot) (Managed Identity response was not in the expected format. See the inner exception for details.) (Visual Studio Token provider can't be accessed at /home/app/.IdentityService/AzureServiceAuth/tokenprovider.json) (Azure CLI not installed) (PowerShell is not installed.) (Azure Developer CLI could not be found.)
       ---> Azure.Identity.CredentialUnavailableException (0x80131500): EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot

Reverting back to 1.19.6 restores normal functionality.

Thank you! Regards.

NCarlsonMSFT commented 3 months ago

Thanks for bringing this to our attention, we've uploaded a new version that should address this: 1.20.1.

omni-htg commented 3 months ago

Updated to 1.20.1 and can confirm it no longer fails.

Thanks for the quick response!

Regards.