Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Account adding not working #9885

Closed
waldyd opened this issue Apr 7, 2020 · 33 comments · Fixed by #9921
Closed

Azure Account adding not working #9885

waldyd opened this issue Apr 7, 2020 · 33 comments · Fixed by #9921

Comments

@waldyd
Copy link

waldyd commented Apr 7, 2020

  • Azure Data Studio Version:
    image

Steps to Reproduce:

1.Try to Sign in to Azure
image
2. Click Add an Account:
image

  1. Supposedly account added:
    image
  2. No account added:
@aaomidi
Copy link
Contributor

aaomidi commented Apr 7, 2020

Hey @waldyd, could you please see if adding an account works on the latest insiders build?

https://github.com/microsoft/azuredatastudio#try-out-the-latest-insiders-build-from-master

@aaomidi aaomidi added this to the April 2020 Release milestone Apr 7, 2020
@waldyd
Copy link
Author

waldyd commented Apr 7, 2020

Yes @aaomidi . It is working for the Latest Windows User Insider version.

@aaomidi
Copy link
Contributor

aaomidi commented Apr 7, 2020

Thanks! Then this problem should be fixed for next release.

@aaomidi aaomidi closed this as completed Apr 7, 2020
@waldyd
Copy link
Author

waldyd commented Apr 7, 2020

@aaomidi but when trying to connect. This was prompted:

image

@aaomidi
Copy link
Contributor

aaomidi commented Apr 7, 2020

Hmm, that's weird. Does it repro 100% of the time?

Any errors in the developer console?

Help -> Toggle Developer Tools

@waldyd
Copy link
Author

waldyd commented Apr 8, 2020

Yes. It was reproduced several times.

Here the developer console errors are:

Getting key failed: Error: A specified logon session does not exist. It may already have been terminated.
 (at t.SimpleTokenCache.<anonymous> (c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\extensions\azurecore\dist\extension.js:166:23670))
2c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\node_modules.asar\zone.js\dist\zone-node.js:2280 

[Extension Host] (node:17540) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (at writeOut (internal/process/warning.js:27:3))

Adding key failed: Error: A specified logon session does not exist. It may already have been terminated.
 (at t.SimpleTokenCache.<anonymous> (c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\extensions\azurecore\dist\extension.js:166:23460))
2c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\node_modules.asar\zone.js\dist\zone-node.js:2280 

[Extension Host] Getting key failed: Error: A specified logon session does not exist. It may already have been terminated.
 (at t.SimpleTokenCache.<anonymous> (c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\extensions\azurecore\dist\extension.js:166:23670))
c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\node_modules.asar\zone.js\dist\zone-node.js:2280 
  
ERR Error: Failed to get Azure account token for connection
    at e.connectWithOptions (workbench.desktop.main.js:5617) [<root>]
    at processTicksAndRejections (internal/process/task_queues.js:85) [<root>]
    at async e.handleDefaultOnConnect (workbench.desktop.main.js:7773) [<root>]

[Extension Host] Shutting off webserver... (at Timeout._onTimeout (c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\extensions\azurecore\dist\extension.js:166:68580))

Then while trying to refresh the credentials:

c:\Users\nalvarez\AppData\Local\Programs\Azure Data Studio - Insiders\resources\app\node_modules.asar\zone.js\dist\zone-node.js:2280 ERR Error while refreshing account: TypeError: Cannot read property '2c94bed6-d675-4d3d-a53b-7b461fd6acc2' of undefined

@magnusbratt
Copy link

I am getting the sate issue in insiders build on Mac OSX.
image

After adding the account I get the following error message, and no account is added
image

In the console I get
image

@aaomidi
Copy link
Contributor

aaomidi commented Apr 8, 2020

Thank you this is extremely useful to investigate.

@aaomidi aaomidi reopened this Apr 8, 2020
@aaomidi
Copy link
Contributor

aaomidi commented Apr 8, 2020

@waldyd It seems like your issue is something to do with how your windows is setup. Azure Data Studio uses Windows Credential Manager to store authentication tokens.

image

This is technically the expected/secure way for us to store authentication tokens.

I think there is an argument to be made for us to enable flat-file storage for users like yourself that may have a stricter domain configuration, but I'm not entirely sure if that's wise as these tokens essentially identify you to the Azure service.

I recommend looking up the error you've received "A specified logon session does not exist. It may already have been terminated & Credential Manager", and you'll find a few threads that talk about that same issue.

If you look at your Local Group Policy Editor (Win+R, gpedit.msc) the following setting might be switched on to "Enabled":

image

This is likely blocking ADS to store credentials there.

@waldyd
Copy link
Author

waldyd commented Apr 9, 2020

Hi @aaomidi . That policy was disabled in my case:

image
image

Also, in my case, the browser is managed by my organization

@aaomidi
Copy link
Contributor

aaomidi commented Apr 9, 2020

@waldyd If it's enabled it wouldn't work I think. Can you try to use ADS on another device and see if you can repro this?

@aaomidi
Copy link
Contributor

aaomidi commented Apr 9, 2020

@magnusbratt We've published a new insiders build with more debug output, can you try to add your account on the latest version of ADS insiders?

The developer logs should contain a lot more info.

@magnusbratt
Copy link

OK. I updated to the lastest Insider version. I added my Azure account, and get the web page sign in. Then I get this error message in ADS:
image

and this in the developer tools console
image

@magnusbratt
Copy link

I now also installed the Insiders build on a Windows PC. When signing into Azure, I got
image

I then get the same
image

and in the developer tools console
image

@aaomidi
Copy link
Contributor

aaomidi commented Apr 9, 2020

So it seems you belong to a tenant where you don't actually have permissions to do resource management on it.

I'll make a PR that silently ignores tenants where you don't have permissions to do operations on them. Hopefully that fixes your problem.

It'll also contain some more debug information giving you information on why that's failing.

Can you check on azure portal to see if you have permissions to the tenant described by:
image

@magnusbratt
Copy link

My account does belong to a few directories where I do not have permissions. However, for the directory referenced, I am "global administrator".
image

However, I removed "left the organization" for another tenant that I know I do not have permissions to. After this, I was able to expand my subscriptions and access resources. But when I try to expand a database to view it, it does not expand. The spinner never stops, se screenshot. There are no additional messages in the developer tools console.
image

@aaomidi aaomidi reopened this Apr 9, 2020
@aaomidi
Copy link
Contributor

aaomidi commented Apr 9, 2020

Whoops didn't mean to close this issue. Let's wait for the insiders build tomorrow and go over this. Thank you so much for helping me debug this @magnusbratt :)

@aaomidi aaomidi self-assigned this Apr 10, 2020
@magnusbratt
Copy link

Just FYI. I just updated to the latest Insider build and the issue persists.

image

I get no new messages in developer tools console.

@aaomidi
Copy link
Contributor

aaomidi commented Apr 14, 2020

Could you please share your console either way? Would still be helpful :)

@magnusbratt
Copy link

Here is a screenshot, including developer tools console

image

@aaomidi
Copy link
Contributor

aaomidi commented Apr 14, 2020

Oh so it lists the databases, just doesn't connect to them right?

@magnusbratt
Copy link

Correct. That's a new behavior since after I left the tenant for which I did not have permissions. That is, I can expand the account, the subscription, "SQL database", but not view the database.

I can also expand the account, the subscription, "SQL server", but not view/expand the server.
image

@aaomidi
Copy link
Contributor

aaomidi commented Apr 14, 2020

@magnusbratt Alright that's a whole different issue. Could you try making yourself the admin on that server on azure portal.

Open the SQL Database on Azure Portal, and add your account as the Active Directory admin.

image

@magnusbratt
Copy link

@aaomidi Is it OK to continue in this thread, or do you want me to create a new issue?

I am already a member of the Active Directory group that is admin of the server.

image

image

@magnusbratt
Copy link

@aaomidi FYI: Today I updated ADZ Insiders on my Mac and it now works to sign in with my AAD account and access the database servers and databases I have access to.

It still does not work with the non-insider build, but I assume that is a matter of time.

I have also tested the latest insiders build on my PC and it works just as well.

Thanks for developing great software!

@chriskinsman
Copy link

This is still an issue for me with Azure Insiders 1.18.0 build.

Trying to connect to postgres.

ERR Error: Failed to get Azure account token for connection
at e.connectWithOptions (workbench.desktop.main.js:5724) []
at async e.handleDefaultOnConnect (workbench.desktop.main.js:7901) []

@aaomidi
Copy link
Contributor

aaomidi commented Apr 29, 2020

Insiders is unfortunately a little broken at the moment. I would suggest sticking to the release branch.

If this issue is specific to PostgreSQL, I would recommend opening another issue.

@chriskinsman
Copy link

Wasn't working in release which is why I tried insiders.

@aaomidi
Copy link
Contributor

aaomidi commented May 6, 2020

So since the original issue is fixed, I'll be closing this issue.

Please definitely open a new issue if you are seeing any issues with AzureMFA.

@aaomidi aaomidi closed this as completed May 6, 2020
@tcoldiron
Copy link

tcoldiron commented Apr 4, 2023

Azure Data Studio is not providing much detailed feedback, it just fails.

Using Azure Data Studio Version: 1.42.0 (Universal) on MacBook Pro with MacOS Ventura Version 13.2.1 (22D68)

Screenshot 2023-04-04 at 2 27 56 PM

We recently changed from SQL Server login, to Azure Active Directory authentication, and I haven't been able to log in since, whether by "Connection" or "Add Account" or any way.

Screenshot 2023-04-04 at 4 38 17 PM

I even uninstalled & reinstalled, cleared settings.json down to just the two brackets and restarted Azure Data Studio - nothing works.

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Apr 4, 2023

@tcoldiron

Please find this related issue and recommendation: #22227 (comment)
If disabling 'HTTP: System Certificates' doesn't resolve, please open a new issue with logs attached, as per #22227 (comment)

@tcoldiron
Copy link

That recommendation got me going! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants