javaazuresas-token

What are the proper arguments for the generation of a SAS token to connect to Azure eventhub?


While reading this HTTP POST between Postman and EventHub, I was directed to this: https://learn.microsoft.com/en-us/rest/api/eventhub/generate-sas-token#java

I don't know what resourceUri, keyName, and key to use. Do I use the full URL for the eventHub?

Maybe somebody here could clarify where to get these three parameters.


Solution

  • But I don't know what resourceUri, keyName, and key to use. Do I use the full url for the eventHub?

    You can get these three parameters from the azure portal as shown in the below screenshot:

    --> Goto your EventHub Namespace -->shared access policies--> Select default shared access policy(RootManageSharedAccessKey)-->copy Connection string–primary key.

    enter image description here

    These are the parameters we need to pass to that method for generating the SAS token.

    Endpoint=sb://mmxxxxxxxdows.net/; 
    SharedAccessKeyName=RootManageSharedAccessKey;
    SharedAccessKey=K4Qxxxxxxxxxxxx9o=