Skip to content

Commit 859c99f

Browse files
[identity] Remove VSCode credential from Default Azure Credential (Azure#22851)
1 parent 0108193 commit 859c99f

File tree

6 files changed

+10
-25
lines changed

6 files changed

+10
-25
lines changed

sdk/identity/identity/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features Added
66

77
### Breaking Changes
8+
- Removed `VisualStudioCodeCredential` from `DefaultAzureCredential` token chain. [Issue 20500](https://github.com/Azure/azure-sdk-for-js/issues/20500) tracks this.
89

910
### Bugs Fixed
1011

sdk/identity/identity/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ If interactive authentication cannot be supported in the session, then the `-Use
8888

8989
#### Authenticate via Visual Studio Code
9090

91-
Developers using Visual Studio Code can use the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) to authenticate via the editor. Apps using `DefaultAzureCredential` or `VisualStudioCodeCredential` can then use this account to authenticate calls in their app when running locally.
91+
Developers using Visual Studio Code can use the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) to authenticate via the editor. Apps using `VisualStudioCodeCredential` can then use this account to authenticate calls in their app when running locally.
9292

9393
To authenticate in Visual Studio Code, ensure the Azure Account extension is installed. Once installed, open the **Command Palette** and run the **Azure: Sign In** command.
9494

@@ -124,11 +124,13 @@ If used from Node.js, the `DefaultAzureCredential` will attempt to authenticate
124124

125125
1. **Environment** - The `DefaultAzureCredential` will read account information specified via [environment variables](#environment-variables) and use it to authenticate.
126126
1. **Managed Identity** - If the application is deployed to an Azure host with Managed Identity enabled, the `DefaultAzureCredential` will authenticate with that account.
127-
1. **Visual Studio Code** - If the developer has authenticated with the [Visual Studio Code Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account), the `DefaultAzureCredential` will authenticate using that account.
128-
- In `@azure/identity` version 2.0 or later, the [`@azure/identity-vscode`](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity-vscode) package must be installed for the Visual Studio Code authentication to work.
129127
1. **Azure CLI** - If the developer has authenticated an account via the Azure CLI `az login` command, the `DefaultAzureCredential` will authenticate with that account.
130128
1. **Azure PowerShell** - If the developer has authenticated using the Azure PowerShell module `Connect-AzAccount` command, the `DefaultAzureCredential` will authenticate with that account.
131129

130+
#### Note about `VisualStudioCodeCredential`
131+
132+
Due to a [known issue](https://github.com/Azure/azure-sdk-for-js/issues/20500), `VisualStudioCodeCredential` has been removed from the `DefaultAzureCredential` token chain. When the issue is resolved in a future release it will return.
133+
132134
## Plugins
133135

134136
Azure Identity for JavaScript provides a plugin API that allows us to provide certain functionality through separate _plugin packages_. The `@azure/identity` package exports a top-level function (`useIdentityPlugin`) that can be used to enable a plugin. We provide two plugin packages:

sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
%% 2. Run command: mmdc -i DefaultAzureCredentialAuthFlow.md -o DefaultAzureCredentialAuthFlow.svg
66
77
flowchart LR;
8-
A(Environment):::deployed ==> B(Managed Identity):::deployed ==> C(VS Code):::developer ==> D(Azure CLI):::developer ==> E(Azure PowerShell):::developer;
8+
A(Environment):::deployed ==> B(Managed Identity):::deployed ==> D(Azure CLI):::developer ==> E(Azure PowerShell):::developer;
99
1010
subgraph CREDENTIAL TYPES;
1111
direction LR;
1212
Deployed(Deployed service):::deployed ==> Developer(Developer):::developer;
1313
1414
%% Hide links between boxes in the legend by setting width to 0. The integers after "linkStyle" represent link indices.
15-
linkStyle 4 stroke-width:0px;
15+
linkStyle 3 stroke-width:0px;
1616
end;
1717
1818
%% Define styles for credential type boxes
@@ -22,7 +22,6 @@ flowchart LR;
2222
%% Add API ref links to credential type boxes
2323
click A "https://docs.microsoft.com/javascript/api/@azure/identity/environmentcredential?view=azure-node-latest" _blank;
2424
click B "https://docs.microsoft.com/javascript/api/@azure/identity/managedidentitycredential?view=azure-node-latest" _blank;
25-
click C "https://docs.microsoft.com/javascript/api/@azure/identity/visualstudiocodecredential?view=azure-node-latest" _blank;
2625
click D "https://docs.microsoft.com/javascript/api/@azure/identity/azureclicredential?view=azure-node-latest" _blank;
2726
click E "https://docs.microsoft.com/javascript/api/@azure/identity/azurepowershellcredential?view=azure-node-latest" _blank;
2827
```

sdk/identity/identity/images/mermaidjs/DefaultAzureCredentialAuthFlow.svg

Lines changed: 1 addition & 1 deletion
Loading

sdk/identity/identity/src/credentials/defaultAzureCredential.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
ManagedIdentityCredentialClientIdOptions,
1616
ManagedIdentityCredentialResourceIdOptions,
1717
} from "./managedIdentityCredential";
18-
import { VisualStudioCodeCredential } from "./visualStudioCodeCredential";
1918

2019
/**
2120
* Provides options to configure the {@link DefaultAzureCredential} class.
@@ -109,7 +108,6 @@ export class DefaultManagedIdentityCredential extends ManagedIdentityCredential
109108
export const defaultCredentials: DefaultCredentialConstructor[] = [
110109
EnvironmentCredential,
111110
DefaultManagedIdentityCredential,
112-
VisualStudioCodeCredential,
113111
AzureCliCredential,
114112
AzurePowerShellCredential,
115113
];
@@ -129,17 +127,12 @@ export class DefaultAzureCredential extends ChainedTokenCredential {
129127
*
130128
* - {@link EnvironmentCredential}
131129
* - {@link ManagedIdentityCredential}
132-
* - {@link VisualStudioCodeCredential}
133130
* - {@link AzureCliCredential}
134131
* - {@link AzurePowerShellCredential}
135132
*
136133
* Consult the documentation of these credential types for more information
137134
* on how they attempt authentication.
138135
*
139-
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
140-
* `@azure/identity-vscode`. If this package is not installed and registered
141-
* using the plugin API (`useIdentityPlugin`), then authentication using
142-
* `VisualStudioCodeCredential` will not be available.
143136
* @param options - Optional parameters. See {@link DefaultAzureCredentialClientIdOptions}.
144137
*/
145138
constructor(options?: DefaultAzureCredentialClientIdOptions);
@@ -154,17 +147,12 @@ export class DefaultAzureCredential extends ChainedTokenCredential {
154147
*
155148
* - {@link EnvironmentCredential}
156149
* - {@link ManagedIdentityCredential}
157-
* - {@link VisualStudioCodeCredential}
158150
* - {@link AzureCliCredential}
159151
* - {@link AzurePowerShellCredential}
160152
*
161153
* Consult the documentation of these credential types for more information
162154
* on how they attempt authentication.
163155
*
164-
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
165-
* `@azure/identity-vscode`. If this package is not installed and registered
166-
* using the plugin API (`useIdentityPlugin`), then authentication using
167-
* `VisualStudioCodeCredential` will not be available.
168156
* @param options - Optional parameters. See {@link DefaultAzureCredentialResourceIdOptions}.
169157
*/
170158
constructor(options?: DefaultAzureCredentialResourceIdOptions);
@@ -179,18 +167,12 @@ export class DefaultAzureCredential extends ChainedTokenCredential {
179167
*
180168
* - {@link EnvironmentCredential}
181169
* - {@link ManagedIdentityCredential}
182-
* - {@link VisualStudioCodeCredential}
183170
* - {@link AzureCliCredential}
184171
* - {@link AzurePowerShellCredential}
185172
*
186173
* Consult the documentation of these credential types for more information
187174
* on how they attempt authentication.
188175
*
189-
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
190-
* `@azure/identity-vscode`. If this package is not installed and registered
191-
* using the plugin API (`useIdentityPlugin`), then authentication using
192-
* `VisualStudioCodeCredential` will not be available.
193-
*
194176
* @param options - Optional parameters. See {@link DefaultAzureCredentialOptions}.
195177
*/
196178
constructor(options?: DefaultAzureCredentialOptions);

sdk/identity/identity/src/credentials/visualStudioCodeCredential.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export class VisualStudioCodeCredential implements TokenCredential {
188188
"You must install the identity-vscode plugin package (`npm install --save-dev @azure/identity-vscode`)",
189189
"and enable it by importing `useIdentityPlugin` from `@azure/identity` and calling",
190190
"`useIdentityPlugin(vsCodePlugin)` before creating a `VisualStudioCodeCredential`.",
191+
"To troubleshoot, visit https://aka.ms/azsdk/js/identity/vscodecredential/troubleshoot.",
191192
].join(" ")
192193
);
193194
}

0 commit comments

Comments
 (0)