Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.25k stars 1.93k forks source link

[QUERY] Unable to use Managed Identity to connect Cosmos DB using Spark Cosmos OLTP connector #40604

Open kbharucha opened 3 weeks ago

kbharucha commented 3 weeks ago

Query/Question We are using Spark Cosmos DB OLTP connector to connect Cosmos DB from HDInsights. We are trying to connect using Managed Identity. As per the documentation followed, we are using supported connector and have set necessary configs in the spark config. However, we are getting this error.

Caused by: azure_cosmos_spark.com.microsoft.aad.msal4j.MsalAzureSDKException: java.util.concurrent.ExecutionException: azure_cosmos_spark.com.azure.identity.CredentialUnavailableException: ManagedIdentityCredential authentication unavailable. Connection to IMDS endpoint cannot be established. at azure_cosmos_spark.com.microsoft.aad.msal4j.AcquireTokenByAppProviderSupplier.fetchTokenUsingAppTokenProvider(AcquireTokenByAppProviderSupplier.java:79) at azure_cosmos_spark.com.microsoft.aad.msal4j.AcquireTokenByAppProviderSupplier.execute(AcquireTokenByAppProviderSupplier.java:56) at azure_cosmos_spark.com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.acquireTokenByClientCredential(AcquireTokenByClientCredentialSupplier.java:78) at azure_cosmos_spark.com.microsoft.aad.msal4j.AcquireTokenByClientCredentialSupplier.execute(AcquireTokenByClientCredentialSupplier.java:49) at azure_cosmos_spark.com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:69) at azure_cosmos_spark.com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:18) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)

We would like to understand if there are any missing configs.   Why is this not a Bug or a feature Request? We followed required documentation. https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-cosmos-spark_3_2-12/docs/configuration-reference.md#aad-auth-config

Setup (please complete the following information if applicable):

github-actions[bot] commented 3 weeks ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar @pjohari-ms @TheovanKraay.

kushagraThapar commented 3 weeks ago

@tvaron3 can you please check on this issue, thanks!