azuredatastudio icon indicating copy to clipboard operation
azuredatastudio copied to clipboard

Connection error - multiple matching tokens detected

Open KevinInKy opened this issue 1 year ago • 11 comments

Type: Bug

I can no longer log into any MS Sql Server using Azure Data Studio.

I get this error that tells me to clear token cache. I have no idea how to do that.

Failed to authenticate the user in Active Directory (Authentication=ActiveDirectoryInteractive). Error code 0xmultiple_matching_tokens_detected The cache contains multiple tokens satisfying the requirements. Try to clear token cache.

Azure Data Studio version: azuredatastudio 1.49.0 (6e6d22ddd74bbb4fbe344ed80b93b53489fe0239, 2024-08-01T05:19:02.202Z) OS version: Windows_NT x64 10.0.19045 Restricted Mode: No Preview Features: Enabled Modes:

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 1805)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.39GB (13.84GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none

KevinInKy avatar Aug 07 '24 15:08 KevinInKy

Please try to clear the Azure Token Cache using the command in the Command Palette. Specifically,

  1. Click F1
  2. type something like clear
  3. Run the Clear Azure Token Cache entry.

image

kburtram avatar Aug 07 '24 16:08 kburtram

Please try to clear the Azure Token Cache using the command in the Command Palette. Specifically,

  1. Click F1
  2. type something like clear
  3. Run the Clear Azure Token Cache entry.

image

Thank you! This fixed my issue and I can log in again. Much appreciated.

KevinInKy avatar Aug 07 '24 17:08 KevinInKy

Had the same issue with 1.49.1. Clearing the cache worked for me, but very anoying bug

Commit: 2f696aa95a13ccabd7e0a4431d1d759e3a7b8cfd
Date: 2024-08-13T18:12:38.831Z
VS Code: 1.82.0
Electron: 25.9.8
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.22631

RickMcDee avatar Aug 19 '24 17:08 RickMcDee

I also had the same issue using v1.49.0, and clearing the cache also helped me. Is this a new "feature"?

e2ibrobbins avatar Aug 22 '24 10:08 e2ibrobbins

Hit the same bug today, using 1.49.1

Solution above resolved it, but was not an intuitive flow since I had to find this to figure out how to clear the cache.

Matthewsre avatar Aug 22 '24 16:08 Matthewsre

The latest release contained a version update for the Azure.Identity (https://github.com/microsoft/sqltoolsservice/pull/2376). That component appears to be where this error is originating from. I'm not sure the details of why this is occurring specifically. Is this happening multiple times on the same machine? Or is it a one-time error requiring a token cache reset?

kburtram avatar Aug 28 '24 03:08 kburtram

...Is this happening multiple times on the same machine? Or is it a one-time error requiring a token cache reset?

After clearing the token cache (per @KevinInKy) the error cleared. I'll update this comment if I experience it again in the next few days.

pettys avatar Sep 02 '24 17:09 pettys

So, can this error message be changed to include a button allowing us to clear the token cache?

When you first get this error, it's not at all obvious that "Clear Azure token cache" is an actual command in Azure Data Studio, so it's a dead end...unless you manage to find this issue, anyway.

rlundy avatar Sep 17 '24 08:09 rlundy

On 1.49.1 and experienced this. The error is not really very informative in explaining what i have to do. Is it my local cache that is in error or remote AD platform?

The error should state the solution strategy explicitly. Like: To resolve use command: Clear Azure Token Cache

I luckily stumbled upon this thread and found the solution.

tlogik avatar Oct 11 '24 15:10 tlogik

Same error.

Exact command not available in my VS Code.

"Clear Azure Token Cache"

I do have azure account extension installed...

alittlesliceoftom avatar Oct 30 '24 11:10 alittlesliceoftom

fun fact.....

if you PIM into an Entra group that allows you access to a Database, and get connected via ADS.....Once the PIM activation expires (ie, you no longer should be able to access the DB), you still can access the DB. I even removed the azure user account in ADS and re-added it...and I was still able to access my production database because the token it held on to was the token that still had me in the PIM group. The ONLY way I got DS to stop letting me access the server was to restart ADS entirely

jason-berk-k1x avatar Feb 12 '25 19:02 jason-berk-k1x