<?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: How to stream data from azure event hub to databricks delta table in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132951#M49684</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/162302"&gt;@gayatrikhatale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Great, thanks for sharing alternative snippet. Also, if the answer was helpful to you please consider marking it as a solution. This way we help others find answer for similar question in faster way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Sep 2025 15:00:27 GMT</pubDate>
    <dc:creator>szymon_dybczak</dc:creator>
    <dc:date>2025-09-24T15:00:27Z</dc:date>
    <item>
      <title>How to stream data from azure event hub to databricks delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132936#M49678</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I want to stream data from azure event hub to databricks table.&lt;/P&gt;&lt;P&gt;But I want to use service principal details for that not event hub connection string.&lt;/P&gt;&lt;P&gt;Can anyone please share the code snippet?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 12:04:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132936#M49678</guid>
      <dc:creator>gayatrikhatale</dc:creator>
      <dc:date>2025-09-24T12:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to stream data from azure event hub to databricks delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132939#M49680</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/162302"&gt;@gayatrikhatale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Unity Catalog now supports Service Credentials, so you should use that way of authentication.&lt;SPAN&gt;&amp;nbsp;&lt;BR /&gt;Service credentials allow the generation of short-lived authentication tokens and connect to different Azure services without requiring passwords or other long-lived credentials. And they are managed by Unity Catalog, so you can limit who can use them, or allow their usage only from specific workspaces&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And good news is that Unity Catalog service credentials support Azure Event Hub:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/connect/streaming/kafka#service-cred" target="_blank" rel="noopener"&gt;Stream processing with Apache Kafka and Azure Databricks - Azure Databricks | Microsoft Learn&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, how to leverage this?&lt;/SPAN&gt;&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;Create&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/azure/databricks/connect/unity-catalog/cloud-services/service-credentials" target="_blank" rel="noopener ugc nofollow"&gt;UC Service Credential&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if you don’t have one.&lt;/LI&gt;&lt;LI&gt;Assign&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/azure/event-hubs/authorize-access-azure-active-directory#azure-built-in-roles-for-azure-event-hubs" target="_blank" rel="noopener ugc nofollow"&gt;necessary roles&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to it on Event Hubs (i.e.,&amp;nbsp;Azure Event Hubs Data receiver,&amp;nbsp;Azure Event Hubs Data sender, etc.)&lt;/LI&gt;&lt;LI&gt;Specify the service credential name in the&amp;nbsp;databricks.serviceCredential&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;option when reading or writing data.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;credential_name = "service-credential"
eh_server = "&amp;lt;host&amp;gt;.servicebus.windows.net:9093"

eh_opts = {
    "databricks.serviceCredential": credential_name,
    "kafka.bootstrap.servers": eh_server,
    "subscribe": "iocs",
    "startingOffsets": "earliest"
}
df = spark.readStream.format("kafka").options(**eh_opts).load()
display(df.selectExpr("CAST(value AS STRING) as value"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 12:20:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132939#M49680</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-09-24T12:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to stream data from azure event hub to databricks delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132950#M49683</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;. It's working for me.&lt;/P&gt;&lt;P&gt;I have also found one more way to do same thing. Below is the code snippet:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from azure.identity import DefaultAzureCredential
  from azure.eventhub import EventHubConsumerClient
  # Replace with your Event Hub details
  event_hub_namespace = "Your-EventHub-Namespace.servicebus.windows.net"
  event_hub_name = "Your-EventHub-Name"
  consumer_group = "$Default"
  # Use Managed Identity for authentication
  credential = DefaultAzureCredential()
  client = EventHubConsumerClient(
      fully_qualified_namespace=event_hub_namespace,
      eventhub_name=event_hub_name,
      consumer_group=consumer_group,
      credential=credential
  )
  def on_event(partition_context, event):
      print("Received event: {}".format(event.body_as_str()))
      partition_context.update_checkpoint(event)
  with client:
      client.receive(on_event=on_event)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Sep 2025 14:57:34 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132950#M49683</guid>
      <dc:creator>gayatrikhatale</dc:creator>
      <dc:date>2025-09-24T14:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to stream data from azure event hub to databricks delta table</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132951#M49684</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/162302"&gt;@gayatrikhatale&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Great, thanks for sharing alternative snippet. Also, if the answer was helpful to you please consider marking it as a solution. This way we help others find answer for similar question in faster way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 15:00:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-stream-data-from-azure-event-hub-to-databricks-delta/m-p/132951#M49684</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2025-09-24T15:00:27Z</dc:date>
    </item>
  </channel>
</rss>

