如何正确编写主题和订阅的 ARM 模板
How do I properly write an ARM template for topic and subscription
我有以下代码:
// Create event topics and listeners
{
"comments": "Service Bus Topic - clusterprocessingcompletedevent",
"type": "Microsoft.ServiceBus/namespaces/topics",
"name": "[concat(variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent')]",
"apiVersion": "2017-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('resource_names').service_bus_namespaces.core)]"
],
"resources": [
{
"comments": "Service Bus Topic Subscription - notification.clusterprocessingcompletedevent",
"apiVersion": "2017-04-01",
"name": "[concat(variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent', '/notification.clusterprocessingcompletedevent')]",
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent')]"
]
}
]
}
尝试使用它时,我收到此错误:
Unable to evaluate template language function 'resourceId': function
requires exactly one multi-segmented argument which must be resource
type including resource provider namespace
我该如何解决?
我认为这将是问题所在:
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('resource_names').service_bus_namespaces.core, 'clusterprocessingcompletedevent')]"
]
所以您的主题名称中多了一个 /
。这同样适用于此:variables('resource_names').service_bus_namespaces.core
。它应该是命名空间的名称,其中没有 /
。
我有以下代码:
// Create event topics and listeners
{
"comments": "Service Bus Topic - clusterprocessingcompletedevent",
"type": "Microsoft.ServiceBus/namespaces/topics",
"name": "[concat(variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent')]",
"apiVersion": "2017-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('resource_names').service_bus_namespaces.core)]"
],
"resources": [
{
"comments": "Service Bus Topic Subscription - notification.clusterprocessingcompletedevent",
"apiVersion": "2017-04-01",
"name": "[concat(variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent', '/notification.clusterprocessingcompletedevent')]",
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('resource_names').service_bus_namespaces.core, '/clusterprocessingcompletedevent')]"
]
}
]
}
尝试使用它时,我收到此错误:
Unable to evaluate template language function 'resourceId': function requires exactly one multi-segmented argument which must be resource type including resource provider namespace
我该如何解决?
我认为这将是问题所在:
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('resource_names').service_bus_namespaces.core, 'clusterprocessingcompletedevent')]"
]
所以您的主题名称中多了一个 /
。这同样适用于此:variables('resource_names').service_bus_namespaces.core
。它应该是命名空间的名称,其中没有 /
。