Skip to content
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

Correct default VisualStudioCodeCredential environment name #14648

Merged
merged 2 commits into from
Nov 4, 2020

Conversation

chlowell
Copy link
Member

Closes #14438, the gist of which is that VS Code Azure Account extension doesn't purge the refresh token it stores as its "Azure" token when the user signs out. Currently, VisualStudioCodeCredential will use this token when it finds no more specific cloud identified in VS Code's settings file (as it would if a user were signed in to the extension). Thus the credential can attempt to redeem an expired refresh token, and raise ClientAuthenticationError rather than the CredentialUnavailableError we want when no user is signed in to the extension.

This implements the fix proposed in #14438, changing the default environment to "AzureCloud", which the extension does purge when the user signs out, and uses as its own default environment.

@chlowell chlowell added Client This issue points to a problem in the data-plane of the library. Azure.Identity labels Oct 20, 2020
@chlowell chlowell requested a review from g2vinay October 20, 2020 23:38
@@ -59,10 +59,10 @@ def _get_user_settings():
try:
with open(path) as file:
data = json.load(file)
environment_name = data.get("azure.cloud", "Azure")
environment_name = data.get("azure.cloud", "AzureCloud")
Copy link
Member

Choose a reason for hiding this comment

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

The change looks fine.
Shouldn't this env also alter the target Azure Auth Host for VS code client ?
the auth host provided via kwargs/constructor/env will take priority, but if isn't specified then this env should be used to target a specific auth host too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps; that would be a new feature. I put it on the backlog as #14808

g2vinay
g2vinay previously approved these changes Oct 29, 2020
@chlowell chlowell merged commit aebd212 into Azure:master Nov 4, 2020
@chlowell chlowell deleted the vscode-default-environment branch November 4, 2020 17:44
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Nov 4, 2020
…into add_invoice_multipage

* 'master' of https://github.com/Azure/azure-sdk-for-python: (31 commits)
  add more samples (Azure#15007)
  Address feedbacks: Rename type, improve readme (Azure#14905)
  Correct Visual Studio Code default environment name (Azure#14648)
  [ServiceBus] Adjust AutoLockRenewer to only allow registration of intended types (ReceivedMessage and ServiceBusSession) (Azure#14600)
  Validate tenant IDs used in URLs (Azure#14955)
  [ServiceBus] Make sub-client initializers internal (add '_' to from_conn_str for receiver/sender) (Azure#14502)
  Raise minimum msal version to 1.6.0 (Azure#14992)
  update monitor to target '*' instead of azure-* (Azure#14985)
  Split create_basic_client into two methods (Azure#14673)
  [ServiceBus] receive related methods/constructor raise error if given max_wait_time <= 0 (Azure#14925)
  String unicode deserial (Azure#14958)
  Clarified exceptions docs (Azure#14947)
  search-documents: correct method calls in sample (Azure#14980)
  Catch exceptions thrown by async download (Azure#14946)
  Increment package version after release of azure_eventgrid (Azure#14266)
  [ServiceBus] Add additional stress test coverage to ensure parity with cross-language priorities (Azure#14437)
  Service Bus Connection String Parser (Azure#14772)
  Remove AmendCommit parameter (Azure#14965)
  revert creation takes full object change (Azure#14957)
  [ServiceBus] Settlement move from Message to Receiver (Azure#14681)
  ...
iscai-msft pushed a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Nov 4, 2020
iscai-msft added a commit to iscai-msft/azure-sdk-for-python that referenced this pull request Nov 4, 2020
…into add_invoice_multipage_tests

* 'master' of https://github.com/Azure/azure-sdk-for-python: (31 commits)
  add more samples (Azure#15007)
  Address feedbacks: Rename type, improve readme (Azure#14905)
  Correct Visual Studio Code default environment name (Azure#14648)
  [ServiceBus] Adjust AutoLockRenewer to only allow registration of intended types (ReceivedMessage and ServiceBusSession) (Azure#14600)
  Validate tenant IDs used in URLs (Azure#14955)
  [ServiceBus] Make sub-client initializers internal (add '_' to from_conn_str for receiver/sender) (Azure#14502)
  Raise minimum msal version to 1.6.0 (Azure#14992)
  update monitor to target '*' instead of azure-* (Azure#14985)
  Split create_basic_client into two methods (Azure#14673)
  [ServiceBus] receive related methods/constructor raise error if given max_wait_time <= 0 (Azure#14925)
  String unicode deserial (Azure#14958)
  Clarified exceptions docs (Azure#14947)
  search-documents: correct method calls in sample (Azure#14980)
  Catch exceptions thrown by async download (Azure#14946)
  Increment package version after release of azure_eventgrid (Azure#14266)
  [ServiceBus] Add additional stress test coverage to ensure parity with cross-language priorities (Azure#14437)
  Service Bus Connection String Parser (Azure#14772)
  Remove AmendCommit parameter (Azure#14965)
  revert creation takes full object change (Azure#14957)
  [ServiceBus] Settlement move from Message to Receiver (Azure#14681)
  ...
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Jun 9, 2021
Move swagger from private repo to public repo (Azure#14648)

* Adding Swagger for AzureData on AzureArc

* rename folder to AzureArcData

* Adding Operations

* Revert "Adding Operations". Keeping it the same with old approved
swagger

This reverts commit 83ff5548c0d605829d656a461a416e517fa8b49e.

* Bump version to 2020-12-08

* Move 2021-06-01-preview to public repo

* Fixing SDK generation

Co-authored-by: Shuo Li <shul@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] VsCode Credential not reading correct values from the access token cache.
3 participants