I created an event grid subscription on storage account for a blob created event. I want to create the same thing using an ARM template but having trouble.
Observations-
- running the below template creates an event grid subscription on the resource group and not on the storage account.
- As per the Issue #563 and #455, providers should be used as the type. But 'providers' type is not valid in apiversion "2020-04-01-preview".
{
"name": "[parameters('blobcreate_eventsubscription_name')]",
"apiVersion": "2020-04-01-preview",
"type": "Microsoft.EventGrid/eventSubscriptions",
"dependsOn": [
"[variables('storageAccountResourceId')]" //,
//"[variables('functionAppResourceId')]"
],
"properties": {
// "topic": "[variables('storageAccountResourceId')]",
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "[variables('azureFunctionResourceId')]",
"maxEventsPerBatch": 1,
"preferredBatchSizeInKilobytes": 64
}
},
"filter": {
"subjectBeginsWith": "[concat('/blobServices/default/containers', parameters('storageAccounts_blobname'))]",
"subjectEndsWith": ".xml",
"includedEventTypes": [
"Microsoft.Storage.BlobCreated"
],
"advancedFilters": []
},
"labels": [],
"eventDeliverySchema": "EventGridSchema",
"retryPolicy": {
"maxDeliveryAttempts": "[parameters('eventgrid_maxDeliveryAttemps')]",
"eventTimeToLiveInMinutes": "[parameters('eventgrid_eventTimeToLiveInMinutes')]"
},
"deadLetterDestination": {
"endpointType": "StorageBlob",
"properties": {
"resourceId": "[variables('storageAccountResourceId')]",
"blobContainerName": "[parameters('storageAccounts_deadletterblob_name')]"
}
}
}
}