Hello @Shivasai ,
Thanks for the question and using MS Q&A platform.
As we understand the ask here is "How can I build the Event Hub connection string in my Databricks notebook, rather than fetching from portal?".
The good news, is we have a tool for just that, The Connection String Builder. It takes the namespace name, hub name, and SAS key & name. You already mentioned the first two, all you still need is the SAS part.
Link to Connection String Builder in documentaiton
import org.apache.spark.eventhubs.ConnectionStringBuilder
val connectionString = ConnectionStringBuilder()
.setNamespaceName("<namespace-name>")
.setEventHubName("<eventhub-name>")
.setSasKeyName("<key-name>")
.setSasKey("<key>")
.build
Please do let me if you have any queries.
Thanks
Martin
- Please don't forget to click on or upvote button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
- Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators