如何在带有事件中心的ARM模板中使用listkeys函数

RuS*_*uSs 1 azure azure-eventhub azure-resource-manager azure-keyvault azure-rm-template

我有一个如下所示的事件中心: 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

我已经为服务总线成功完成了此操作,但仅针对高级RootManageSharedAccessKey了

但是,对于事件中心,我希望使用SendOnly共享访问策略的主连接字符串。

我尝试了许多组合,但是在部署部署时找不到SendOnly共享访问策略。

这是我的SendOnly共享访问策略的json。

在此处输入图片说明

任何帮助将不胜感激。

4c7*_*b41 7

使用它来获取连接字符串:

"[listkeys(resourceId('Microsoft.Eventhub/namespaces/authorizationRules',
  parameters('name'), 'RootManageSharedAccessKey'),
  '2017-04-01').primaryConnectionString]"
Run Code Online (Sandbox Code Playgroud)

你不能把它分成几行,我这样做是为了可读性


RuS*_*uSs 6

最终有效的ARM模板代码为:

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

请注意,代替此:

Microsoft.Eventhub/namespaces/authorizationRules
Run Code Online (Sandbox Code Playgroud)

我不得不用这个:

Microsoft.EventHub/namespaces/eventhubs/authorizationRules
Run Code Online (Sandbox Code Playgroud)

这是我使用的示例:https : //github.com/pascalnaber/EnterpriseARMTemplates/blob/6babc4d3e65f10f999bb144a1d616ccb2a085e9d/templates/resources/Microsoft.Eventhub/azuredeploy.json