【发布时间】:2020-03-31 11:48:38
【问题描述】:
我正在尝试从自定义主题为我的存储队列设置事件网格订阅。
在门户中导航时很容易做到这一点,但我无法为此创建适当的 ARM 模板。经过大量搜索和尝试,我想出了以下模板。
{
"name": "MyCustomTopicName/Microsoft.EventGrid/MySubscriptionName",
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"location": "[resourceGroup().location]",
"apiVersion": "2019-06-01",
"properties": {
"destination": {
"endpointType": "StorageQueue",
"properties": {
"resourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('theNameOfMyStorageAccount'))]",
"queueName": "[variables('theNameOfMyQueue')]"
}
},
"filter": {
"advancedFilters": []
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
}
}
这在我看来相当不错,但失败了,因为事件网格主题不在我将模板部署到的资源组中。
Deployment failed. Correlation ID: [guid]. {
"error": {
"code": "ResourceNotFound",
"message": "The Resource 'Microsoft.EventGrid/topics/MyCustomTopicName' under resource group 'TheResourceGroupTheStorageAccountIsIn' was not found."
}
}
我正在将完整的 ARM 模板部署到 TheResourceGroupTheStorageAccountIsIn。
MyCustomTopicName 主题位于我们放置自定义主题的资源组中,因此所有服务都可以使用它。
我尝试使用自定义主题的完整标识符(资源 ID),但这无效。想法?
PS:我正在使用类似的模板来创建 Azure Functions 的订阅,它确实可以正常工作。那里的主要区别是destination 块,这是有道理的。
【问题讨论】:
-
能否分享一个用于针对函数部署订阅的 ARM 模板的 sn-p 吗?
标签: azure arm-template azure-eventgrid