-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
When using AzureCliCredential in a non-interactive environment (e.g. IntelliJ IDEA plugin, background service, or other GUI-based Java applications on macOS), authentication fails with:
Exception or Stack Trace
2025-12-30 16:44:26,642 [ 11186] WARN - #com.github.gimhome.aiassistantstats.auth.AuthServiceCompanion - Interactive token acquisition failed com.azure.identity.CredentialUnavailableException: AzureCliCredential authentication unavailable. Azure CLI not installed.To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/java/identity/azclicredential/troubleshoot at com.azure.identity.implementation.IdentityClientBase.getTokenFromAzureCLIAuthentication(IdentityClientBase.java:634) at com.azure.identity.implementation.IdentityClient.authenticateWithAzureCli(IdentityClient.java:318) at com.azure.identity.AzureCliCredential.getToken(AzureCliCredential.java:81) at
-------------------.AuthServiceacquireInteractiveToken2.invokeSuspend(AuthService.kt:234) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100) at kotlinx.coroutines.internal.SoftLimitedDispatcherWorker.run(SoftLimitedDispatcher.kt:130)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:613)
at kotlinx.coroutines.scheduling.CoroutineSchedulerWorker.executeTask(CoroutineScheduler.kt:1183) at kotlinx.coroutines.scheduling.CoroutineSchedulerWorker.runWorker(CoroutineScheduler.kt:778)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:765)
Suppressed: java.lang.Exception: #block terminated with an error
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104)
at reactor.core.publisher.Mono.block(Mono.java:1779)
To Reproduce
- Install Azure CLI on macOS using Homebrew
(e.g./usr/local/bin/azor/opt/homebrew/bin/az) - Use
AzureCliCredentialin a Java application running in a non-interactive / GUI environment
(e.g. IntelliJ IDEA plugin) - Ensure
/bin/shis invoked without a login shell or user PATH initialization - Call
AzureCliCredential.getToken(...)
Code Snippet
Add the code snippet that causes the issue.
Expected behavior
- correctly locate the Azure CLI executable when it is installed, or
- provide a clearer error indicating PATH resolution issues
Screenshots
If applicable, add screenshots to help explain your problem.
Setup (please complete the following information):
- OS: MacOS
- IDE: IntelliJ
- Library/Libraries: [e.g. com.azure:azure-core:1.16.0 (groupId:artifactId:version)]
- Java version: [e.g. 8]
- App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]
- Frameworks: [e.g. Spring Boot, Micronaut, Quarkus, etc]
If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:
- verbose dependency tree (
mvn dependency:tree -Dverbose) - exception message, full stack trace, and any available logs
Additional context
Add any other context about the problem here.
Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- Bug Description Added
- Repro Steps Added
- Setup information Added
Metadata
Metadata
Assignees
Labels
Type
Projects
Status