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

Azure for Students: Cannot list subscriptions - only see "Select Subscriptions" after logging into Azure #797

Open saragibby opened 1 year ago

saragibby commented 1 year ago

Description

I'm on the Microsoft Audience Advocacy team where we work with students and those new to tech. While working with students we found the when using the Azure Resources VS Code extension to log into Azure with their Azure for Students account to deploy a resource, they will only see "Select Subscription". With no subscriptions listed to seelect, despite having an "Azure for Students" subscription tied to their account.

So far, we have encountered this only in Codespaces and vscode.dev. VS Code running locally will display the "Azure for Students" subscription in the list after logging into Azure.

Screenshots of the same GitHub account, GitHub repo and Azure for students account across all 3 editors:

vscode.dev

With "Failed to refresh access token" message at bottom: image

Codespaces

With "Failed to refresh access token" message at bottom: image (1)

VS Code running locally

image (2)

Impact

Currently preventing us for working with students on scenarios deploying to Azure from Codesapces and vscode.dev, as our typically first step to introduce Azure is through a VS Code deployment or connection.

VS Code Version:

vscode.dev

image

Codespaces

image

VS Code locally

image

Version / Account

Does your account belong to more than one directory? (see your directories here):

Any other information about your Azure account that may be useful: Happening across all Azure for Students accounts that we tested, and many regular Azure accounts

Reproducing

This also happened during a line Reactor event with @juliamuiruri4. Recording can be found here to follow exact steps we took - https://www.youtube.com/live/85HHu5KGYUM?feature=share&t=2284 The only thing not included was logging into GitHub and Azure portal in the private browser before the session started.

saragibby commented 1 year ago

UPDATE

Bug is still occurring in both Codespaces and vscode.dev when logging in with Azure for Students account using the with following updated versions:

@alexweininger let me know if there is anything I can do to help with this one. Be great to get our students unblocked. Thanks!

fiveisprime commented 1 year ago

Is there a reason why subscriptions are hidden until clicked in the web experience? That happens for my account as well so maybe just showing the full list would avoid this issue altogether?

alexweininger commented 1 year ago

@saragibby Can you share the logs from the Microsoft Authentication Output channel after you encounter the error? Make sure to redact any PII.

image
alexweininger commented 1 year ago

Is there a reason why subscriptions are hidden until clicked in the web experience? That happens for my account as well so maybe just showing the full list would avoid this issue altogether?

@fiveisprime Are you forced to select subscriptions every time you open the web experience? If so, that sounds like a different issue, unrelated to Azure for Students.

alexweininger commented 1 year ago

I can reproduce this issue and I can see some errors in the Microsoft Authentication log channel. I've attached the logs below. AzureForStudents.log

fiveisprime commented 1 year ago

Is there a reason why subscriptions are hidden until clicked in the web experience? That happens for my account as well so maybe just showing the full list would avoid this issue altogether?

@fiveisprime Are you forced to select subscriptions every time you open the web experience? If so, that sounds like a different issue, unrelated to Azure for Students.

Only on the first sign-in. All subsequent sign-ins from the same instance show the subscriptions. But I demo a lot and it's always a new instance so I see it a lot 🫠

alexweininger commented 1 year ago

Only on the first sign-in. All subsequent sign-ins from the same instance show the subscriptions. But I demo a lot and it's always a new instance so I see it a lot 🫠

What do you mean by new instance? New tab? New browser session?

fiveisprime commented 1 year ago

New browser session

saragibby commented 1 year ago

@alexweininger @fiveisprime subscriptions never load, even when clicked. When clicked there is an error in the prompt at bottom right "Failed to refresh access token".

So both in vscode.dev and Codespaces those with Azure for Students accounts are blocked from even getting to Azure, as they hit the error and no subscriptions ever load

The log in both is near identical: vscodedev-codespaces-azure.log

saragibby commented 1 year ago

Here is screen recording from vscode.dev: https://github.com/microsoft/vscode-azure-account/assets/82035/71b39690-f01e-46b3-9148-5e2fc981d2f1

alexweininger commented 1 year ago

@saragibby

I was able to successfully login with my Azure for Students account by clicking on the "Sign in with Microsoft to use Azure Resources (1)" option within the Accounts menu. Can you see if this works for you?

image
saragibby commented 1 year ago

@alexweininger I was able to get my subscriptions to load using the "Sign in with Microsoft to use Azure Resources (1)" option.

Here are the steps I followed (using my test student GitHub account and test student Azure account):

  1. Create Codespace for one of my repos (one I used - https://github.com/bgibbons3/my-portfolio)
  2. Sign into Azure using the "Sign in to Azure..." link in the Azure blade ("Sign in with Microsoft to use Azure Resources (1)" option not available until after I signed in)
  3. Click "Select Subscriptions..." in Azure blade, which gives me "Failed to refresh access token" error" and then loads the "Sign in with Microsoft to use Azure Resources (1)" option in the Account menu
  4. Click "Sign in with Microsoft to use Azure Resources (1)" and authenticate a second time
  5. Click "Select Subscriptions..." and then I see my single subscription ("Azure for Students") loads for me to use.

After that, I'm able to view/create/interact with all my Azure resources.

Note: the above steps are the same in vscode.dev and insiders.vscode.dev.

alexweininger commented 1 year ago

I've verified that this issue is fixed in the current insiders release 1.80.0-insider. Try it out on insiders.vscode.dev

saragibby commented 1 year ago

Thanks @alexweininger! Verified with my Azure for Students account that I was able to connect to Azure, and select my "Azure for Students" subscription without going through the additional "Sign in with Microsoft to use Azure Resources (1)" link and auth.

Is there a rough idea yet when 1.80.0 will be promoted to production (vscode.dev)?

alexweininger commented 1 year ago

According to https://github.com/microsoft/vscode/issues/184844 it should be on or around June 30th.

saragibby commented 1 year ago

Update

Tested this with the following extension versions: Azure Static Web Apps - 12.2.2 Azure Resources - 0.7.5

Was able to connect to my Azure for Students account on Codespaces, and vscode.dev on Chrome.

However, on vscode.dev (1.80.1) and insiders.vscode.dev (1.81.0-insider) I got the same "Failed to refresh access token." error message in the bottom right prompt while using Edge and Brave browsers.

(tag @alexweininger)

fouchekeagan commented 2 months ago

I'm having the same issue with Mac Ventura 13.2.1, I am signed into Azure with 2 different accounts and it fails to list the subscriptions for the different accounts. I have to sign out and close all IDE instance, then start up and sign in again with the other account, close all instances and then it'll show the new subscription. Super painful and lengthy.

Azure Resource extension version 0.9.5

VS Code details: Version: 1.93.1 (Universal) Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 Date: 2024-09-11T17:20:05.685Z Electron: 30.4.0 ElectronBuildId: 10073054 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Darwin arm64 22.3.0