Skip to content

Open Azure resources and the dashboard or shell from deep links (/connect/azure, open=) - #1067

Merged
Tomasz Naumowicz (tnaum-ms) merged 87 commits into
mainfrom
dev/tnaum/url-handler-improvmements
Nov 11, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 87 commits into
mainfrom
dev/tnaum/url-handler-improvmements

Conversation

@tnaum-ms

@tnaum-ms Tomasz Naumowicz (tnaum-ms) commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

Links can now open an Azure DocumentDB cluster or an Azure Cosmos DB for MongoDB (RU) account by its Azure resource ID, and any /connect link can ask for the Cluster Dashboard or the shell.

vscode://ms-azuretools.vscode-documentdb/connect/azure?resourceId=<ARM id>[&tenantId=<guid>][&database=<db>][&collection=<coll>][&open=dashboard|shell][&source=publisher-label]
vscode://ms-azuretools.vscode-documentdb/connect?connectionString=<cs>[&database=<db>][&collection=<coll>][&open=dashboard|shell][&source=publisher-label]

This is what an Azure portal Open in VS Code button needs: the portal knows the resource ID, but often cannot hand over a connection string.

Telemetry and publisher attribution

Every route, including legacy links and /local, accepts an optional source publisher tag, for example source=azure-portal or source=docs-quickstart. Tags are normalized to lowercase and limited to 1-64 ASCII letters, digits, hyphens or underscores, starting with a letter or digit. Invalid or repeated tags are ignored with a diagnostic warning and never echoed. This attribution tag is independent of the connection source named by the path.

Telemetry now records arrival and terminal outcomes with a unique link correlation ID, explicit cancellations and non-throwing failures, connection/startup and destination-session joins, phase timings, and filter changes actually applied rather than only needed. Shell, dashboard, Collection View and Local setup preserve URL attribution into destination activity. A completed link means navigation/opening completed; correlated shell startup and webview/RPC results establish readiness. Dashboard reuse keeps the original session attribution and records the join for the new link.

Why

/connect only understood connection strings. A portal link has a resource ID instead, and the user may not be signed in to Azure, may be signed in to the wrong tenant, or may have the resource hidden by a filter. The link handles all of these instead of failing.

How it behaves

/connect/azure, in order:

  1. Validates the resource ID (Microsoft.DocumentDB/mongoClusters → vCore, Microsoft.DocumentDB/databaseAccounts → RU). Anything else, child resources included, is refused.

  2. Shows a confirmation right away (when URL handling confirmations are on), before any sign-in or lookup. It shows what the link names: resource, resource group, subscription ID, database, collection, and what will open.

  3. Asks the user to sign in to Azure if needed. It then finds the subscription among all signed-in accounts. If none has it and the link carries tenantId, it offers to sign in to that tenant; otherwise it shows an error with Manage Azure accounts.

  4. Reads the resource from Azure with the user's identity, so a missing resource, missing access, or an RU account that does not use the MongoDB API is reported before anything changes.

  5. If the resource is hidden, changes the filters permanently: shows the hidden discovery provider, stops hiding the tenant, and adds the subscription to the subscription filter. That filter is the azureResourceGroups.selectedSubscriptions setting shared with the Azure Resources extension. A second confirmation lists these changes first; it appears only when a filter has to change.
    From the first confirmation until the cluster is revealed, one cancellable progress notification, "Opening Azure resource", names each step without repeating long resource names (checking sign-in, looking for the subscription, reading the resource, updating filters, finding the cluster, connecting).

  6. Reveals the cluster in the Discovery view and expands it. The expansion is the normal connect flow (Entra ID or the credentials prompt). Nothing is saved to the Connections View.

  7. Navigates to the database or collection and opens the Collection View, Cluster Dashboard or shell.

open=, on both /connect and /connect/azure:

  • dashboard opens the Cluster Dashboard, scoped to database when given. It opens even when the automatic dashboard on connect is turned off, and reuses the panel if it already opened. Telemetry records activationSource: 'deepLink'.
  • shell opens the interactive shell, scoped to database when given. A link never passes anything to the shell as input.
  • open together with collection is refused.

Stricter validation. Each variant accepts only its own locator. A connectionString on /connect/azure, or a resourceId/tenantId on /connect, is refused. Unknown sources such as /connect/aws are refused instead of falling back to the connection-string flow. Legacy links with no path keep working unchanged.

Fewer questions on /connect. A new connection now asks once, "Add and open connection?", which names the target and what opens (still shown even with confirmations off). A saved connection asks once, "Open connection?", only when confirmations are on. Before, a link with a collection asked up to three times. The TLS question is unchanged (D0017).

Dialogs. Every deep-link confirmation, on both /connect and /connect/azure, has a short title that names the decision ("Sign in", "Add and open connection?", "Open Azure resource?", "Change filters?"). The explanation is in the dialog body.

After a failed or cancelled connection. If the expansion does not connect, the link stops after the node has shown what went wrong: no Collection View, dashboard or shell opens, on both /connect and /connect/azure. Pressing Cancel on "Opening Azure resource" also stops anything from opening, although the tree may finish expanding.

Logging. Each link writes one info line to the DocumentDB output channel with the action, the source, the names of the supported parameters present, and a count of any other parameters (their names are never logged, because a malformed link can put a password in a parameter name). This is followed by trace lines for every step (confirmations and choices, sign-in, subscription lookup, filter changes, reveal, connect result, what opened, failure stage). Parameter values, connection strings and Azure IDs are never logged.

Encoding. The public guide now explains that every parameter value is decoded twice. It shows how database and collection names with spaces, &, + or non-ASCII letters must be double-encoded, with JavaScript, Python and PowerShell snippets. Tests pin this behaviour.

Scope

Not in this PR:

  • Release notes (added later by the release-notes agent).
  • Agreeing the link with the Azure portal team (operator).
  • Other sources such as /connect/kubernetes or /connect/atlas, sovereign clouds (a link has no cloud hint), and suppressing the automatic dashboard when a link asks for something else.
  • The telemetry dashboard pages still show activationSource: 'deepLink' as "Other" (cluster-dashboard.cjs, feature-adoption.cjs, event-catalog.md); they live in the dashboards work.

Validation

  • Unit tests for every new module and the handler: routing, argument refusals, masking, resource ID parsing, sign-in and tenant resolution, ARM error mapping, filter changes, confirmation content, Discovery view reveal, and opening each surface. The review fixes add tests for warm-tree lookups, provider-root recovery, log allow-listing, cancellation, masking and subscription casing.

  • Still needs a human: the manual table in the iteration 3 plan, against a real subscription with a vCore cluster and an RU account. It covers signed out, wrong tenant with and without tenantId, hidden subscription, tenant or provider, confirmations off, Entra ID and native auth, open=dashboard with the setting on and off, open=shell, and legacy links. From the review, also: click the same database or collection link twice (F1), and follow a link after expanding the Azure provider while signed out or with every subscription filtered out (F2).

  • AI pre-review: iterations/03-azure-resource-links-review.md. Two models reviewed the PR independently and cross-checked each other's findings: 7 confirmed findings plus one unconfirmed candidate. The maintainer accepted a pragmatic fix for seven of them (F1, F2, F4–F8, one commit each) and won't fix F3, the unconfirmed multi-account case. Done notes with commit links are inline in that file.

  • Case 2 checks (2026-11-06, telemetry follow-up): passed npm run prettier-fix, npm run l10n:check, npm run lint, npm run build, npm run typecheck:tests (reported separately from runtime tests), npx vitest run (336 files; 5,902 passed, 1 skipped), and npm run package. npm run l10n was not needed for this follow-up because no localized string changed; localization validation passed. Fixed lint import annotations and a test assertion for the new startup callback. Two terminal-width tests timed out while build/lint competed for CPU; the complete suite passed when rerun alone.

  • Telemetry follow-up pre-review: the committed AI review above predates the new source/outcome/correlation instrumentation. A current committed review and author decisions for this follow-up remain a human-handoff requirement. Live telemetry ingestion/GDPR classification is not established by these local checks.

Links

…ough the expansion (WI8, D0015)

reveal(..., { expand: true }) awaits the node's children, so the expansion runs the
connect flow once and the node stays expanded after a failure or cancel.

Co-authored-by: Copilot <[email protected]>
…ource ID values

Backs the encoding rules in the public URL guide.

Co-authored-by: Copilot <[email protected]>
…th examples

Database and collection names with spaces, &, + or non-ASCII letters break when
encoded once; the guide now says so and shows how to build links in code.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit 31bb7b7, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ⏭️ skipped no change to packages/**, package-lock.json or the CI workflow
VSIX: inspect contents ✅ passed ready PR
VSIX: self-test of the checks ⏭️ skipped no change to build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow
VSIX: activate in VS Code ✅ passed ready PR
VSIX: self-test of the activation check ⏭️ skipped no change to build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow
Webview host in unbundled extensions ⏭️ skipped no change to packages/vscode-ext-webview/**, package-lock.json or the CI workflow
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
No full run yet.

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.6 MiB.

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

All graphs (exact bytes)
Graph PR bytes Base bytes Delta bytes Delta %
Collection View page (collectionView) 6,037,190 6,037,190 ✅ 0 0.0%
Document View page (documentView) 4,809,693 4,809,693 ✅ 0 0.0%
Local Quick Start page (localQuickStart) 1,556,884 1,556,884 ✅ 0 0.0%
Atlas Credentials page (atlasCredentials) 1,510,086 1,510,086 ✅ 0 0.0%
Cluster Dashboard page (clusterDashboard) 1,551,798 1,551,798 ✅ 0 0.0%
Diagnose Connection page (connectionDiagnostics) 1,532,497 1,532,497 ✅ 0 0.0%
Activation (mainStartup) 3,761,731 3,727,270 ⬆️ +34,461 +0.9%
Extension host (main) 10,289,238 10,254,777 ⬆️ +34,461 +0.3%
Playground worker (playgroundWorker) 5,397,038 5,397,038 ✅ 0 0.0%
VSIX (vsix) 9,048,834 9,041,146 ⬆️ +7,688 +0.1%
playgroundTsPlugin 6,175 6,175 ✅ 0 0.0%
viewsEntry 1,457,524 1,457,524 ✅ 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.

…n lookup

The confirmation waited for Azure sign-in, the subscription listing across all
accounts and the ARM read, so it appeared long after the click. It now shows
right after the link is parsed, with what the link carries. Filter changes,
known only after the lookup, keep their own confirmation before they apply.

Co-authored-by: Copilot <[email protected]>
One info line per link names the action, the source and the parameters present;
trace lines follow each step. Parameter values, connection strings and Azure IDs
are never logged.

Co-authored-by: Copilot <[email protected]>
…e detail

Every deep-link confirmation had a full sentence as its title. Titles now name the
decision ("Sign in", "Add connection?", "Open Azure resource?"), and the
explanation is the first line of the detail. Buttons and flow are unchanged.

Co-authored-by: Copilot <[email protected]>
…otification

After the user confirmed an Azure link, nothing was visible while the extension
checked sign-in, listed subscriptions, read the resource and found the cluster.
One notification now names each step, replaces the reveal helper's own
notification, and can be cancelled between steps.

Co-authored-by: Copilot <[email protected]>
The notification shows title and step on one line, and a long cluster name
appeared in both. The title is now "Opening from Azure" and steps name no
resource, database or collection.

Co-authored-by: Copilot <[email protected]>
A new connection with a collection asked to add it, to open it, and to open the
Collection View, each repeating the same target. One always-shown "Add and open
connection?" now names the target and what opens; a saved connection gets one
"Open connection?" when confirmations are on. The TLS question is unchanged.

Co-authored-by: Copilot <[email protected]>
Add optional source tags and correlate arrivals, connection attempts, destination sessions, cancellations, failures, phase timings and filter changes so published links can be measured end to end. Document the telemetry contract and cover it with regression tests.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Overlapping dashboard links can release shared suppression before all owners finish, allowing an automatic dashboard to open during another link’s expansion.

8 open issues
What changed in this PR

Adds Azure resource-ID deep links for Azure DocumentDB and Azure Cosmos DB for MongoDB (RU), plus explicit dashboard/shell destinations and publisher-attributed telemetry across connection and destination sessions.

Changes:

  • Adds Azure resource validation, sign-in and subscription resolution, visibility updates, and Discovery navigation.
  • Propagates link correlation, connection outcomes, and attribution through commands, shells, webviews, and Local setup.
  • Centralizes connection-failure diagnostics and expands tests and deep-link documentation.

This pull request requires changes. Unresolved findings affect dashboard suppression, cancellation, navigation, filter persistence, attribution, logging, and test coverage. Live Azure/workbench validation also remains pending.

File Description
src/​webviews/​documentdb/​localQuickStart/​wizardTelemetry.ts Adds link attribution to wizard step and close events.
src/​webviews/​documentdb/​localQuickStart/​localQuickStartController.ts Passes attribution into wizard sessions and RPC context.
src/​webviews/​documentdb/​collectionView/​collectionViewController.ts Adds attribution to Collection View context.
src/​webviews/​documentdb/​clusterDashboard/​clusterDashboardController.ts Stores originating attribution for dashboard sessions.
src/​webviews/​documentdb/​clusterDashboard/​clusterDashboardController.test.ts Tests attribution preservation during panel reuse.
src/​webviews/​_integration/​trpc.ts Adds link attribution to RPC telemetry.
src/​webviews/​_integration/​trpc.test.ts Tests RPC attribution on success and failure.
src/​webviews/​_integration/​appRouter.ts Attributes webview-reported events and errors.
src/​tree/​TreeParentCache.ts Adds cached direct-child enumeration.
src/​tree/​TreeParentCache.test.ts Tests child enumeration and cache pruning.
src/​tree/​documentdb/​ClusterItemBase.ts Tracks connection outcomes and startup IDs; checks dashboard suppression.
src/​tree/​documentdb/​ClusterItemBase.test.ts Tests suppression and startup callback wiring.
src/​tree/​documentdb/​autoOpenDashboardSuppression.ts Adds cluster-scoped automatic-dashboard suppression.
src/​tree/​documentdb/​autoOpenDashboardSuppression.test.ts Tests suppression lifecycle and cluster isolation.
src/​tree/​discovery-view/​discoveryViewHelpers.ts Reveals Azure clusters and navigates to requested databases or collections.
src/​tree/​connections-view/​LocalQuickStart/​LocalQuickStartItem.credentials.test.ts Updates startup callback expectations.
src/​tree/​connections-view/​DocumentDBClusterItem.ts Records cancellation and uses shared failure diagnostics.
src/​tree/​connections-view/​connectionsViewHelpers.ts Adds folder-aware navigation and connection-attempt tracking.
src/​tree/​connections-view/​connectionsViewHelpers.test.ts Tests nested paths and failed-node recovery.
src/​tree/​BaseExtendedTreeDataProvider.ts Exposes cached children without fetching.
src/​tree/​azure-resources-view/​mongo-ru/​RUCoreResourceItem.ts Uses shared first-connect failure diagnostics.
src/​tree/​azure-resources-view/​documentdb/​VCoreResourceItem.ts Uses shared first-connect failure diagnostics.
src/​plugins/​service-kubernetes/​discovery-tree/​documentdb/​KubernetesResourceItem.ts Routes connection failures through shared diagnostics before cleanup.
src/​plugins/​service-azure-vm/​discovery-tree/​vm/​AzureVMResourceItem.ts Uses shared diagnostics with VM-specific fallback wording.
src/​plugins/​service-azure-mongo-vcore/​discovery-tree/​documentdb/​DocumentDBResourceItem.ts Records prompt cancellation and translates connection failures.
src/​plugins/​service-azure-mongo-ru/​discovery-tree/​documentdb/​MongoRUResourceItem.ts Records cancellation and uses shared failure diagnostics.
src/​plugins/​service-atlas-mongodb/​discovery-tree/​AtlasClusterItem.ts Uses shared diagnostics for generic connection failures.
src/​documentdb/​srv/​SrvDnsDiagnosticsProvider.ts Adjusts quotation formatting in DNS guidance.
src/​documentdb/​showClusterConnectFailure.ts Centralizes diagnostic-aware first-connect failure dialogs.
src/​documentdb/​showClusterConnectFailure.test.ts Tests diagnoses, fallback text, buttons, and sequencing.
src/​documentdb/​shell/​DocumentDBShellPty.ts Attributes shell lifecycle events and instruments startup outcomes.
src/​documentdb/​shell/​DocumentDBShellPty.test.ts Tests link attribution during shell startup.
src/​documentdb/​ClustersClient.ts Exposes startup correlation IDs through a callback.
src/​documentdb/​ClustersClient.test.ts Tests startup correlation delivery on failure.
src/​documentdb/​auth/​urlEncodedPassword.ts Integrates shared diagnostics into decoded-password retry prompts.
src/​documentdb/​auth/​urlEncodedPassword.test.ts Tests diagnostics alongside password-retry guidance.
src/​documentdb/​auth/​entraErrors/​entraErrorRules.ts Clarifies authentication workaround wording.
src/​documentdb/​auth/​entraErrors/​EntraDiagnosticsProvider.test.ts Updates authentication guidance assertions.
src/​deepLinks/​handleAzureResourceLink.ts Orchestrates Azure confirmations, progress, lookup, filters, and reveal.
src/​deepLinks/​deepLinkTelemetry.ts Defines attribution, outcomes, correlation, and phase timing.
src/​deepLinks/​deepLinkTelemetry.test.ts Tests source validation and telemetry helpers.
src/​deepLinks/​azureVisibility.ts Computes and applies persistent visibility changes.
src/​deepLinks/​azureVisibility.test.ts Tests filter preservation and applied-change tracking.
src/​deepLinks/​azureSubscription.ts Resolves subscriptions and manages sign-in prompts.
src/​deepLinks/​azureSubscription.test.ts Tests account resolution and sign-in branches.
src/​deepLinks/​azureResourceLink.ts Parses and validates supported ARM resource IDs and tenant hints.
src/​deepLinks/​azureResourceLink.test.ts Tests resource types, casing, and malformed IDs.
src/​deepLinks/​azureResource.ts Reads Azure resources and translates ARM failures.
src/​deepLinks/​azureResource.test.ts Tests resource reads, API validation, and error mapping.
src/​commands/​openInteractiveShell/​openInteractiveShell.ts Accepts link attribution and returns shell-opening/session results.
src/​commands/​openInteractiveShell/​openInteractiveShell.test.ts Tests attributed shell opens and returned session IDs.
src/​commands/​openCollectionView/​openCollectionView.ts Records collection-session identity and forwards attribution.
src/​commands/​openCollectionView/​openCollectionView.test.ts Tests session correlation and attribution forwarding.
src/​commands/​openClusterDashboard/​openClusterDashboard.ts Returns opening outcomes and dashboard-session joins.
src/​commands/​localQuickStart/​openLocalQuickStart.ts Forwards link attribution to Local setup.
src/​commands/​localQuickStart/​openLocalQuickStart.test.ts Updates webview invocation assertions.
docs/​user-manual/​how-to-construct-url.md Documents Azure links, destinations, attribution, and encoding.
docs/​ai-and-plans/​README.md Adds the deep-links feature index entry.
docs/​ai-and-plans/​features/​deep-links/​README.md Records architecture, telemetry contracts, and verification gaps.
docs/​ai-and-plans/​features/​deep-links/​iterations/​03-azure-resource-links-research.md Documents reference implementations and design research.
docs/​ai-and-plans/​features/​deep-links/​decisions.md Records Azure routing, visibility, confirmation, and destination decisions.
.github/​skills/​error-translation/​SKILL.md Documents first-connect diagnostics and cleanup ordering.

Review effort: Max

Comment thread src/deepLinks/azureSubscription.ts Resolved
Comment thread src/deepLinks/azureVisibility.ts Resolved
@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Preserved the eight Copilot threads and the operator-approved verification/recommendations in commit 36abe5e. The supplement uses CP-F IDs to distinguish this pass from the earlier review. Following the recommended five fixes and two explicit out-of-scope dispositions; automated verification will include both Case 1 and Case 2.

Addresses CP-F5; regression coverage verifies no descendant lookup after cancel.

Co-authored-by: Copilot <[email protected]>
Addresses CP-F2 without retrying subscription lookup or showing a not-found error.

Co-authored-by: Copilot <[email protected]>
Addresses CP-F1 with idempotent releases across overlapping links and reacquisition.

Co-authored-by: Copilot <[email protected]>
Addresses CP-F8 by clearing stale outcome and correlation before either connection path.

Co-authored-by: Copilot <[email protected]>
Addresses CP-F4 and CP-F6 while retaining category and navigation-step diagnostics.

Co-authored-by: Copilot <[email protected]>
Record each published fix, both accepted out-of-scope findings, Case 1 and Case 2 results, and apply required formatting.

Co-authored-by: Copilot <[email protected]>
@tnaum-ms

Copy link
Copy Markdown
Collaborator Author

Review remediation complete; final verification/evidence commit: 89e150b. Five fixes cover six Copilot threads; CP-F3 and CP-F7 retain the approved out-of-scope dispositions. All eight threads have replies and are resolved. Case 1 passed: build plus 17 test files / 271 tests. Case 2 passed: prettier-fix, l10n:check, lint, build, typecheck:tests, full Vitest (336 files / 5,912 passed / one skipped), and package (8.55 MB VSIX). Localization generation was unnecessary because no localized product strings changed. The committed review log links every fix and records known limitations. Existing cross-vendor pre-review evidence is committed; no live cloud/workbench verification is claimed.

@tnaum-ms Tomasz Naumowicz (tnaum-ms) added the ci:full-requested Requests a full run of CI checks. label Nov 10, 2026
@tnaum-ms Tomasz Naumowicz (tnaum-ms) added ci:full-requested Requests a full run of CI checks. and removed ci:full-requested Requests a full run of CI checks. labels Nov 10, 2026
Preserve dashboard suppression and diagnostic credential imports, combine RPC attribution and cancellation tests, regenerate localization, and use the renamed error explanation service.

Co-authored-by: Copilot <[email protected]>
@tnaum-ms Tomasz Naumowicz (tnaum-ms) removed the ci:full-requested Requests a full run of CI checks. label Nov 10, 2026
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit 96f1a06 into main Nov 11, 2026
14 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/url-handler-improvmements branch November 11, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants