9

Using the latest Azure Data Studio Version: 1.32.0

Attempting to access a database using Azure Active Directory MFA and am getting the error:

Token retrieval failed with an error. Open developer tools to view the error

How can I resolve?

Connection type: Microsoft SQL Server
Authentication type: Azure Active Directory - Universal with MFA support

The server, account, and database fields are all populated with their respective necessary information.

A browser window pops up asking for username/password, which I enter valid credentials for, followed by the authentication being confirmed in the browser that follows, accompanied by instructions to close the browser window. Azure Data Studio then has the error displayed as mentioned above.

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Mike Miller
  • 93
  • 2
  • 8
  • Is your local computer time NTP synced? There are also the nuclear options, deleting your ADS Azure Accounts folder, as presented in [issue 12165](https://github.com/microsoft/azuredatastudio/issues/12165). – AlwaysLearning Oct 07 '21 at 13:11
  • Yes @AlwaysLearning, this computer is domain joined and time synced using NTP – Mike Miller Oct 07 '21 at 13:55

2 Answers2

33

Problem seems to be with a cached token. try to delete the token from here C:\Users{UserNameHere}\AppData\Roaming\azuredatastudio\Azure Accounts and try to re authenticate.

JayakrishnaGunnam-MT
  • 1,548
  • 1
  • 5
  • 9
  • 5
    the path on mac is : `~/Library/Application Support/azuredatastudio/Azure Accounts` . Remove the file `azureTokenCache_azure_publicCloudin` – Mohammed Siddiq Jan 20 '22 at 23:04
  • on linux (i tried this on a debian based distro): `~/.config/azuredatastudio/Azure Accounts/azureTokenCache_azure_publicCloud` – Andras Toth May 11 '22 at 08:27
  • 1
    Azure Data Studio needs to be restarted after the deletion of the cache file for the changes to take effect. With this addendum, works perfectly! Thank you! – Tuukka Haapaniemi Aug 25 '22 at 09:43
  • 1
    I had to delete both cache files to get this to work - ```azureTokenCache_azure_publicCloud``` and ```azureTokenCacheMsal-azure_publicCloud``` – Jeff Mitchell Feb 17 '23 at 00:05
8

You have cached stale credentials.

Select the credentials in the Accounts section, then delete them and add fresh credentials.

Azure Data Studio Accounts Section

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122