Skip to content

Conversation

@motm32
Copy link
Contributor

@motm32 motm32 commented Sep 18, 2025

Fixes #1040

In the case of a user having both lighthouse and B2B access being granted, the same subscription can be under the same account but different tenants. In this case the session being used to list resources is incorrect since it doesn't include the tenant scope. By directly calling getSessionFromVSCode we are able to solve this issue.

To Do:

  • Release and update auth package changes
  • Make changes to how the same sub shows under the same account currently they have the same name:
image

Edit

When the same sub is from the same account the tenant id is shown instead:
image

Comment on lines 15 to 16
const session = await getSessionFromVSCode("https://management.azure.com//.default", subscription.tenantId, { createIfNone: false, silent: true, account: subscription.account })
const credential = createCredential(() => session);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a sneaking suspicion that this fixed scope is gonna come back to bite us

const subContext = createSubscriptionContext(subscription);
return await createResourceClient([context, subContext]);
async function createClient(subscription: AzureSubscription): Promise<ResourceManagementClient> {
const session = await getSessionFromVSCode("https://management.azure.com//.default", subscription.tenantId, { createIfNone: false, silent: true, account: subscription.account })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support other endpoints here

async function createClient(subscription: AzureSubscription): Promise<ResourceManagementClient> {
const session = await getSessionFromVSCode("https://management.azure.com//.default", subscription.tenantId, { createIfNone: false, silent: true, account: subscription.account })
const credential = createCredential(() => session);
const client = new ResourceManagementClient(credential, subscription.subscriptionId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to still be using createResourceClient. That adds a ton of extra stuff including support for the MFA challenges that we need.

@motm32
Copy link
Contributor Author

motm32 commented Sep 19, 2025

Talked offline but decided we may want to put these changes behind a setting so lighthouse users can opt in to this experience. Basically if we notice that there are multiple of the same subs under the same account a warning will pop up to turn the setting on. That way we can hopefully mitigate any bugs 🤪

@motm32 motm32 marked this pull request as ready for review September 26, 2025 20:32
@motm32 motm32 requested a review from a team as a code owner September 26, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resource list not showing all resources granted access via B2B and via lighthouse

4 participants