microsoft / vscode-azure-account

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

[Codespaces] `Azure: Authentication Library` setting reverts automatically after being changed in User Settings #482

Open v-mengwe opened 2 years ago

v-mengwe commented 2 years ago

OS: Codespaces Build Version: v0.10.0 Regression: Not a regression

Repro Steps:

  1. Install the Azure Account extension in VS Code -> The "Azure: Authentication Library" setting is "ADAL".
  2. Set the "Azure: Authentication Library" setting to "MSAL".
  3. Check whether the notification 'You must sign out and reload the window to authenticate with "MSAL"' pops up.

Expect: The notification 'You must sign out and reload the window to authenticate with "MSAL"' pops up. image

Actual: The notification 'You must sign out and reload the window to authenticate with "MSAL"' does not pop up.

More Info:

  1. This issue only reproduces on Remote/Local codespaces.
  2. The "Azure: Authentication Library" setting returns to "ADAL" when clicking anywhere with the mouse.
wwlorey commented 2 years ago

@v-mengwe that notification will only be shown if the extension has been activated and you change the auth library setting. Is the Azure View open when you change this setting? Or has the extension not activated yet? In my testing the notification is shown on Codespaces once the extension is activated.

The "Azure: Authentication Library" setting returns to "ADAL" when clicking anywhere with the mouse.

This concerns me. I'm not able to repro it but could you describe this behavior some more?

v-mengwe commented 2 years ago

I'm sorry for missing a detail, the step 2 is to set the "Azure: Authentication Library" setting to "MSAL" for "User", not "Remote [Codespaces]". This should be the reason why it cannot be reproduced. image

What is the difference between "User" and "Remote [Codespaces]"? Can you help share?

wwlorey commented 2 years ago

No worries, @v-mengwe. I looked into this using the latest commit (af40115544e7ef52c38d97df332a1b09122ac1a7) and saw that the Azure: Authentication Library setting is not available in user settings on Codespaces in the browser. It only appears in remote settings for me:

User Settings

Screen Shot 2022-02-28 at 11 41 21 AM

Remote Settings

Screen Shot 2022-02-28 at 11 41 25 AM

We added the machine-overridable scope to the auth library setting here which limits that setting to the current machine (i.e. prevents settings sync).

machine-overridable - Machine specific settings that can be overridden by workspace or folder settings. (source)

It appears that Codespaces interprets that scope to mean "don't allow this setting to be changed in user settings on Codespaces".

Can you verify that those screenshots were taken using the latest build? I believe the Azure: Authentication Library settings should only show up in user settings on Codespaces prior to this commit: a030d48803380027fddd87733b7bbef3f7cb77b9

v-mengwe commented 2 years ago

Verified on the latest build 20220228.1. User Settings The "Azure: Authentication Library" setting returns to "ADAL" when clicking anywhere with the mouse. acc

Remote Settings The notification 'You must sign out and reload the window to authenticate with "MSAL"' pops up when changing the setting from "ADAL" to "MSAL". ac

wwlorey commented 2 years ago

I tried again with build 20220228.1 on a freshly created Codespace in both Brave and Edge and I still don't see the Azure: Authentication Library setting in user settings. It does show up in remote settings though.

Screen Shot 2022-03-01 at 3 14 04 PM Screen Shot 2022-03-01 at 3 14 09 PM

This was still the case after I enabled settings sync.

I see the auth library setting in user settings when I revert to a build prior to commit https://github.com/microsoft/vscode-azure-account/commit/a030d48803380027fddd87733b7bbef3f7cb77b9 such as 20220210.20. Is it possible that the version of Azure Account installed in that Codespace is outdated? If not we potentially need to investigate why in some cases that setting is appearing in user settings.

v-mengwe commented 2 years ago

I found a very strange phenomenon, the user settings display "No Settings Found" when typing "Azure: Authentication Library" to search, but the "Azure: Authentication Library" dispalys by expanding the user settings. ac1

wwlorey commented 2 years ago

Excellent find, @v-mengwe! I'm able to repro the issue now.

This is a Codespaces problem and I don't think that setting should even be shown for user settings. We'll discuss what to do with this issue in triage today.

wwlorey commented 2 years ago

Tracking in https://github.com/microsoft/vscode/issues/145079