microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.57k stars 901 forks source link

Unable to log in to Azure Account #25367

Open npasken opened 8 months ago

npasken commented 8 months ago

Type: Bug

  1. Launch Azure Data Studio
  2. Try to add Azure Account using Device Code flow
  3. Get following errors:
[Error]: Error fetching tenants :TypeError: Cannot use 'in' operator to search for 'error' in invalid_request: Your request could not be processed.
[Error]: Login failed: TypeError: Cannot use 'in' operator to search for 'error' in invalid_request: Your request could not be processed.

Azure Data Studio version: azuredatastudio 1.47.1 (b6f7beb01f92adaa4b79b6b6f3ac704e95cafe6e, 2024-01-10T02:15:02.628Z) OS version: Windows_NT x64 10.0.22621 Restricted Mode: No Preview Features: Enabled Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)| |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)|39.69GB (21.34GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (3) Extension|Author (truncated)|Version ---|---|--- copilot|Git|1.95.239 azuredatastudio-mysql|Mic|1.0.0 query-history|Mic|0.5.3
github-actions[bot] commented 8 months ago

We need more info to debug your Microsoft Entra ID issue. If you could attach your logs to the issue (ensure no private data is in them), it would help us fix the issue much faster.

Additionally, please review known issues and their resolutions that could be helpful: Common Azure Authentication Issues

npasken commented 8 months ago

1-Azure Accounts.log

As requested - file is attached.

cheenamalhotra commented 8 months ago

it seems the request is going invalid for this case, even though it works in most cases. I will add more logging so we can understand better what is going wrong.

npasken commented 8 months ago

it seems the request is going invalid for this case, even though it works in most cases. I will add more logging so we can understand better what is going wrong.

I'm a rather new user to ADS, but if it is supposed to be similar to VS Code, I don't have any issues logging in to my account in VS Code. Not sure if that's helpful, but figured I'd mention. And I tried using the Auth code grant flow and get the same error.

calebcartwright commented 8 months ago

We've got people running into this as well and it's hindering progress on some key initiatives.

Is there a feature branch anywhere that's got that aforementioned extra logging that we could use to build and run locally to try to get to the source of the error? We've had our AAD admins check on the AAD side and everything looks correct and successful there, but on the Data Studio client side the underlying Type Error that's occurring due to this 👇 call site:

https://github.com/microsoft/azuredatastudio/blob/187e061089cf825a2132380790d0b8505e07e0f4/extensions/azurecore/src/account-provider/auths/azureAuth.ts#L259

is completely swallowing whatever the underlying issue is because the call arg is clearly not an object the in operator can be used against

cheenamalhotra commented 8 months ago

There hasn't been any churn in this area recently, the request made to acquire tenants itself is failing, which is surprising.

Can you enable PII logging using below setting, restart ADS and rerun the failing scenario. You can find logs in "Azure Accounts" Output pane or in the log file as per above comment, something like under.

image

[Verbose]: Fetching tenants with uri: https://management.azure.com/tenants?api-version=2019-11-01 - []
[Pii]: GET request  response=<<<this is where you will find detailed error information>>>

Just paste the error from the response above, you need not share the complete log file. Please mask any sensitive info and paste detailed error as available.

We will address the 'in' operator bug in future iterations.

calebcartwright commented 8 months ago

We've got an open Service Request with Microsoft. Would it be better for us to share masked content here in public or the full log in private on the request?

calebcartwright commented 8 months ago

The details we have from the PII log are below. They do not strike me as particularly illuminating but hopefully it offers something meaningful to you 🤷

The response is an object with a set of single digit stringified keys, each of which has a single character string as the value.

There's no data key

[Pii]: GET request response={"0":"B","1":"a","2":"d","3":" ", ...elided... } - ["https://management.azure.com/tenants?api-version=2019-11-01"] [Error]: Error fetching tenants :TypeError: Cannot use 'in' operator to search for 'error' in Bad request - [] [Error]: Login failed: TypeError: Cannot use 'in' operator to search for 'error' in Bad request - []

JF-SR commented 7 months ago

Hi. I am experiencing exactly the same problem. Have tried adding/removing proxy but makes no difference. Azure authentication reports success in the browser but then always fails here: [Verbose]: Fetching tenants with uri: https://management.azure.com/tenants?api-version=2019-11-01 - [] [Error]: Error fetching tenants :TypeError: Cannot use 'in' operator to search for 'error' in

npasken commented 2 months ago

Looks like Azure Data Studio has had a couple releases and this still isn't fixed. Will it be planned/fixed?