Skip to content

Commit 14999bb

Browse files
authored
Mark VisualStudioCodeCredential as obsolete (Azure#49108)
1 parent 10534c5 commit 14999bb

9 files changed

+32
-17
lines changed

sdk/identity/Azure.Identity/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
### Other Changes
1212

13+
- Marked `VisualStudioCodeCredential` as obsolete because the VS Code Azure Account extension on which this credential relies has been deprecated. See the Azure Account extension deprecation notice [here](https://github.com/microsoft/vscode-azure-account/issues/964).
14+
1315
## 1.14.0-beta.2 (2025-03-11)
1416

1517
### Bugs Fixed

sdk/identity/Azure.Identity/TROUBLESHOOTING.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ This troubleshooting guide covers failure investigation techniques, common error
2020
- [Troubleshoot ManagedIdentityCredential authentication issues](#troubleshoot-managedidentitycredential-authentication-issues)
2121
- [Azure Virtual Machine managed identity](#azure-virtual-machine-managed-identity)
2222
- [Azure App Service and Azure Functions managed identity](#azure-app-service-and-azure-functions-managed-identity)
23-
- [Troubleshoot VisualStudioCodeCredential authentication issues](#troubleshoot-visualstudiocodecredential-authentication-issues)
2423
- [Troubleshoot VisualStudioCredential authentication issues](#troubleshoot-visualstudiocredential-authentication-issues)
2524
- [Troubleshoot AzureDeveloperCliCredential authentication issues](#troubleshoot-azuredeveloperclicredential-authentication-issues)
2625
- [Troubleshoot AzureCliCredential authentication issues](#troubleshoot-azureclicredential-authentication-issues)
@@ -125,7 +124,7 @@ DefaultAzureCredentialOptions options = new
125124

126125
| Error |Description| Mitigation |
127126
|---|---|---|
128-
|`CredentialUnavailableException` raised with message. "DefaultAzureCredential failed to retrieve a token from the included credentials."|All credentials in the `DefaultAzureCredential` chain failed to retrieve a token, each throwing a `CredentialUnavailableException`.|<ul><li>[Enable logging](#enable-and-configure-logging) to verify the credentials being tried, and get further diagnostic information.</li><li>Consult the troubleshooting guide for underlying credential types for more information.</li><ul><li>[EnvironmentCredential](#troubleshoot-environmentcredential-authentication-issues)</li><li>[WorkloadIdentityCredential](#troubleshoot-workloadidentitycredential-authentication-issues)</li><li>[ManagedIdentityCredential](#troubleshoot-managedidentitycredential-authentication-issues)</li><li>[VisualStudioCodeCredential](#troubleshoot-visualstudiocodecredential-authentication-issues)</li><li>[VisualStudioCredential](#troubleshoot-visualstudiocredential-authentication-issues)</li><li>[AzureCLICredential](#troubleshoot-azureclicredential-authentication-issues)</li><li>[AzurePowershellCredential](#troubleshoot-azurepowershellcredential-authentication-issues)</li></ul>|
127+
|`CredentialUnavailableException` raised with message. "DefaultAzureCredential failed to retrieve a token from the included credentials."|All credentials in the `DefaultAzureCredential` chain failed to retrieve a token, each throwing a `CredentialUnavailableException`.|<ul><li>[Enable logging](#enable-and-configure-logging) to verify the credentials being tried, and get further diagnostic information.</li><li>Consult the troubleshooting guide for underlying credential types for more information.</li><ul><li>[EnvironmentCredential](#troubleshoot-environmentcredential-authentication-issues)</li><li>[WorkloadIdentityCredential](#troubleshoot-workloadidentitycredential-authentication-issues)</li><li>[ManagedIdentityCredential](#troubleshoot-managedidentitycredential-authentication-issues)</li><li>[VisualStudioCredential](#troubleshoot-visualstudiocredential-authentication-issues)</li><li>[AzureCliCredential](#troubleshoot-azureclicredential-authentication-issues)</li><li>[AzurePowerShellCredential](#troubleshoot-azurepowershellcredential-authentication-issues)</li></ul>|
129128
|`RequestFailedException` raised from the client with a status code of 401 or 403|Authentication succeeded but the authorizing Azure service responded with a 401 (Authenticate) or 403 (Forbidden) status code. This error can often be caused by the `DefaultAzureCredential` authenticating an account other than the intended or that the intended account doesn't have the correct permissions or roles assigned.|<ul><li>[Enable logging](#enable-and-configure-logging) to determine which credential in the chain returned the authenticating token.</li><li>In the case a credential other than the expected is returning a token, bypass this by either signing out of the corresponding development tool, or excluding the credential with the ExcludeXXXCredential property in the `DefaultAzureCredentialOptions`</li><li>Ensure that the correct role is assigned to the account being used. For example, a service specific role rather than the subscription Owner role.</li></ul>|
130129

131130
## Troubleshoot `EnvironmentCredential` authentication issues
@@ -245,19 +244,6 @@ curl 'http://169.254.169.254/metadata/identity/oauth2/token?resource=https://man
245244
|---|---|---|
246245
|No Managed Identity endpoint found|The application attempted to authenticate before an identity was assigned to its pod|Verify the pod is labeled correctly. This error also occurs when a correctly labeled pod authenticates before the identity is ready. To prevent initialization races, configure NMI to set the `Retry-After` header in its responses (see [Pod Identity documentation](https://azure.github.io/aad-pod-identity/docs/configure/feature_flags/#set-retry-after-header-in-nmi-response)).
247246

248-
## Troubleshoot `VisualStudioCodeCredential` authentication issues
249-
250-
> It's a [known issue](https://github.com/Azure/azure-sdk-for-net/issues/27263) that `VisualStudioCodeCredential` doesn't work with [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) versions newer than **0.9.11**. A long-term fix to this problem is in progress. In the meantime, consider [authenticating via the Azure CLI](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md#authenticating-via-the-azure-cli).
251-
252-
`CredentialUnavailableException`
253-
254-
| Error Message |Description| Mitigation |
255-
|---|---|---|
256-
|Failed To Read VS Code Credentials</p></p>OR</p>Authenticate via Azure Tools plugin in VS Code|No Azure account information was found in the VS Code configuration.|<ul><li>Ensure the [Azure Account plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) is properly installed</li><li>Use **View > Command Palette** to execute the **Azure: Sign In** command. This command opens a browser window and displays a page that allows you to sign in to Azure.</li><li>If you already had the Azure Account extension installed and logged in to your account, try logging out and logging in again. Doing so will repopulate the cache and potentially mitigate the error you're getting.</li></ul>|
257-
|MSAL Interaction Required Error|The `VisualStudioCodeCredential` was able to read the cached credentials from the cache but the cached token is likely expired.|Log into the Azure Account extension via **View > Command Palette** to execute the **Azure: Sign In** command in the VS Code IDE.|
258-
|ADFS tenant not supported|ADFS tenants aren't currently supported by Visual Studio `Azure Service Authentication`.|Use credentials from a supported cloud when authenticating with Visual Studio. The supported clouds are:</p><ul><li>AZURE PUBLIC CLOUD - https://login.microsoftonline.com/</li><li>AZURE GERMANY - https://login.microsoftonline.de/</li><li>AZURE CHINA - https://login.chinacloudapi.cn/</li><li>AZURE GOVERNMENT - https://login.microsoftonline.us/</li></ul>|
259-
|AADSTS50020| User account '{EmailHidden}' from identity provider 'live.com' doesn't exist in tenant 'Microsoft Services' and cannot access the application '04f0c124-f2bc-4f59-8241-bf6df9866bbd'(VS with native MSA) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Microsoft Entra user account.|Specify a `TenantId` value that corresponds to the resource to which you're authenticating in the `VisualStudioCredentialOptions` (or the `DefaultAzureCredentialOptions` if you're using `DefaultAzureCredential`).|
260-
261247
## Troubleshoot `VisualStudioCredential` authentication issues
262248

263249
`CredentialUnavailableException`

sdk/identity/Azure.Identity/api/Azure.Identity.net8.0.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ public DefaultAzureCredentialOptions() { }
205205
public bool ExcludeInteractiveBrowserCredential { get { throw null; } set { } }
206206
public bool ExcludeManagedIdentityCredential { get { throw null; } set { } }
207207
public bool ExcludeSharedTokenCacheCredential { get { throw null; } set { } }
208+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
209+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
208210
public bool ExcludeVisualStudioCodeCredential { get { throw null; } set { } }
209211
public bool ExcludeVisualStudioCredential { get { throw null; } set { } }
210212
public bool ExcludeWorkloadIdentityCredential { get { throw null; } set { } }
@@ -218,6 +220,7 @@ public DefaultAzureCredentialOptions() { }
218220
public string SharedTokenCacheUsername { get { throw null; } set { } }
219221
public string TenantId { get { throw null; } set { } }
220222
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
223+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
221224
public string VisualStudioCodeTenantId { get { throw null; } set { } }
222225
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
223226
public string VisualStudioTenantId { get { throw null; } set { } }
@@ -447,13 +450,17 @@ public UsernamePasswordCredentialOptions() { }
447450
public bool DisableInstanceDiscovery { get { throw null; } set { } }
448451
public Azure.Identity.TokenCachePersistenceOptions TokenCachePersistenceOptions { get { throw null; } set { } }
449452
}
453+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
454+
[System.ObsoleteAttribute("This credential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
450455
public partial class VisualStudioCodeCredential : Azure.Core.TokenCredential
451456
{
452457
public VisualStudioCodeCredential() { }
453458
public VisualStudioCodeCredential(Azure.Identity.VisualStudioCodeCredentialOptions options) { }
454459
public override Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken) { throw null; }
455460
public override System.Threading.Tasks.ValueTask<Azure.Core.AccessToken> GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken) { throw null; }
456461
}
462+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
463+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
457464
public partial class VisualStudioCodeCredentialOptions : Azure.Identity.TokenCredentialOptions
458465
{
459466
public VisualStudioCodeCredentialOptions() { }

sdk/identity/Azure.Identity/api/Azure.Identity.netstandard2.0.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ public DefaultAzureCredentialOptions() { }
202202
public bool ExcludeInteractiveBrowserCredential { get { throw null; } set { } }
203203
public bool ExcludeManagedIdentityCredential { get { throw null; } set { } }
204204
public bool ExcludeSharedTokenCacheCredential { get { throw null; } set { } }
205+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
206+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
205207
public bool ExcludeVisualStudioCodeCredential { get { throw null; } set { } }
206208
public bool ExcludeVisualStudioCredential { get { throw null; } set { } }
207209
public bool ExcludeWorkloadIdentityCredential { get { throw null; } set { } }
@@ -215,6 +217,7 @@ public DefaultAzureCredentialOptions() { }
215217
public string SharedTokenCacheUsername { get { throw null; } set { } }
216218
public string TenantId { get { throw null; } set { } }
217219
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
220+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
218221
public string VisualStudioCodeTenantId { get { throw null; } set { } }
219222
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
220223
public string VisualStudioTenantId { get { throw null; } set { } }
@@ -444,13 +447,17 @@ public UsernamePasswordCredentialOptions() { }
444447
public bool DisableInstanceDiscovery { get { throw null; } set { } }
445448
public Azure.Identity.TokenCachePersistenceOptions TokenCachePersistenceOptions { get { throw null; } set { } }
446449
}
450+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
451+
[System.ObsoleteAttribute("This credential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
447452
public partial class VisualStudioCodeCredential : Azure.Core.TokenCredential
448453
{
449454
public VisualStudioCodeCredential() { }
450455
public VisualStudioCodeCredential(Azure.Identity.VisualStudioCodeCredentialOptions options) { }
451456
public override Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken) { throw null; }
452457
public override System.Threading.Tasks.ValueTask<Azure.Core.AccessToken> GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken) { throw null; }
453458
}
459+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
460+
[System.ObsoleteAttribute("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
454461
public partial class VisualStudioCodeCredentialOptions : Azure.Identity.TokenCredentialOptions
455462
{
456463
public VisualStudioCodeCredentialOptions() { }

sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredential.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace Azure.Identity
2424
/// <item><description><see cref="ManagedIdentityCredential"/></description></item>
2525
/// <item><description><see cref="SharedTokenCacheCredential"/></description></item>
2626
/// <item><description><see cref="VisualStudioCredential"/></description></item>
27-
/// <item><description><see cref="VisualStudioCodeCredential"/></description></item>
2827
/// <item><description><see cref="AzureCliCredential"/></description></item>
2928
/// <item><description><see cref="AzurePowerShellCredential"/></description></item>
3029
/// <item><description><see cref="AzureDeveloperCliCredential"/></description></item>

sdk/identity/Azure.Identity/src/Credentials/DefaultAzureCredentialOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public string VisualStudioTenantId
152152
/// The value can also be set by setting the environment variable AZURE_TENANT_ID.
153153
/// </summary>
154154
[EditorBrowsable(EditorBrowsableState.Never)]
155+
[Obsolete("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
155156
public string VisualStudioCodeTenantId
156157
{
157158
get => _visualStudioCodeTenantId.Value;
@@ -273,6 +274,8 @@ public string VisualStudioCodeTenantId
273274
/// Specifies whether the <see cref="VisualStudioCodeCredential"/> will be excluded from the <see cref="DefaultAzureCredential"/> authentication flow.
274275
/// The default is <c>true</c>.
275276
/// </summary>
277+
[EditorBrowsable(EditorBrowsableState.Never)]
278+
[Obsolete("VisualStudioCodeCredential is deprecated because the VS Code Azure Account extension on which this credential relies has been deprecated. Consider using other dev-time credentials, such as VisualStudioCredential, AzureCliCredential, AzureDeveloperCliCredential, AzurePowerShellCredential. See the Azure Account extension deprecation notice here: https://github.com/microsoft/vscode-azure-account/issues/964.")]
276279
public bool ExcludeVisualStudioCodeCredential { get; set; } = true;
277280

278281
/// <summary>
@@ -310,7 +313,9 @@ public string VisualStudioCodeTenantId
310313
dacClone.ExcludeInteractiveBrowserCredential = ExcludeInteractiveBrowserCredential;
311314
dacClone.ExcludeAzureCliCredential = ExcludeAzureCliCredential;
312315
dacClone.ExcludeVisualStudioCredential = ExcludeVisualStudioCredential;
316+
#pragma warning disable CS0618 // Type or member is obsolete
313317
dacClone.ExcludeVisualStudioCodeCredential = ExcludeVisualStudioCodeCredential;
318+
#pragma warning restore CS0618 // Type or member is obsolete
314319
dacClone.ExcludeAzurePowerShellCredential = ExcludeAzurePowerShellCredential;
315320
dacClone.IsForceRefreshEnabled = IsForceRefreshEnabled;
316321
}

0 commit comments

Comments
 (0)