Skip to content

Connect to Workspace Supports Tenant ID Resource Identifier#3303

Open
ScottCarda-MS wants to merge 6 commits into
mainfrom
sccarda/EntraIdAuth
Open

Connect to Workspace Supports Tenant ID Resource Identifier#3303
ScottCarda-MS wants to merge 6 commits into
mainfrom
sccarda/EntraIdAuth

Conversation

@ScottCarda-MS

@ScottCarda-MS ScottCarda-MS commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

This expands the ability of the Connect to Workspace feature to be able to consume resource identification strings containing tenant ids, in addition to being able to consume connection strings with API keys. When connecting to a resource with a resource identification string, the user will be authenticated with Entra ID.

@ScottCarda-MS ScottCarda-MS changed the title Sccarda/entra id auth Connect to Workspace Supports Tenant ID Resource Identifier Jun 10, 2026
@ScottCarda-MS ScottCarda-MS marked this pull request as ready for review June 10, 2026 20:47

@amcasey amcasey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems sensible. Minor suggestions

Comment thread source/vscode/src/azure/workspaceActions.ts Outdated
Comment thread source/vscode/src/azure/workspaceActions.ts Outdated
Comment thread source/vscode/src/azure/workspaceActions.ts
Comment thread source/vscode/src/azure/workspaceActions.ts Outdated
Comment thread source/vscode/src/azure/workspaceActions.ts

const workspaceAuth = await getAuthSession(
[scopes.quantum, `VSCODE_TENANT:${workspace.tenantId}`],
[scopes.quantum, `VSCODE_TENANT:${workspace.tenantId ?? ""}`],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't look right to me. Did you test this flow when this value is blank?

The VSCODE_TENANT scope, if provided here, has a specific value required for authenticating to the right tenant (see https://github.com/microsoft/vscode/blob/1.126.0/extensions/microsoft-authentication/src/common/scopeData.ts#L41 ). I would expect passing an empty string here would break it, so I'd be interested in how this was tested and the behavior your saw.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes this is the scenario we've had up until now, where tenant id is derived from subscription id. If a tenant id is provided, we use that, otherwise we use the subscription id to get the tenant id.

// needed for Entra ID auth and for building portal deep links. If it wasn't
// supplied in the connection string, derive it from the subscription id.
// This must happen before validation because the Entra ID auth path below
// (used whenever there is no API key) requires a tenant id.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Exactly (see other comment I just left). It should never just default to an empty string if missing. That would be invalid. It should throw an error if the tenantId is missing when trying to do Entra authentication.


return (
`tenantId=${workspace.tenantId}` +
`tenantId=${workspace.tenantId ?? ""}` +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same question here. Is it ever valid for a workspace portal link to have tenantId=""? If not, this should error, not build an invalid link.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tenant id is optional for now from the URI's we accept, but you are correct that by the time we reach this part of the code we should always have a tenant id. It is possible that something went wrong with getting the tenant id from the subscription id. I've added a check here that throws an error if that happens.
After the next sprint, we shouldn't have this complexity, as the portal will have made the switch to just using URIs with tenant id in them, so it can be fully mandatory then.

@billti billti mentioned this pull request Jun 28, 2026
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.

3 participants