<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: failed to initialise azure-event-hub with azure AAD(service principal) in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5771#M2093</link>
    <description>&lt;P&gt;No, I specifically selected Java as implementation language for my library to avoid problems with Scala versions, etc.&lt;/P&gt;</description>
    <pubDate>Thu, 20 Apr 2023 07:31:42 GMT</pubDate>
    <dc:creator>alexott</dc:creator>
    <dc:date>2023-04-20T07:31:42Z</dc:date>
    <item>
      <title>failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5767#M2089</link>
      <description>&lt;P&gt;We have been trying to authenticate azure-event-hub with azure AD(service principal) instead of shared access key(connection string) and read events from azure-event-hub and it is failing to initialise azure-event-hubs. And throwing no such method exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am attaching the screenshot for the full error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Error message full"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/355i9036AAEA22A694C3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Error message full" alt="Error message full" /&gt;&lt;/span&gt;From the error i can see it is because of scala run time compatibility, can someone help me with this please ?&amp;nbsp;I am not sure if i am missing something here. &lt;/P&gt;&lt;P&gt;Following are my configurations: &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I am using databricks run time 10.4 LTS.&lt;/LI&gt;&lt;LI&gt;Azure service principle has 'Azure event hub data receiver' permission&lt;/LI&gt;&lt;LI&gt;installed following dependencies on 10.4 LTS&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt; com.microsoft.azure:azure-eventhubs-spark_2.12:2.3.22&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;com.microsoft.azure:msal4j:1.10.1&lt;/P&gt;&lt;P&gt; 4.Trying to implement solutions given in the repositories below.&lt;/P&gt;&lt;P&gt; &lt;A href="https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/use-aad-" alt="https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/use-aad-" target="_blank"&gt;&lt;/A&gt;&lt;A href="https://github.com/Azure/azure-event-hubs-" target="test_blank"&gt;https://github.com/Azure/azure-event-hubs-&lt;/A&gt; spark/blob/master/docs/use-aad-&lt;A href="https://authentication-to-connect-eventhubs.md" alt="https://authentication-to-connect-eventhubs.md" target="_blank"&gt;authentication-to-connect-eventhubs.md&lt;/A&gt; &amp;amp; &lt;/P&gt;&lt;P&gt; &lt;A href="https://github.com/alexott/databricks-playground/tree/main/kafka-eventhubs-aad-auth/src/main/java/net/alexott/demos/eventhubs_aad" alt="https://github.com/alexott/databricks-playground/tree/main/kafka-eventhubs-aad-auth/src/main/java/net/alexott/demos/eventhubs_aad" target="_blank"&gt;https://github.com/alexott/databricks-playground/tree/main/kafka-eventhubs-aad-auth/src/main/java/net/alexott/demos/eventhubs_aad&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;@Alex Ott​&amp;nbsp; please could you help with this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Apr 2023 18:52:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5767#M2089</guid>
      <dc:creator>Ravikumashi</dc:creator>
      <dc:date>2023-04-16T18:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5768#M2090</link>
      <description>&lt;P&gt;Just follow instructions from my repository (don't use azure docs):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Build with correct profile&lt;/LI&gt;&lt;LI&gt;install correct dependencies&lt;/LI&gt;&lt;LI&gt;configure as per readme&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I've tested it on 10.4, and everything worked just fine&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 17:36:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5768#M2090</guid>
      <dc:creator>alexott</dc:creator>
      <dc:date>2023-04-18T17:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5769#M2091</link>
      <description>&lt;P&gt;@Alex Ott​&amp;nbsp;thank you for your reply, I am working on scala implementation for this, any suggestions in that case ?&lt;/P&gt;&lt;P&gt;I have added ServicePrincipalCredentialsAuth and ServicePrincipalAuthBase as a normal classes in scala native instead of creating a separate jar for these 2 classes and packaged them as a part of my project jar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And using the below code for configuring.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val params: Map[String, String] = Map("authority" -&amp;gt; dbutils.secrets.get(scope = "nykvsecrets", key = "ehaadtesttenantid"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"clientId" -&amp;gt; dbutils.secrets.get(scope = "nykvsecrets", key = "ehaadtestclientid"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"clientSecret" -&amp;gt; dbutils.secrets.get(scope = "nykvsecrets", key = "ehaadtestclientsecret"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val connectionString = ConnectionStringBuilder()&lt;/P&gt;&lt;P&gt;&amp;nbsp;.setAadAuthConnectionString(new URI("your-ehs-endpoint"), "your-ehs-name")&lt;/P&gt;&lt;P&gt;&amp;nbsp;.build&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;val ehConf = EventHubsConf(connectionString)&lt;/P&gt;&lt;P&gt;&amp;nbsp;.setConsumerGroup("consumerGroup")&lt;/P&gt;&lt;P&gt;&amp;nbsp;.setAadAuthCallback(new ServicePrincipalCredentialsAuth(params))&lt;/P&gt;&lt;P&gt;&amp;nbsp;.setAadAuthCallbackParams(params)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any issue you see with this ?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 18:02:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5769#M2091</guid>
      <dc:creator>Ravikumashi</dc:creator>
      <dc:date>2023-04-18T18:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5770#M2092</link>
      <description>&lt;P&gt;@Alex Ott​&amp;nbsp;do we have the equivalent scala repo for this ?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2023 22:50:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5770#M2092</guid>
      <dc:creator>Ravikumashi</dc:creator>
      <dc:date>2023-04-18T22:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5771#M2093</link>
      <description>&lt;P&gt;No, I specifically selected Java as implementation language for my library to avoid problems with Scala versions, etc.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2023 07:31:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5771#M2093</guid>
      <dc:creator>alexott</dc:creator>
      <dc:date>2023-04-20T07:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5772#M2094</link>
      <description>&lt;P&gt;I think it is working now. what i was trying to do, which is not right in this case was trying to test this code directly in the databricks scala notebook with just installing libraries com.microsoft.azure:azure-eventhubs-spark_2.12:2.3.22 &amp;amp; com.microsoft.azure:msal4j:1.10.1 on the cluster and it was failing becuase there were few missing compile time libraries/packages that comes with azure-event-hubs-spark and msal4j libraries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for scala i had to make minor syntactical changes. And it started working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2023 16:43:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/5772#M2094</guid>
      <dc:creator>Ravikumashi</dc:creator>
      <dc:date>2023-04-21T16:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/39291#M26911</link>
      <description>&lt;P&gt;Hey Ravi,&lt;/P&gt;&lt;P&gt;Can you please provide the steps.! or any sample code in Scala.&lt;/P&gt;&lt;P&gt;We are also planning to do the same and facing issues.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Arun G&lt;/P&gt;</description>
      <pubDate>Mon, 07 Aug 2023 18:26:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/39291#M26911</guid>
      <dc:creator>arun_28</dc:creator>
      <dc:date>2023-08-07T18:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/64828#M32673</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/53346"&gt;@Ravikumashi&lt;/a&gt;&amp;nbsp;, Hi Ravi, Could you please provide me the sample working code how you managed this to work in scala and how you added these classes&amp;nbsp;&lt;SPAN&gt;ServicePrincipalCredentialsAuth and ServicePrincipalAuthBase. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am currently trying to stream event hub data using service principle and failing to do so.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Swathi.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 17:13:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/64828#M32673</guid>
      <dc:creator>swathi-dataops</dc:creator>
      <dc:date>2024-03-27T17:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: failed to initialise azure-event-hub with azure AAD(service principal)</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/64839#M32678</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/102922"&gt;@swathi-dataops&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added ServicePrincipalCredentialsAuth and ServicePrincipalAuthBase as a normal classes instead of creating a separate jar for these 2 classes and packaged them as a part of my project jar.&lt;/P&gt;&lt;P&gt;And used the below code for configuring/initializing the eventHub with SPN credentials.&lt;/P&gt;&lt;P&gt;val params: Map[String, String] = Map("authority" -&amp;gt; dbutils.secrets.get(scope = "databricks-secretes-scope", key = "ehaadtesttenantid"),&lt;BR /&gt;"clientId" -&amp;gt; dbutils.secrets.get(scope = "databricks-secretes-scope", key = "ehaadtestclientid"),&lt;BR /&gt;"clientSecret" -&amp;gt; dbutils.secrets.get(scope = "databricks-secretes-scope", key = "ehaadtestclientsecret"))&lt;/P&gt;&lt;P&gt;val yourEventHubEndpoint = "sb://&amp;lt;EventHubsNamespaceName&amp;gt;.servicebus.windows.net/"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;val connectionString = ConnectionStringBuilder()&lt;BR /&gt;.setAadAuthConnectionString(new URI($"yourEventHubEndpoint"), "yourEventHubsInstance")&lt;BR /&gt;.build&lt;/P&gt;&lt;P&gt;val ehConf = EventHubsConf(connectionString)&lt;BR /&gt;.setConsumerGroup("YourconsumerGroupForEventHubInstance")&lt;BR /&gt;.setAadAuthCallback(new ServicePrincipalCredentialsAuth(params))&lt;BR /&gt;.setAadAuthCallbackParams(params)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;val inputStreamdf = spark&lt;BR /&gt;.readStream&lt;BR /&gt;.format("eventhubs")&lt;BR /&gt;.options(ehConf.toMap())&lt;BR /&gt;.load()&lt;/P&gt;&lt;P&gt;And you can copy the ServicePrincipalCredentialsAuth and ServicePrincipalAuthBase class files from the repository below and in my side i have just changed variable declaration alone to scala sytle and kept the remaining as is.&lt;BR /&gt;&lt;A href="https://github.com/alexott/databricks-playground/tree/main/kafka-eventhubs-aad-auth/src/main/java/net/alexott/demos/eventhubs_aad" target="_blank" rel="noopener"&gt;https://github.com/alexott/databricks-playground/tree/main/kafka-eventhubs-aad-auth/src/main/java/net/alexott/demos/eventhubs_aad&lt;/A&gt;&lt;/P&gt;&lt;P&gt;more details on how to stream data to and from eventHubs can be found here &lt;A href="https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/PySpark/structured-streaming-pyspark.md#reading-data-from-event-hubs" target="_blank" rel="noopener"&gt;https://github.com/Azure/azure-event-hubs-spark/blob/master/docs/PySpark/structured-streaming-pyspark.md#reading-data-from-event-hubs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 18:33:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-initialise-azure-event-hub-with-azure-aad-service/m-p/64839#M32678</guid>
      <dc:creator>Ravikumashi</dc:creator>
      <dc:date>2024-03-27T18:33:59Z</dc:date>
    </item>
  </channel>
</rss>

