-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
There seems to be some sort of bug when using OpenAIClient and the DefaultAzureCredential. It creates an error log for [Managed Identity] Authentication unavailable. when attempting to start. At least one of the Default Azure Credential types is valid, I shouldn't be seeing this error.
Exception or Stack Trace
2026-03-17T12:42:10.151-07:00 ERROR 31448 --- [global-thread-0] c.m.a.msal4j.IMDSManagedIdentitySource : Error message: [Managed Identity] Authentication unavailable. The requested identity has not been assigned to this resource.Status: 400Content:{"error":"invalid_request","error_description":"Identity not found"}Headers:Server[IMDS/150.870.65.1854]Content-Length[68]x-ms-request-id[9ab0167a-405e-41ce-8d3d-6221a92863fb]Date[Tue, 17 Mar 2026 19:42:09 GMT]Content-Type[application/json; charset=utf-8] [Managed Identity] Error Code: invalid_request Error Message: Identity not found Http status code: 400
2026-03-17T12:42:10.154-07:00 WARN 31448 --- [global-thread-0] c.m.a.msal4j.ManagedIdentityApplication : [Correlation ID: 9b5d8539-b3be-4252-a572-e3cd8dd71564] Execution of class com.microsoft.aad.msal4j.AcquireTokenByManagedIdentitySupplier failed: [Managed Identity] Authentication unavailable. The requested identity has not been assigned to this resource.Status: 400Content:{"error":"invalid_request","error_description":"Identity not found"}Headers:Server[IMDS/150.870.65.1854]Content-Length[68]x-ms-request-id[9ab0167a-405e-41ce-8d3d-6221a92863fb]Date[Tue, 17 Mar 2026 19:42:09 GMT]Content-Type[application/json; charset=utf-8] [Managed Identity] Error Code: invalid_request Error Message: Identity not found
To Reproduce
Steps to reproduce the behavior:
See Code snippet.
Code Snippet
OpenAIClient openAIClient = new AIProjectClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildOpenAIClient();
Expected behavior
I should see error for not setup credentials if there is a valid one,.
This does seem like more than one bug.
Setup (please complete the following information):
- OS: Windows
- IDE: vscode
- Library/Libraries: azure-identity 1.18.0, azure-ai-projects 2.0.0-beta.2
- Java version: 17
- App Server/Environment: [e.g. Tomcat, WildFly, Azure Function, Apache Spark, Databricks, IDE plugin or anything special]
- Frameworks: Spring Boot
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