Dan Schnau

How to Change which Identity Visual Studio uses to Authenticate with Azure

I was developing an app locally on a different laptop than usual. When it started it would fall over returning 502 errors. I saw in Visual Studio's debug output this error:

Exception thrown: 'Microsoft.Azure.Services.AppAuthentication.AzureServiceTokenProviderException' in System.Private.CoreLib.dll

The error was caused because my app uses a Key Vault instance on a different subscription. I had already signed into Visual Studio with the correct identity, but there's another step to tell Visual Studio 2019 which identity to use when authenticating.

As I found in The Azure/Key Vault docs, The menu is under Tools > Options > Azure Service Authentication.

Azure Service Authentication Options