Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use listkeys function in an ARM Template with Event Hub

I have an event hub that looks like this: enter image description here

enter image description here

enter image description here

enter image description here

I have successfully done it for service bus, but only for the high level RootManageSharedAccessKey.

However with Event Hub I want the primary connection string for the SendOnly shared access policy.

I have tried many combinations but I when I deploy the deployment cant find the SendOnly shared access policy.

Here is the json for my SendOnly shared access policy.

enter image description here

Any help will be greatly appreciated.

like image 303
RuSs Avatar asked Nov 29 '22 22:11

RuSs


1 Answers

The final working ARM template code was:

[listkeys(resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('ehub').name, parameters('eventhubs_myaccountevents_name'), 'SendOnly'), parameters('eventhubs_api_version')).primaryConnectionString]

Note that instead of this:

Microsoft.Eventhub/namespaces/authorizationRules

I had to use this:

Microsoft.EventHub/namespaces/eventhubs/authorizationRules

Here is the sample I used: https://github.com/pascalnaber/EnterpriseARMTemplates/blob/6babc4d3e65f10f999bb144a1d616ccb2a085e9d/templates/resources/Microsoft.Eventhub/azuredeploy.json

like image 85
RuSs Avatar answered Dec 06 '22 13:12

RuSs