Skip to content

vscode uri handler now asks for signing in to another account instead…#2899

Open
mkrueger wants to merge 14 commits intomainfrom
dev/mkrueger/issue2686
Open

vscode uri handler now asks for signing in to another account instead…#2899
mkrueger wants to merge 14 commits intomainfrom
dev/mkrueger/issue2686

Conversation

@mkrueger
Copy link
Copy Markdown
Member

This pull request enhances the robustness and user experience of the Cosmos DB "Open in VS Code" URI handler, especially around Azure account and subscription issues. It introduces improved error handling and user prompts when resources cannot be found due to account or subscription mismatches, and adds comprehensive tests for these scenarios. Additionally, it updates localization strings to provide clearer guidance to users.

Improvements to Azure account/subscription handling:

  • Refactored revealAzureResourceInExplorer in src/vscodeUriHandler.ts to detect when a resource cannot be found due to account or subscription issues, prompting the user to sign in or select subscriptions, and retrying the reveal operation after user action. [1] [2]
  • Added helper functions promptToFixAzureAccountAccess and revealAzureResourceWithAccountPrompt to encapsulate user prompting and retry logic for account/subscription issues.
  • Improved error message handling in globalUriHandler to properly propagate UserCancelledError and provide more descriptive failure messages.

Localization and messaging updates:

  • Updated and added several localization strings in l10n/bundle.l10n.json to clarify instructions when resources are not found due to Azure account or subscription problems, and to support new prompts for sign-in and subscription selection. [1] [2] [3] [4] [5]

Testing improvements:

  • Added a new test suite in test/vscodeUriHandler.test.ts to verify that the handler correctly prompts users and retries when encountering subscription/account issues, and that cancellation is handled as expected.

Other changes:

  • Exported globalUriHandler from extension.bundle.ts to make it available for testing and integration.
  • Minor import adjustment to include parseError in src/vscodeUriHandler.ts.… of showing a "subscription not found" error.

fixes #2686

image

… of showing a "subscription not found" error.

fixes #2686
@mkrueger mkrueger requested a review from a team as a code owner January 20, 2026 14:20
@sevoku sevoku requested a review from Copilot January 22, 2026 21:14
@sevoku
Copy link
Copy Markdown
Member

sevoku commented Jan 22, 2026

I have not tested this yet, but we should not forget to add tenantId param to the Azure Portal, that's an essential part.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves the Cosmos DB “Open in VS Code” URI handler to better handle Azure account/subscription mismatches by prompting the user to sign in or select subscriptions and retrying the reveal flow, with updated messaging and tests.

Changes:

  • Add account/subscription mismatch prompting + retry logic around revealAzureResource / tree lookup.
  • Improve URI handler error propagation to preserve UserCancelledError (avoid wrapping as a generic failure).
  • Add localization strings and a new test suite covering the new prompts/retry behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/vscodeUriHandler.ts Adds prompt/retry helpers for subscription-not-found and account-mismatch scenarios; preserves UserCancelledError propagation.
l10n/bundle.l10n.json Adds/updates strings for new prompts and improved “resource not found” guidance.
test/vscodeUriHandler.test.ts Adds tests for subscription-not-found prompt + retry, account mismatch retry, and cancellation handling.
extension.bundle.ts Exports globalUriHandler for test access.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/vscodeUriHandler.test.ts Outdated
Comment thread src/vscodeUriHandler.ts
Comment thread test/vscodeUriHandler.test.ts
Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

@mkrueger I've opened a new pull request, #2941, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 27, 2026 11:08
…source

Co-authored-by: mkrueger <341098+mkrueger@users.noreply.github.com>
@mkrueger
Copy link
Copy Markdown
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

@mkrueger mkrueger closed this Feb 27, 2026
@mkrueger mkrueger reopened this Feb 27, 2026
@mkrueger
Copy link
Copy Markdown
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 27, 2026

@mkrueger I've opened a new pull request, #2942, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/vscodeUriHandler.test.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/vscodeUriHandler.ts
Comment thread src/vscodeUriHandler.ts
Comment thread extension.bundle.ts
@mkrueger
Copy link
Copy Markdown
Member Author

mkrueger commented Mar 5, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 5, 2026

@mkrueger I've opened a new pull request, #2945, to work on those changes. Once the pull request is ready, I'll request review from you.

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.

[Bug] : [Open in VSCode] from Azure portal should handle tenant switch gracefully!

4 participants