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

VSCodeAzureSubscriptionProvider.getSubscriptions return empty #1815

Open
jianyexi opened this issue Nov 11, 2024 · 4 comments
Open

VSCodeAzureSubscriptionProvider.getSubscriptions return empty #1815

jianyexi opened this issue Nov 11, 2024 · 4 comments
Labels

Comments

@jianyexi
Copy link

jianyexi commented Nov 11, 2024

When sign in with below code , the VSCodeAzureSubscriptionProvider.isSignedIn() return true,

vscode.authentication.getSession("microsoft", scopes, { createIfNone: true });

But the VSCodeAzureSubscriptionProvider.getSubscriptions() return empty, as below code will always return false. I think we need to improve the
VSCodeAzureSubscriptionProvider.isSignedIn method to handle the current signed tenantId in this case as well

if (!(await this.isSignedIn(tenantId))) {

@alexweininger
Copy link
Member

Hi @jianyexi, yes this seems like an issue we need to fix. Have you found a workaround yet or do you need me to investigate and unblock you? If you need, reach out to me on Teams.

@jianyexi
Copy link
Author

jianyexi commented Nov 18, 2024

Hi @jianyexi, yes this seems like an issue we need to fix. Have you found a workaround yet or do you need me to investigate and unblock you? If you need, reach out to me on Teams.

@alexweininger No, I can't find a workaround, I am considering to implement the function of listing subscriptions through the ARM Management SDK, but I will appreciate if it could be fixed in short time.

@alexweininger
Copy link
Member

@jianyexi
Copy link
Author

jianyexi commented Nov 21, 2024

@alexweininger no, The getSessionFromVSCode method returns null in my case because my extension logs in without specifying a tenantId. I propose the following fallback logic:

  1. Retrieve the tenantId from the account.Id.

  2. If the tenantId matches the subscription's tenantId, and no session with a specified tenantId is available,

  3. Fallback to obtaining a session without a tenantId.

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

No branches or pull requests

2 participants