2017-06-06 25 views
0

我們試圖部署一個ARM模板,用於部署流分析作業n事件中心輸出取決於輸入參數。 現在我們遇到的所有成功,但outputs屬性複製循環功能,獲取每個活動中心的主鍵內listKeys()功能:listIndex()中的copyIndex()

"sharedAccessPolicyKey": "[listKeys(resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('clientEventHubNamespace'), parameters('clients')[copyIndex('outputs')].id, variables('clientEventHubClientSharedAccessName')), '2015-08-01').primaryKey]" 

我們得到的錯誤:

17:44:31 - Error: Code=InvalidTemplate; Message=Deployment template validation failed: 'The template resource 'tailor-router-axgf7t3gtspue' at line '129' and column '10' is not valid: The template function 'copyIndex' is not expected at this location. The function can only be used in a resource with copy specified. Please see https://aka.ms/arm-copy for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.'.

然而,如果我們將其更改爲特定索引:

"sharedAccessPolicyKey": "[listKeys(resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('clientEventHubNamespace'), parameters('clients')[0].id, variables('clientEventHubClientSharedAccessName')), '2015-08-01').primaryKey]" 

它的工作原理。

copyIndex('propertyName')一個listKeys()支持的功能裏面? 如果沒有,是否有解決方法可以達到相同的效果?

親切的問候,

尼克


流分析工作資源定義:

{ 
    "apiVersion": "2016-03-01", 
    "type": "Microsoft.StreamAnalytics/StreamingJobs", 
    "name": "[variables('routerStreamAnalyticsName')]", 
    "location": "[variables('location')]", 
    "dependsOn": [ "clientsEventHubCopy" ], 
    "tags": { 
    "boundedContext": "[variables('boundedContextName')]" 
    }, 
    "properties": { 
    "sku": { 
     "name": "[parameters('routerStreamAnalyticsSkuTier')]" 
    }, 
    "outputErrorPolicy": "drop", 
    "eventsOutOfOrderPolicy": "adjust", 
    "eventsOutOfOrderMaxDelayInSeconds": 0, 
    "eventsLateArrivalMaxDelayInSeconds": 5, 
    "dataLocale": "en-US", 
    "compatibilityLevel": "1.0", 
    "inputs": [ 
     { 
     "name": "input0", 
     "properties": { 
      "type": "stream", 
      "serialization": { 
      "type": "Avro" 
      }, 
      "datasource": { 
      "type": "Microsoft.ServiceBus/EventHub", 
      "properties": { 
       "serviceBusNamespace": "[parameters('input0EventHubNamespace')]", 
       "sharedAccessPolicyName": "[parameters('input0EventHubSharedAccessPolicyName')]", 
       "sharedAccessPolicyKey": "[parameters('input0EventHubSharedAccessPolicyKey')]", 
       "eventHubName": "[parameters('input0EventHubName')]" 
      } 
      } 
     } 
     } 
    ], 
    "transformation": { 
     "name": "routing", 
     "properties": { 
     "streamingUnits": "[parameters('routerStreamAnalyticsSkuTier')]", 
     "query": "omitted" 
     } 
    }, 
    "copy": [ 
     { 
     "name": "outputs", 
     "count": "[length(parameters('clients'))]", 
     "input": { 
      "name": "[parameters('clients')[copyIndex('outputs')].id]", 
      "properties": { 
      "datasource": { 
       "type": "Microsoft.ServiceBus/EventHub", 
       "properties": { 
       "serviceBusNamespace": "[variables('clientEventHubNamespace')]", 
       "sharedAccessPolicyName": "[variables('clientEventHubClientSharedAccessName')]", 
       "sharedAccessPolicyKey": "[listKeys(resourceId('Microsoft.EventHub/namespaces/eventhubs/authorizationRules', variables('clientEventHubNamespace'), parameters('clients')[copyIndex('outputs')].id, variables('clientEventHubClientSharedAccessName')), '2015-08-01').primaryKey]", 
       "eventHubName": "[parameters('clients')[copyIndex('outputs')].id]" 
       } 
      }, 
      "serialization": { 
       "type": "Avro" 
      } 
      } 
     } 
     } 
    ] 
    } 
}, 
+0

''是copyIndex( 'propertyName的')一個listKeys()內支持的功能?如果沒有,是否有一種解決方法可以達到同樣的效果?''我做了一個測試,出現同樣的錯誤,我會繼續研究這個問題。此外,作爲解決方法,您可以嘗試爲輸出創建多個單獨的部分。 –

+0

感謝@ FredHan-MSFT 能否請您闡述一下「的輸出多個獨立的部分」? –

+0

''我們正在嘗試部署其部署具有n個事件集線器的Stream分析工作outputs''試圖單獨爲這n個事件集線器輸出定義一個ARM模板。 –

回答

1

感謝您報告這一點,很抱歉給您帶來不便。 我剛纔講了ARM的團隊,我們有一個問題,當copyindex是索引標籤內如「陣列[copyindex()」。現在應該修好了。

讓我們知道如何去。

感謝,

JS - Azure的數據流分析

相關問題