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

azure-developer-cli-authentication.mddocs/

Azure Developer CLI Authentication

Authenticates using Azure Developer CLI (azd) cached credentials from development environments, ideal for local development scenarios.

Capabilities

Azure Developer CLI Credential

Authenticates using cached credentials from Azure Developer CLI.

/**
 * Azure Developer CLI credential for development environments
 */
class AzureDeveloperCliCredential implements TokenCredential {
    Mono<AccessToken> getToken(TokenRequestContext request);
    AccessToken getTokenSync(TokenRequestContext request);
}

class AzureDeveloperCliCredentialBuilder extends CredentialBuilderBase<AzureDeveloperCliCredentialBuilder> {
    AzureDeveloperCliCredentialBuilder tenantId(String tenantId);
    AzureDeveloperCliCredentialBuilder processTimeout(Duration processTimeout);
    AzureDeveloperCliCredentialBuilder additionallyAllowedTenants(String... additionallyAllowedTenants);
    AzureDeveloperCliCredentialBuilder additionallyAllowedTenants(List<String> additionallyAllowedTenants);
    AzureDeveloperCliCredential build();
}

Usage Examples:

import com.azure.identity.AzureDeveloperCliCredential;
import com.azure.identity.AzureDeveloperCliCredentialBuilder;
import java.time.Duration;

// Basic usage - uses default settings
TokenCredential credential = new AzureDeveloperCliCredentialBuilder()
    .build();

// With specific tenant
TokenCredential tenantCredential = new AzureDeveloperCliCredentialBuilder()
    .tenantId("your-tenant-id")
    .build();

// With custom process timeout
TokenCredential timeoutCredential = new AzureDeveloperCliCredentialBuilder()
    .processTimeout(Duration.ofSeconds(30))
    .build();

// Use with Azure SDK clients
ResourceManagementClient client = ResourceManagementClient.builder()
    .credential(credential)
    .subscriptionId("your-subscription-id")
    .buildClient();

Prerequisites

Azure Developer CLI Installation:

  1. Install Azure Developer CLI: https://docs.microsoft.com/azure/developer/azure-developer-cli/install-azd
  2. Sign in using: azd auth login
  3. Verify authentication: azd auth login --check-status

Supported Authentication Methods:

  • Interactive browser login
  • Device code authentication
  • Service principal (when configured in azd)

Configuration Options

// Multi-tenant support
TokenCredential credential = new AzureDeveloperCliCredentialBuilder()
    .tenantId("primary-tenant-id")
    .additionallyAllowedTenants("tenant1", "tenant2", "tenant3")
    .processTimeout(Duration.ofSeconds(45))
    .build();

Process Timeout

The processTimeout setting controls how long to wait for the azd command to complete:

// Short timeout for fast environments
TokenCredential fastCredential = new AzureDeveloperCliCredentialBuilder()
    .processTimeout(Duration.ofSeconds(10))
    .build();

// Longer timeout for slower environments
TokenCredential slowCredential = new AzureDeveloperCliCredentialBuilder()
    .processTimeout(Duration.ofMinutes(2))
    .build();

Development Workflow

  1. Install and authenticate Azure Developer CLI:

    # Install azd
    # Sign in interactively
    azd auth login
    
    # Or sign in with device code
    azd auth login --use-device-code
  2. Use in your Java application:

    TokenCredential credential = new AzureDeveloperCliCredentialBuilder().build();
    
    // Use with any Azure SDK client
    KeyVaultSecret secret = new SecretClientBuilder()
        .vaultUrl("https://myvault.vault.azure.net/")
        .credential(credential)
        .buildClient()
        .getSecret("mysecret");

Exception Handling

Throws CredentialUnavailableException when:

  • Azure Developer CLI is not installed
  • User is not signed in (azd auth login not run)
  • Process timeout is exceeded
  • Command execution fails

Troubleshooting

Common Issues:

  • "azd not found": Ensure Azure Developer CLI is installed and in PATH
  • "Not signed in": Run azd auth login to authenticate
  • Timeout errors: Increase processTimeout duration
  • Permission errors: Ensure azd has necessary permissions for token cache access

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