ARM模板concat资源

时间:2016-11-25 13:20:27

标签: azure azure-resource-manager

我有ARM模板:

"parameters": {
    "applications": {
        "value": "app1|app2|...|app(n)"
    }
},
"variables": {
    "applications": "[split(parameters('applications'), '|')]"
},

{
    "name": "[concat('notificationhub', copyIndex())]",
    "type": "Microsoft.Resources/deployments",
    "apiVersion": "2016-09-01",
    "dependsOn": [
        "[concat('Microsoft.NotificationHubs/namespaces/',variables('notificationHubNamespace'))]"
     ],
    "copy": {
        "name": "notificationhubCopy",
        "count": "[length(variables('applications'))]"
    },
    "parameters": {
        "notificationHubNamespace": { "value" : "variables('notificationHubNamespace')]" },
        "notificationHubName": { "value": "[concat('notificationhub-', variables('applications')[copyIndex()])]" },
        ...        
        }
    }
},

如何在应用程序设置(如

)中将创建的notificationhub1和notificationhub2连接成一个值

" notificationhub1.connection | notificationhub2.connection | ... | notificationhub(N)■连接"

或者是否有基于具有相应值的计数属性在应用程序设置中动态创建的选项?

{
    "name": "[variables('webappName')]",
    "type": "Microsoft.Web/sites",
    "location": "[resourceGroup().location]",
    "resources": [
    {
        "name": "appsettings",
        "type": "config",
        "properties": {
            "MobileApps": "[parameters('applications')]",
            "NotificationHubs": "???",
              -- OR --
            "App1NotificationHub": "notificationhub1.connection"
            "App2NotificationHub": "notificationhub2.connection"
            "App(n)NotificationHub": "notificationhubn(n).connection"
        }

    }
},

1 个答案:

答案 0 :(得分:0)

我不能100%肯定这一点,但是看看你在这里有什么这样的东西应该有用:

[concat(listKeys(resourceId('Microsoft.EventHub/namespaces/authoriz‌​ationRules', 'eventHubNamespaceName', 'keyName'),'2015-08-01').primaryConnectionString, '|', listKeys(resourceId('Microsoft.EventHub/namespaces/authoriz‌​ationRules', 'eventHubNamespaceName', 'keyName'),'2015-08-01').primaryConnectionString)]

我无法验证eventhubs的listkeys是否像这样工作,但是当你弄清楚listkeys是如何工作的时候,你应该可以将它粘贴到上面的例子中。
还' |'可能需要逃避。我想用\完成转义。

编辑:再次,我对此不确定,我从未尝试过,但您希望使用此link并尝试使用通知中心而非存储帐户重现它。

相关问题