我正在使用ARM模板通过GeoRecovery部署一些EventHub。我试图将Alias ConnectionString作为输出的一部分。
我打算使用ListKeys函数。但是,我不知道如何在ARM模板上使用它。我已经搜索并尝试了所有无法解决的方法。我正在使用
listKeys(resourceId(parameters('ResourceGroupName'), _
concat('Microsoft.EventHub/namespaces/disasterRecoveryConfigs/authorizationRules'), _
parameters('AliasNamespaceName'), 'RootManageSharedAccessKey'),'2015-08-01').primaryConnectionString
但是我得到一个错误->
: Deployment template validation failed: 'The template resource 'myresource' at line '90' and column '5' is not valid: Unable to evaluate template language function 'resourceId': the type 'Microsoft.EventHub/namespaces/disasterRecoveryConfigs/authorizationRules' requires '3' resource name argument(s). Please see https://aka.ms/arm-template-expressions/#resourceid for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'.
有人可以帮助我在ARM模板中获取ListKey吗?
答案 0 :(得分:0)
这看起来像是不正确的段长度-无效的模板incorrect segment length - invalid template问题。要解决此问题,您需要为正在使用的类型提供3个资源名称参数,即“ Microsoft.EventHub / namespaces / disasterRecoveryConfigs / authorizationRules”。有关更多说明,请参阅提供的示例here。
希望这会有所帮助!干杯!
答案 1 :(得分:0)
这是您要做的:
listKeys(resourceId(parameters('ResourceGroupName'), 'Microsoft.EventHub/namespaces/disasterRecoveryConfigs/authorizationRules', %namespacename%, %disasterrecoveryconfigname%, 'RootManageSharedAccessKey'), '2015-08-01').primaryConnectionString
答案 2 :(得分:0)
以下代码帮助了我。
"[listkeys(resourceId('Microsoft.Eventhub/namespaces/eventhubs/authorizationRules', parameters('eventHubNamespaceNamePrimary'), parameters('EventHubName'), 'EventWriter'), '2017-04-01').aliasPrimaryConnectionString]"