microsoft / vscode-azure-account

Common Azure Login extension for VS Code
https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account
Other
138 stars 131 forks source link

Can't connect to Azure Account #1012

Closed adambrubaker closed 1 week ago

adambrubaker commented 1 week ago

Hello

I'm not exactly sure when or what changed but I can no longer connect to my Azure account. I click the Sign in to Azure, which pops the web browser, and I select my account. It says you signed in now and can close this page. But the Sign into Azure page remains in VSCode. I have tried the basics of removing/reinstalling the extensions, rebooting my machine, and clearing cache to make sure my sign in is correct. Not sure what else to try.

Thanks!

Image

Image

alexweininger commented 1 week ago

Hi, could you try setting the azure.authenticationLibrary setting to MSAL?

Image

It would also be helpful to see the Azure Account extension logs.

adambrubaker commented 1 week ago

Hey Alex

Thanks for the response. I'm getting the same error for ADAL and MSAL. I think I found the correct logs and pasted them below. In them the 14:48 is my attempt with ADAL and the 14:50 is my attempt with MSAL. I see a successful login for my account in Entra for both of these attempts. Thanks!

2024-11-19 14:48:19.025 [info] Attempting to reach URL "https://login.microsoftonline.com/"... 2024-11-19 14:48:19.409 [info] MSAL: [Tue, 19 Nov 2024 19:48:19 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:48:42.541 [info] MSAL: [Tue, 19 Nov 2024 19:48:42 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:48:42.546 [info] Attempting to reach URL "https://login.microsoftonline.com/"... 2024-11-19 14:48:43.875 [info] Attempting to reach URL "https://vscode.dev/redirect"... 2024-11-19 14:48:43.875 [info] Attempting to reach URL "https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=aebc6443-996d-45c2-90f0-388ff96faa56&redirect_uri=https%3A%2F%2Fvscode.dev%2Fredirect&state=http%3A%2F%2F127.0.0.1%3A52583%2Fcallback?nonce=SPQhODB6e9fhJ9qcGx4K1A%3D%3D&prompt=select_account"... 2024-11-19 14:48:47.385 [info] [Axios Request] POST https://login.microsoftonline.com/common/oauth2/token?api-version=1.0 2024-11-19 14:48:47.652 [error] Cannot write headers after they are sent to the client 2024-11-19 14:49:39.819 [info] MSAL: [Tue, 19 Nov 2024 19:49:39 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:50:20.618 [info] Attempting to reach URL "https://login.microsoftonline.com/"... 2024-11-19 14:50:20.923 [info] MSAL: [Tue, 19 Nov 2024 19:50:20 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:50:21.140 [info] MSAL: [Tue, 19 Nov 2024 19:50:21 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:50:22.780 [info] MSAL: [Tue, 19 Nov 2024 19:50:22 GMT] : @azure/msal-node@1.14.6 : Info - getTokenCache called 2024-11-19 14:50:22.790 [info] Attempting to reach URL "https://login.microsoftonline.com/"... 2024-11-19 14:50:23.854 [info] Attempting to reach URL "https://vscode.dev/redirect"... 2024-11-19 14:50:23.854 [info] Attempting to reach URL "https://login.microsoftonline.com/common/oauth2/authorize?response_type=code&client_id=aebc6443-996d-45c2-90f0-388ff96faa56&redirect_uri=https%3A%2F%2Fvscode.dev%2Fredirect&state=http%3A%2F%2F127.0.0.1%3A51261%2Fcallback?nonce=wy99vLyYa9rGMW3ozYQoSA%3D%3D&prompt=select_account"... 2024-11-19 14:50:27.493 [info] MSAL: [Tue, 19 Nov 2024 19:50:27 GMT] : @azure/msal-node@1.14.6 : Info - acquireTokenByCode called 2024-11-19 14:50:27.797 [info] MSAL: [Tue, 19 Nov 2024 19:50:27 GMT] : [e6083b97-cbdc-49eb-8231-3903a520f095] : @azure/msal-common@9.0.2 : Info - in acquireToken call in auth-code client 2024-11-19 14:50:28.130 [error] Cannot write headers after they are sent to the client

alexweininger commented 1 week ago

Are you using any sort of proxy?

adambrubaker commented 1 week ago

I don't believe so. But that did get me thinking. I have never properly authenticated into a browser with this account on this machine. So I opened up https://entra.microsoft.com/ and signed in. Then tried to sign in through VSCode again and it worked! Not sure why but I am up and running again.

Thanks!

alexweininger commented 1 week ago

That's interesting... Thanks for the information.