Skip to content

Support Entra ID sign-in in sovereign clouds and explain sign-in failures - #1050

Draft
Tomasz Naumowicz (tnaum-ms) wants to merge 50 commits into
mainfrom
dev/tnaum/gov-clouds
Draft

Tomasz Naumowicz (tnaum-ms) wants to merge 50 commits into
mainfrom
dev/tnaum/gov-clouds

Conversation

@tnaum-ms

Copy link
Copy Markdown
Collaborator

What changed

Microsoft Entra ID connections to Azure DocumentDB now work with the Azure cloud VS Code is signed in to (Azure US Government, Azure China, custom clouds), and sign-in failures get actionable explanations.

  • Cloud-aware token audience. The extension used to always request the public-cloud resource https://ossrdbms-aad.database.windows.net. It now requests the open-source database resource of the selected cloud (microsoft-sovereign-cloud.environment): …usgovcloudapi.net for US Government, …chinacloudapi.cn for China. Public-cloud behavior is unchanged (tests pin the scope string).
  • Custom clouds resolve the resource from the new documentDB.customEnvironment.ossrdbmsEndpoint setting, the custom cloud's sign-in host, or its ARM metadata (/metadata/endpoints?api-version=2022-09-01), and fail clearly otherwise. They never fall back to the public audience.
  • Cloud mismatch check. If the cluster's domain (azure.com, azure.us, azure.cn) belongs to another cloud than the one VS Code is signed in to, the extension stops before sign-in and names the setting to change.
  • Managed identity takes the cloud from the override, the cluster host, then the VM's instance metadata, not from the VS Code sign-in setting.
  • Shell and playground resolve the scope on the main thread; the worker no longer chooses it. Copy Connection String writes the matching TOKEN_RESOURCE.
  • Entra error classifier. One rule table (src/documentdb/auth/entraErrors/entraErrorRules.ts) maps AADSTS codes and the opaque Windows broker error to messages that say who can fix the problem. It plugs into ConnectionDiagnosticsService, so every surface that already explains connection errors gets it.
  • Support tracing. Every Entra connection logs entraCloud.resolved (cloud, sign-in provider, broker mode, host cloud, chosen token resource and why), with no tenant, account, host, or connection-string values.
  • Docs. New user-manual page docs/user-manual/sovereign-clouds.md.

Why

A reported issue: in Azure US Government, listing resources works but connecting with Entra ID fails with AADSTS65002. Two causes:

  1. VS Code's client is not yet preauthorized for the OSS RDBMS resource in that cloud. This is a service-side configuration change outside this repository, and it is in progress. Precedents: [Bug]: Sovereign Cloud Universal with MFA Support auth error vscode-mssql#22296, VS Code Could not login to Azure vscode#244689.
  2. The extension always requested the public-cloud audience. This PR fixes that part and makes the first one diagnosable.

Rejected alternatives (own client ID, falling back to the public audience, buttons on diagnostics) and the reasoning are in decisions.md.

Scope

Not in this PR: the service-side preauthorization; buttons on diagnostic messages (Report issue, Switch cloud); an ask-once prompt for custom clouds.

Validation

  • npm run build and targeted Vitest (auth, shell, playground, services, copy connection string, settings) pass.
  • Not verified end to end: nobody on the team has sovereign-cloud access. US Government sign-in cannot succeed until the service-side configuration rolls out. A preview build will be shared with the reporter then.
  • Before shipping (D11): check telemetry for successful Entra connections to *.azure.cn hosts, so the switch to the China audience cannot break existing users.
  • Draft: the full Case 2 checks (l10n, prettier-fix, lint, typecheck:tests, full Vitest, package) are deferred until ready for review. The AI pre-review has not run yet.

Links

Record the investigation of Entra ID sign-in failures (AADSTS65002) in
Azure US Government: the client and resource app IDs, why preauthorization
is fixed outside the extension, the opaque broker error, per-cloud OSSRDBMS
audiences published in ARM metadata, and how other extensions handle
sovereign clouds.

Add decisions and the iteration plan for a cloud-aware DocumentDB token
audience (interactive, managed identity, custom clouds) and a single-table
Entra error classifier routed through ConnectionDiagnosticsService.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ity flows

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nces

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: full tier (full run requested by Tomasz Naumowicz (@tnaum-ms) for 7f2a288)

Commit 7f2a288, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ✅ passed full run requested
VSIX: inspect contents ✅ passed full run requested
VSIX: self-test of the checks ✅ passed full run requested
VSIX: activate in VS Code ✅ passed full run requested
VSIX: self-test of the activation check ✅ passed full run requested
Webview host in unbundled extensions ✅ passed full run requested
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Code quality

Check Status How to fix
Localization (l10n) ✅ Passed Nothing to fix
ESLint ✅ Passed Nothing to fix
Prettier formatting ✅ Passed Nothing to fix

Build size

No page, activation, VSIX or other bundle size changed by 5% or 50 KiB or more against main. VSIX: 8.5 MiB.

Artifacts: VSIX | Bundle-reports-40388721389 | L1-manifest-report-40388721389

All graphs (exact bytes)
Graph PR bytes Base bytes Delta bytes Delta %
Collection View page (collectionView) 6,036,286 6,036,286 ✅ 0 0.0%
Document View page (documentView) 4,808,762 4,808,762 ✅ 0 0.0%
Local Quick Start page (localQuickStart) 1,551,408 1,551,408 ✅ 0 0.0%
Atlas Credentials page (atlasCredentials) 1,504,612 1,504,612 ✅ 0 0.0%
Cluster Dashboard page (clusterDashboard) 1,550,863 1,550,863 ✅ 0 0.0%
Activation (mainStartup) 3,472,062 3,448,763 ⬆️ +23,299 +0.7%
Extension host (main) 9,998,788 9,975,455 ⬆️ +23,333 +0.2%
Playground worker (playgroundWorker) 5,385,471 5,384,556 ⬆️ +915 +0.0%
VSIX (vsix) 8,948,779 8,941,533 ⬆️ +7,246 +0.1%
playgroundTsPlugin 6,175 6,175 ✅ 0 0.0%
viewsEntry 1,456,593 1,456,593 ✅ 0 0.0%
viewsAssets 80,340 80,340 ✅ 0 0.0%
editorWorker 259,528 259,528 ✅ 0 0.0%
jsonWorker 389,389 389,389 ✅ 0 0.0%

Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up.

Updated in place on every run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Oct 23, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Oct 23, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the startup join with successful metadata observations across historical releases. Record the enhancement review disposition and retain the R9 completion note.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…andoff

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026
@github-actions github-actions Bot removed the ci:full-requested Requests a full run of CI checks. label Oct 26, 2026

This branch has not been deployed

No deployments
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.

1 participant