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.55k stars 900 forks source link

Failed to add account. No Azure tenants #9350

Closed marcwied closed 4 years ago

marcwied commented 4 years ago

Issue Type: Bug

I am trying to login into a reporting server, when I attempt to connect, it opens my Browser Windows and prompts me to select my Microsoft account. I select the correct one and it says I'm logged in.

I go back to Azure Data Studio and it shows me 2 different errors, see screenshot named 'Azure Errors'

I try to delete my Account from ADS, as suggested by my DevOps team, but It wont give me the option to do so. See my screenshot named 'Delete_user', there is no option to Delete.

Its expected that I am able to click "MONKEY Prod" and connect to the DB. Or atleast have the option to Delete my ADS account and re add. This started happening right after I updated to version 1.15.1.
Azure_Errors Delete_user Screen Shot 2020-02-26 at 10 43 56 AM

Azure Data Studio version: azuredatastudio 1.15.1 (83544eba2504f564d785534cc780d2073feec2cc, 2020-02-15T05:01:39.777Z) OS version: Darwin x64 18.7.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz (4 x 1600)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|6, 5, 4| |Memory (System)|8.00GB (0.09GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (1) Extension|Author (truncated)|Version ---|---|--- import|Mic|0.13.1

Azure_Errors Delete_user Screen Shot 2020-02-26 at 10 43 56 AM

SQLArchitect commented 4 years ago

I'm having the same problem. The Microsoft account I'm trying to use in an O365 account in Azure AD.

I don't have any previous connections established in ADS.

marcwied commented 4 years ago

I'm thinking the inability to delete my account is related to the length of my name, since the 'x' isnt visible at all and my email domain is cutoff directly before '.com'. Other members of my team, with much shorter names, are able to delete and re ad their account and can connect with no problem once the account has been re added

kburtram commented 4 years ago

@aaomidi have you seen this type of error before?

aaomidi commented 4 years ago

The no azure tenants error happens when the user doesn't have permission to request information from a tenant.

If you open the developer log (Help -> Toggle Developer Tools -> Console) you might get a little bit more details on why the tenant authentication is failing.

Regarding the issue with being unable to delete it, I've caught that issue and it's covered here: https://github.com/microsoft/azuredatastudio/pull/9141/files#diff-3d0a372d3cce36b373fec7fe04ba53d3

marcwied commented 4 years ago

Hi,

how does https://github.com/microsoft/azuredatastudio/pull/9141/files#diff-3d0a372d3cce36b373fec7fe04ba53d3 help me? Does this mean its being worked on?

Im able to login via the Azure web portal but not the ADS App.

Inspector Tools provides me no additional information.

marcwied commented 4 years ago

Hi again,

I was able to fix by running mv ~/Library/Application\ Support/azuredatastudio ~/Desktop/ in terminal, re added my user and re added my connections to ADS (thanks aaron yeung! =))

aaomidi commented 4 years ago

@marcwied I'm glad you were able to find a solution!

Does this mean its being worked on?

Yeah, there were a few CSS issues that went unnoticed since they're only showing up if the text is a certain length.

Max-Eriksson commented 4 years ago

@marcwied in what location did you run mv ~/Library/Application\ Support/azuredatastudio ~/Desktop/ ?

I'm having the same issue Failed to add account. No Azure tenants. And the account I'm using is working in the portal and SSMS?

aaomidi commented 4 years ago

@Max-Eriksson ~ translates to your home directory - assuming you're on OSX.

What platform are you on?

devlace commented 4 years ago

Hi, I'm running into this issue as well though I'm on Windows machine. I'm not sure how moving files to the desktop would help -- In any case, I tried moving C:\Users\myuser\AppData\Local\Programs\Azure Data Studio to my Desktop and running it from there and I'm still running into the Failed to add account. No Azure tenants error.

System Info: Version: 1.15.1 (user setup) Commit: 83544eba2504f564d785534cc780d2073feec2cc Date: 2020-02-15T05:03:16.545Z VS Code: 1.42.0 Electron: 6.1.6 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Windows_NT x64 10.0.18363

Error screenshot: image

aaomidi commented 4 years ago

Path:

C:\Users{USERNAME}\AppData\Roaming\azuredatastudio\Azure Accounts

acblksun commented 4 years ago

Expanding on @aaomidi 's answer, I experienced the same issue after previously being able to use Azure AD MFA authentication to our Azure Sql database(s).

On Win10 this was resolved by:

Navigate to %userprofile%\AppData\Roaming\azuredatastudio\Azure Accounts and delete the (only) file I found there azureTokenCache-azurePublicCloud

cd "%userprofile%\AppData\Roaming\azuredatastudio\Azure Accounts"
rm azureTokenCache-azurePublicCloud
Charles-Gagnon commented 4 years ago

FYI - we added a command to make that easier. Open the command palette and run the Azure Accounts: Clear Azure Account Token Cache command

image

GoEddie commented 4 years ago

Just to say that I had this after changing my password, clearing the cache did nothing - I would get the web page saying I was logged in but Azure Data Studio just kept re-opening that page.

I deleted my credentials and re-added and it seems to have worked (for now)

iamwyza commented 4 years ago

@Charles-Gagnon - I just tried using your suggested command, but it did not clear my credentials cache. I had to manually delete them using the path above to make it actually work.

Charles-Gagnon commented 4 years ago

Oh huh, yeah sorry @iamwyza looks like the command isn't currently hooked up to do anything.

@aaomidi - do you know why this was commented out in https://github.com/microsoft/azuredatastudio/pull/8483? https://github.com/microsoft/azuredatastudio/blob/master/extensions/azurecore/src/account-provider/azureAccountProviderService.ts#L73

SQLArchitect commented 4 years ago

This command and deleting the file didn't work.

On Thu, Mar 12, 2020, 1:24 PM Charles Gagnon notifications@github.com wrote:

Oh huh, yeah sorry @iamwyza https://github.com/iamwyza looks like the command isn't currently hooked up to do anything.

@aaomidi https://github.com/aaomidi - do you know why this was commented out in #8483 https://github.com/microsoft/azuredatastudio/pull/8483? https://github.com/microsoft/azuredatastudio/blob/master/extensions/azurecore/src/account-provider/azureAccountProviderService.ts#L73

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/microsoft/azuredatastudio/issues/9350#issuecomment-598313312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWPJKZGYS4C3G6HZZSPXN3RHELFJANCNFSM4K4K2SAQ .

aaomidi commented 4 years ago

@Charles-Gagnon I'm not sure. I'll actually make that a port request for next release.

@SQLArchitect What are the errors you're getting?

SQLArchitect commented 4 years ago

The no Azure tenants and the other one just like originally reported.

On Thu, Mar 12, 2020, 1:59 PM Amir Omidi notifications@github.com wrote:

@Charles-Gagnon https://github.com/Charles-Gagnon I'm not sure. I'll actually make that a port request for next release.

@SQLArchitect https://github.com/SQLArchitect What are the errors you're getting?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/azuredatastudio/issues/9350#issuecomment-598337668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWPJK6RBOAHFPU24SDLRXDRHEPJPANCNFSM4K4K2SAQ .

spavett commented 4 years ago

I had the same issue today on my Mac. (Re)moving the config folder by moving it with mv ~/Library/Application\ Support/azuredatastudio ~/Desktop/ fixed for me also

aaomidi commented 4 years ago

If anyone hits this issue, I have a guide on how to cleanup your Azure Accounts folder.

https://github.com/microsoft/azuredatastudio/issues/9585#issuecomment-598359949

DTronD commented 4 years ago

Not sure if the command is uncommented and actually wired up yet, but in case it isn't or doesn't give the expected results, it seems for v1.17.1 the name of the token file has changed (again!). Today it is showing as azureTokeCache_azure_publicCloud versus the value that it had when @acblksun posted. Next week? Who knows!

aaomidi commented 4 years ago

The name of that file changing shouldn't impact this. If you're seeing a specific error happen please open a new issue as we're trying to sift through all the various OAuth woes.

DTronD commented 4 years ago

The name of that file changing shouldn't impact this. If you're seeing a specific error happen please open a new issue as we're trying to sift through all the various OAuth woes.

@aamidi , I didn't mean to imply the name change was an issue. I was just mentioning it in case anybody else scripted the delete and then starts swearing when that token-delete workaround seems to no longer work.

Also, today I had to use my old friend SSMS and I want to tell you and everybody else working on ADS, THANK YOU! Not disparaging SSMS (as it's been very good to me over the years). But for 95% of what I do with SQL, ADS is amazingly better. I feel so much more productive that it's like it's given me an extra hand to type with and ten IQ points (yippie, now up to 81! ). THANK YOU! THANK YOU! Good luck with the OAuth sifting. I hope it goes well.

nileshevrywhr commented 2 years ago

I'm having the same issue today, due to password change. but this command "clear azure account token cache" doesn't seem to be present anywhere in my command palette.

Has it been removed? I'll check the source.

Charles-Gagnon commented 2 years ago

What version are you using? It should still be there. If not check the logs to see if there were any failures when starting up the extension host or the Azure extension.