CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-com-azure--azure-identity

The Azure Identity library provides Microsoft Entra ID token authentication support across the Azure SDK with a comprehensive set of TokenCredential implementations.

Pending
Overview
Eval results
Files

visual-studio-code-authentication.mddocs/

Visual Studio Code Authentication

DEPRECATED: Authenticates using Visual Studio Code Azure Account extension credentials. This credential is deprecated due to the underlying VS Code Azure Account extension being deprecated.

Capabilities

Visual Studio Code Credential

Enables authentication using cached credentials from VS Code Azure Account extension.

/**
 * Visual Studio Code credential for development environments
 * @deprecated VS Code Azure Account extension has been deprecated
 */
@Deprecated
class VisualStudioCodeCredential implements TokenCredential {
    Mono<AccessToken> getToken(TokenRequestContext request);
    // Note: Does not support synchronous getTokenSync method
}

@Deprecated
class VisualStudioCodeCredentialBuilder extends CredentialBuilderBase<VisualStudioCodeCredentialBuilder> {
    VisualStudioCodeCredentialBuilder tenantId(String tenantId);
    VisualStudioCodeCredentialBuilder additionallyAllowedTenants(String... additionallyAllowedTenants);
    VisualStudioCodeCredentialBuilder additionallyAllowedTenants(List<String> additionallyAllowedTenants);
    VisualStudioCodeCredential build();
}

Deprecation Notice

⚠️ This credential is deprecated because:

  • VS Code Azure Account extension has been deprecated by Microsoft
  • Known compatibility issues with Azure Account extension versions newer than 0.9.11
  • No longer maintained or recommended for new development

Legacy Usage Examples

import com.azure.identity.VisualStudioCodeCredential;
import com.azure.identity.VisualStudioCodeCredentialBuilder;

// DEPRECATED - Not recommended for new development
@SuppressWarnings("deprecation")
TokenCredential credential = new VisualStudioCodeCredentialBuilder()
    .build();

// With specific tenant
@SuppressWarnings("deprecation")
TokenCredential tenantCredential = new VisualStudioCodeCredentialBuilder()
    .tenantId("your-tenant-id")
    .build();

// Multi-tenant support
@SuppressWarnings("deprecation")
TokenCredential multiTenantCredential = new VisualStudioCodeCredentialBuilder()
    .tenantId("primary-tenant")
    .additionallyAllowedTenants("tenant1", "tenant2")
    .build();

Migration Recommendations

Recommended Alternatives for VS Code Development:

1. Azure CLI Credential (Recommended)

// Modern replacement for VS Code authentication
TokenCredential credential = new AzureCliCredentialBuilder()
    .build();

// Setup: Install Azure CLI and run 'az login'

2. Default Azure Credential Chain

// Comprehensive authentication chain including Azure CLI
TokenCredential credential = new DefaultAzureCredentialBuilder()
    .build();

3. Interactive Browser Credential

// For interactive development scenarios
TokenCredential credential = new InteractiveBrowserCredentialBuilder()
    .clientId("your-client-id")
    .build();

Known Issues

  • Extension version compatibility: Doesn't work with Azure Account extension versions newer than 0.9.11
  • Token cache access: May fail to access VS Code token cache on some systems
  • Authentication failures: Inconsistent behavior across different VS Code versions
  • Platform limitations: Limited support on some operating systems

Migration Steps

  1. Remove VisualStudioCodeCredential usage:

    // Remove deprecated credential
    // TokenCredential credential = new VisualStudioCodeCredentialBuilder().build();
  2. Install Azure CLI:

    # Install Azure CLI for your platform
    # macOS: brew install azure-cli
    # Windows: winget install Microsoft.AzureCLI  
    # Linux: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
  3. Authenticate with Azure CLI:

    az login
  4. Update to use AzureCliCredential:

    TokenCredential credential = new AzureCliCredentialBuilder()
        .build();

VS Code Development Workflow (Legacy)

For maintaining existing code only:

  1. Install VS Code Azure Account extension (version ≤ 0.9.11)
  2. Sign in to Azure through the extension
  3. Use the deprecated credential (not recommended for new projects)

Exception Handling

Throws CredentialUnavailableException when:

  • VS Code Azure Account extension is not installed
  • Extension version is incompatible (> 0.9.11)
  • User is not signed in through the extension
  • Token cache is inaccessible or corrupted

Development Environment Setup

Recommended modern setup for VS Code development:

# Install Azure CLI
az login

# Or use Azure PowerShell
Connect-AzAccount

Then use:

// Use DefaultAzureCredential which includes Azure CLI
TokenCredential credential = new DefaultAzureCredentialBuilder()
    .build();

This provides a more reliable and supported authentication experience for development scenarios.

Install with Tessl CLI

npx tessl i tessl/maven-com-azure--azure-identity

docs

advanced-authentication-flows.md

authorization-code-authentication.md

azure-developer-cli-authentication.md

azure-pipelines-authentication.md

client-assertion-authentication.md

configuration-and-utilities.md

credential-chaining.md

default-azure-credential.md

developer-tool-credentials.md

environment-credential.md

index.md

interactive-user-authentication.md

managed-identity-credential.md

service-principal-authentication.md

shared-token-cache-authentication.md

username-password-authentication.md

visual-studio-code-authentication.md

tile.json