Please add Microsoft Entra authentication for Azure: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#authentication

Comment From: markpollack

Thanks, we will look into this.

Comment From: williamspindox

I'm trying something like this on org.springframework.ai.autoconfigure.azure.openai.AzureOpenAiAutoConfiguration:

AzureProfile azureProfile = new AzureProfile(AzureEnvironment.AZURE); TokenCredential tokenCredential = new ClientSecretCredentialBuilder() .clientId("xxxxxxxxxxxxxxxxx") .clientSecret("xxxxxxxxxxxxxxxxx") .tenantId("xxxxxxxxxxxxxxxxx") .authorityHost(azureProfile.getEnvironment().getActiveDirectoryEndpoint()) .build(); return new OpenAIClientBuilder().endpoint(connectionProperties.getEndpoint()) .credential(tokenCredential) .buildClient();

It works, I get:

Azure Identity => getToken() result for scopes [https://cognitiveservices.azure.com/.default]: SUCCESS

Comment From: williamspindox

When will it be available on your release? Thank you

Comment From: markpollack

also see https://github.com/spring-projects/spring-ai/issues/309

Comment From: williamspindox

https://github.com/spring-projects/spring-ai/pull/448

Comment From: markpollack

I will ask someone from microsoft to review this, I am not able to easily evaluate what is going on here. Sorry it is taking a while.

Comment From: williamspindox

No problem. I've already tested my PR with the Entra authentication on Azure and it works great, but welcome a check by someone from Microsoft. Regards.