-
Notifications
You must be signed in to change notification settings - Fork 48
Ensure correct session is being used when listing resources #1241
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
base: main
Are you sure you want to change the base?
Conversation
| const session = await getSessionFromVSCode("https://management.azure.com//.default", subscription.tenantId, { createIfNone: false, silent: true, account: subscription.account }) | ||
| const credential = createCredential(() => session); |
There was a problem hiding this comment.
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 }) |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
|
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 🤪 |
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
getSessionFromVSCodewe are able to solve this issue.To Do:
Edit
When the same sub is from the same account the tenant id is shown instead:
